Le 10/11/2014 à 15:41, Robert Poland < email@hidden> a écrit : … As above - tell application "Finder" set theFolder to "" & "~/Pictures/APOD ƒ/" set theFolder to (choose file default location alias the folder end tell … Robert Poland Fort Collins CO
Hello Robert. It seems that you decided to live dangerously. Two typos in four instructions when two of them are useless.
Here is the code after autumn cleaning
-- tell application "Finder" set theFolder to "" & "~/Pictures/APOD ƒ/" --set theFolder to (choose file default location alias the folder set theFolder to (choose file default location alias theFolder) -- end tell I don't understand why you wrote
set theFolder to "" & "~/Pictures/APOD ƒ/"when set theFolder to "~/Pictures/APOD ƒ/"does exactly the same thing but I didn't edit the instruction.
As it was said many times, neither the Finder nor Applescript are able to work with unix paths starting with a tilde. This code which use a handler to convert your unusable path into an usable one behaves flawlessly.
set theFolder to "" & "~/Pictures/APOD ƒ/" set theFolder to my convertTildePathToHfs(theFolder) set theFolder to (choose file default location alias theFolder)
on convertTildePathToHfs(aPath) set pp to POSIX file (do shell script "echo " & quoted form of aPath) log pp tell application "System Events" path of disk item (pp as text) end tell return result end convertTildePathToHfs
I wish to add that it's a bit puzzling to see in the same message an instruction saying that the Pictures folder is at the root of the startup disk : tell application "Finder" to set startLoc to (folder "APOD ƒ" of folder "Pictures" of startup disk) as alias
and an other one saying that it is in your home folder.
set theFolder to "" & "~/Pictures/APOD ƒ/"
Yes, "~/" is in Unix format, the short version, unusable by the Finder or by AppleScript, of the path to your account, the one returned by path to home folder
With such a mess, it's logical that at least one of the two pieces of code fail. I guess that the folder Pictures:APOD ƒ is at the root of the startup volume or in your own user account but not in both.
Yvan KOENIG (VALLAURIS, France) lundi 10 novembre 2014 16:53:18
|