hey guys,
I have a script that processes files whether they are in a folder or not. I’m finding that if I have files with names created as unicode characters (in the error case they happen to be hebrew characters) I get a failure when setting the reference to the file as an alias, but only in one part of my code. I set an alias one way if a file has been dragged, but a different way if I’m finding a file in a folder being processed. I’ve tried different ways to set the alias, but they all fail on me. Looking for some help, maybe there is another way to set the file alias.
The error I get is “-43” file not found error when I set the alias in the “process folder” block below.
The “on run” block contains the following code, and if I dragged a unicode named file onto the script and it uses this alias setting (the item assignment is an alias by default I believe), things are fine.
repeat with i from 1 to the count of these_items
set this_item to (item i of these_items)
set the item_info to info for this_item
if (folder of the item_info is true) then
process_folder(this_item)
else
process_item(this_item)
end if
end repeat
However, when drag a folder onto the application, it calls the process folder function, which does the following to create an alias. This time (in my test case) the item should be a file, but I never get to process it, as it fails on the alias setting with the -43 error (file not found).
repeat with i from 1 to the count of these_items
set this_item to alias ((this_folder as text) & (item i of these_items))
set the item_info to info for this_item
if (folder of the item_info is true) then
process_folder(this_item)
else
process_item(this_item)
end if
end repeat
Thanks,
Sean