On 9 Dec 2015, at 20:46, Yvan KOENIG < email@hidden> wrote:
As far as I remember, the initial syntax behaved well in recent past. Is it a new behavior introduced by 10.11.2 ?
No, not new. I just ran your script on 10.9.5 and it produces the same -1728 error on Mavericks.
Script Editor highlights “quoted form” in the script text as the source of the error.
Best
Phil
Thanks Phil
What is puzzling is the fact that even when I use tell me to, the instruction which works in the handler fails.
set theName to "trucmuche" --set sourcefolder to (path to desktop as text) & "formoosmahna:" as alias set sourcefolder to choose folder tell application "System Events" if not (exists folder theName of sourcefolder) then make new folder at end of sourcefolder with properties {name:theName} end if -- set dest to my quoteIt((sourcefolder as text) & theName) --> "'/Users/ME/Desktop/formoosmahna/trucmuche'"
tell me # So I'm no longer speaking to System Events
--set dest to ((sourcefolder as text) & theName) --> SSD 500:Users:ME:Desktop:formoosmahna:trucmuche # Now, the string exists, do EXACTLY what is done in my handler ! --set dest to quoted form of POSIX path of dest --> error "Il est impossible d’obtenir POSIX path of \"SSD 500:Users:ME:Desktop:formoosmahna:trucmuche\"." number -1728 from «class posx» of "SSD 500:Users:ME:Desktop:formoosmahna:trucmuche"
set dest to ((sourcefolder as text) & theName) --> SSD 500:Users:ME:Desktop:formoosmahna:trucmuche # Split the instruction to identify the wrong doer. set dest to POSIX path of dest --> error "Il est impossible d’obtenir POSIX path of \"SSD 500:Users:yvankoenig:Desktop:formoosmahna:trucmuche\"." number -1728 from «class posx» of "SSD 500:Users:yvankoenig:Desktop:formoosmahna:trucmuche"
set dest to quoted form of dest end tell end tell
on quoteIt(aPath) # Here aPath is a string return quoted form of POSIX path of aPath end quoteIt
When I use a single instruction, it’s quoted form which is highlighted but it’s POSIX path which fails and as you may see, the error message make no reference to System Events.
Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) mercredi 9 décembre 2015 17:00:43
|