Hello
Here is a subset of a large script I'm working upon.
script o property tempFolder : "" -- globale end script
on run set p2d to path to desktop set folderName to "transfert_trefsnart" set o's tempFolder to (path to desktop as text) & folderName & ":" tell application "System Events" if not (exists folder (o's tempFolder)) then make new folder at end of p2d with properties {name:folderName} end if end tell my germaine() end run
on germaine()
POSIX path of (o's tempFolder) --> "/Users/yvankoenig/Desktop/transfert_trefsnart/"
tell application "TextEdit" try log "Point 1" POSIX path of (o's tempFolder) on error errMsg number errNbr log "error #" & errNbr & ", " & errMsg log "Point 2" end try try log "Point 3" tell me to get (POSIX path of (o's tempFolder)) on error errMsg number errNbr log "error #" & errNbr & ", " & errMsg log "Point 4" end try end tell
tell application "System Events" try log "Point 5" POSIX path of (o's tempFolder) on error errMsg number errNbr log "As I am in a tell application block I'm not really surprised to get :" & linefeed & "error #" & errNbr & ", " & errMsg log "Point 6" end try try log "Point 7" tell me to get (POSIX path of (o's tempFolder)) on error errMsg number errNbr log "But here, as I use the « tell me » tip, I'm REALLY bored to get :" & linefeed & "error #" & errNbr & ", " & errMsg log "point 8" end try end tell end germaine
#=====
I don't understand why the good old « tell me » tip doesn't allow POSIX path to behave correctly in a tell application "System Events" block
Here I get this events log :
tell current application path to desktop path to desktop as text end tell tell application "System Events" exists folder "SSD 500:Users:yvankoenig:Desktop:transfert_trefsnart:" end tell tell application "TextEdit" (*Point 1*) (*Point 3*) end tell tell application "System Events" (*Point 5*) (*As I am in a tell application block I'm not really surprised to get : error #-1728, Il est impossible d’obtenir POSIX path of "SSD 500:Users:yvankoenig:Desktop:transfert_trefsnart:".*) (*Point 6*) (*Point 7*) (*But here, as I use the « tell me » tip, I'm REALLY bored to get : error #-1728, Il est impossible d’obtenir POSIX path of "SSD 500:Users:yvankoenig:Desktop:transfert_trefsnart:".*) (*point 8*) end tell
Of course, I may store the POSIX string in a variable before entering the tell application block but I wish to understand why it behabes this way ?
Yvan KOENIG running El Capitan 10.11.6 in French (VALLAURIS, France) mardi 13 septembre 2016 16:33:39
|