Re: problem with POSIX path of …
Re: problem with POSIX path of …
- Subject: Re: problem with POSIX path of …
- From: Yvan KOENIG <email@hidden>
- Date: Tue, 13 Sep 2016 22:23:14 +0200
> Le 13 sept. 2016 à 21:45, Axel Luttgens <email@hidden> a écrit :
>
>
>> Le 13 sept. 2016 à 16:33, Yvan KOENIG a écrit :
>>
>> […]
>>
>> 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
>>
>> […]
>
> Hello Yvan,
>
> At the basis, you are interested into something like this:
>
> set tempFolder to (path to documents folder) as text
> tell application "System Events"
> POSIX path of tempFolder
> end tell
>
> For System Events (SE), "POSIX path" is a property (with internal code 'posx') of a disk item.
> Unlike some other application, SE doesn’t try to auta-magically coerce arbitrary strings, in this case into disk items.
> As a result, nobody (neither SE nor AppleScript) knows what to do with that 'posx' property in the context of a string.
>
> You then consider:
>
> set tempFolder to (path to documents folder) as text
> tell application "System Events"
> tell me to POSIX path of tempFolder
> end tell
>
> With a "tell me" statement, one doesn’t change the terminology: SE’s dictionary is still in use, and one is still querying for that 'posx' property.
>
> So, let’s cheat by using the terminology of an application known not to have the slightest idea about a "POSIX path":
>
> set tempFolder to (path to documents folder) as text
> tell application "System Events"
> using terms from application "TextEdit"
> POSIX path of tempFolder
> end using terms from
> end tell
>
> and one now gets the same behavior as with that less convoluted one:
>
> set tempFolder to (path to documents folder) as text
> POSIX path of tempFolder
>
> (in both cases, the internal code for POSIX path is now 'psxp')
>
> HTH,
> Axel
Thanks Axel
This is a perfect answer : explanation and workaround in a single message.
You made the point.
Yvan KOENIG running El Capitan 10.11.6 in French (VALLAURIS, France) mardi 13 septembre 2016 22:23:09
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden