To be honest too, here is a script with the several attempts I made.
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'"
--set dest to quoted form of POSIX path of ((sourcefolder as text) & theName) --> 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 quoted form of POSIX path of file ((sourcefolder as text) & theName) --> error "Erreur dans System Events : Impossible de convertir quoted form of POSIX path of file \"SSD 500:Users:ME:Desktop:formoosmahna:trucmuche\" en type specifier." number -1700 from quoted form of POSIX path of file "SSD 500:Users:ME:Desktop:formoosmahna:trucmuche" to specifier
--set dest to quoted form of POSIX path of item ((sourcefolder as text) & theName) --> error "Erreur dans System Events : Impossible de convertir quoted form of POSIX path of item \"SSD 500:Users:ME:Desktop:formoosmahna:trucmuche\" en type specifier." number -1700 from quoted form of POSIX path of item "SSD 500:Users:ME:Desktop:formoosmahna:trucmuche" to specifier
-- set dest to quoted form of POSIX path of alias ((sourcefolder as text) & theName) --> error "Erreur dans System Events : Impossible de convertir quoted form of POSIX path of alias \"SSD 500:Users:ME:Desktop:formoosmahna:trucmuche\" en type specifier." number -1700 from quoted form of POSIX path of alias "SSD 500:Users:ME:Desktop:formoosmahna:trucmuche" to specifier
--set dest to quoted form of POSIX path of (((sourcefolder as text) & theName) as «class furl»)--> error "Erreur dans System Events : Impossible de convertir POSIX path of file \"SSD 500:Users:ME:Desktop:formoosmahna:trucmuche\" en type specifier." number -1700 from POSIX path of file "SSD 500:Users:ME:Desktop:formoosmahna:trucmuche" to specifier
--set dest to (((sourcefolder as text) & theName) as «class furl») --> file SSD 500:Users:ME:Desktop:formoosmahna:trucmuche
--set dest to quoted form of POSIX path of dest --> error "Erreur dans System Events : Impossible de convertir POSIX path of file \"SSD 500:Users:ME:Desktop:formoosmahna:trucmuche\" en type specifier." number -1700 from POSIX path of file "SSD 500:Users:ME:Desktop:formoosmahna:trucmuche" to specifier
tell me # So I'm no longer speaking to System Events
--set dest to quoted form of POSIX path of ((sourcefolder as text) & theName) --> 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
# 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 quoted form of POSIX path of file ((sourcefolder as text) & theName) --> error "Il est impossible d’obtenir file \"SSD 500:Users:ME:Desktop:formoosmahna:trucmuche\"." number -1728 from file "SSD 500:Users:ME:Desktop:formoosmahna:trucmuche"
--set dest to quoted form of POSIX path of item ((sourcefolder as text) & theName) --> error "Il est impossible d’obtenir item \"SSD 500:Users:ME:Desktop:formoosmahna:trucmuche\"." number -1728 from item "SSD 500:Users:ME:Desktop:formoosmahna:trucmuche"
--set dest to quoted form of POSIX path of alias ((sourcefolder as text) & theName) --> error "Il est impossible d’obtenir POSIX path of alias \"SSD 500:Users:ME:Desktop:formoosmahna:trucmuche:\"." number -1728 from «class posx» of alias "SSD 500:Users:ME:Desktop:formoosmahna:trucmuche:"
-- set dest to quoted form of POSIX path of (((sourcefolder as text) & theName) as «class furl») --> error "Il est impossible d’obtenir POSIX path of file \"SSD 500:Users:ME:Desktop:formoosmahna:trucmuche\"." number -1728 from «class posx» of file "SSD 500:Users:ME:Desktop:formoosmahna:trucmuche"
--set dest to (((sourcefolder as text) & theName) as «class furl») --> file SSD 500:Users:ME:Desktop:formoosmahna:trucmuche
--set dest to quoted form of POSIX path of dest --> error "Il est impossible d’obtenir POSIX path of file \"SSD 500:Users:ME:Desktop:formoosmahna:trucmuche\"." number -1728 from «class posx» of file "SSD 500:Users:ME:Desktop:formoosmahna:trucmuche"
end tell
end tell
on quoteIt(aPath) # Here aPath is a string
return quoted form of POSIX path of aPath
end quoteIt
System Events refuse every attempts to get POSIX path of something.
For my point of view it’s not too surprising and it’s why I used tell me to.
Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) mercredi 9 décembre 2015 16:51:47