HI,
I have a third party app, which generates some folders, some empty and some with files. It also generates a text file listing the POSIX path of all those folders.
I’ve written an AS script to read the text file and then post-process the actual files from those folders. My script seems to work well doing what I intended it to do but, I just noticed a strange error while watching the script replies in the AS editor. Although the error
--> error number -1728 from POSIX file "/path/to/folder/"
is there, the actual result is correct. How strange !!!
This is a test script to show both the error in the replies and the correct result:
tell application "Finder"
-- Make a test folder "myFolder" on your desktop and put any file in it. I put "myFile.rtf" in it.
-- The first line sets a list because I'm actually getting a list of 7 folders in POSIX format.
set theFolders to {POSIX path of (path to desktop from user domain as string) & "myFolder/"}
-- I convert the path to the Mac format because of the line after it.
set mF to POSIX file (item 1 of theFolders) as string --> error number -1728 from POSIX file "/Users/username/Desktop/myFolder/"
-- "every item of folder ." requires the folder in Mac format.
set mF_items to every item of folder mF --> {document file "myFile.rtf" of folder "myFolder" of folder "Desktop" of folder "username" of folder "Users" of startup disk}
end tell
Please, can somebody explain to me:
- Why, notwithstanding the error in the script replies, the result of the script is correct?
- Is this statement in my script incorrect, and if yes, how should it be?
set mF to POSIX file (item i of theFolders) as string
- in the next script line, the statement
set mF_items to every item of folder mF
seems to work only with Mac path input. Is there a similar command accepting POSIX path input but, without getting any hidden files?
4. Since that error in the replies seems inconsequential, could I simply disregard it? :lol:
BTW, if the initial list would be in Mac path format,
set theFolders to {"Volume:Users:username:Desktop:myFolder:"
then the conversion from POSIX to Mac would not be required and thus there’d be no error in the script replies.
Unfortunately, that’s not how I get that list.
Any helpful comments and advice will be greatly appreciated.