Le 2015/12/09 à 18:19, Axel Luttgens < email@hidden> a écrit :
Le 9 déc. 2015 à 16:51, Yvan KOENIG a écrit :
[…] To be honest too, here is a script with the several attempts I made. […] 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. What is puzzling is the fact that even when I use tell me to, set dest to quoted form of Posix path of aString — which is a correctly formed path - fails too
Hello again, Yvan. I’m still on 10.10.5 here, but could you try this one:
I ran you examples. (1) tell application "System Events" -- Let's be sure to have a SE item. set F to file "Sans titre.pages" of desktop folder -- Let's ask SE to get that item's POSIX path (works fine, here) set P to POSIX path of F --> error "Erreur dans System Events : Il est impossible d’obtenir file \"Sans titre.pages\" of desktop folder." number -1728 from file "Sans titre.pages" of desktop folder
-- Let's ask SE to get the POSIX path of the resulting string. -- Fails as expected here. -- Note the «class posx» in the error message. POSIX path of P # trying to get the POSIX path of a POSIX path is not a good idea ! end tell
(2) I’m not surprised to see that it fails to define F tell application "System Events" -- Let's be sure to have a SE item. set F to file "Sans titre.pages" of desktop folder
-- Let's ask SE to get that item's POSIX path (works fine, here) set P to POSIX path of F tell me -- Let's ask "me" to get the POSIX path of the resulting string. -- Fails too (as expected); note the «class posx» in the error message. POSIX path of P # trying to get the POSIX path of a POSIX path is not a good idea ! --> error "Il est impossible d’obtenir POSIX path of \"/Users/yvankoenig/Desktop/Sans titre.pages\"." number -1728 from «class posx» of "/Users/yvankoenig/Desktop/Sans titre.pages" end tell end tell
(2bis) tell application "System Events" -- Let's be sure to have a SE item. set F to file "Sans titre.pages" of desktop folder
-- Let's ask SE to get that item's POSIX path (works fine, here)
tell me POSIX path of F end tell end tell
Making these tests I understand what was a part of the problem. At first time, the item Sans titre.pages wasn’t available on my Desktop. and I got an error with set F to file "Sans titre.pages" of desktop folder
So, I created the file and after that, the instruction worked well.
Yvan KOENIG running El Capitan 10.11.2 in French (VALLAURIS, France) mercredi 9 décembre 2015 18:49:46
|