• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: problem with POSIX path of …
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problem with POSIX path of …


  • Subject: Re: problem with POSIX path of …
  • From: Axel Luttgens <email@hidden>
  • Date: Tue, 13 Sep 2016 21:45:11 +0200

> 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


 _______________________________________________
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


  • Follow-Ups:
    • Re: problem with POSIX path of …
      • From: Yvan KOENIG <email@hidden>
    • Re: problem with POSIX path of …
      • From: Yvan KOENIG <email@hidden>
References: 
 >problem with POSIX path of … (From: Yvan KOENIG <email@hidden>)

  • Prev by Date: Re: problem with POSIX path of …
  • Next by Date: Fwd: problem with POSIX path of …
  • Previous by thread: Re: problem with POSIX path of …
  • Next by thread: Re: problem with POSIX path of …
  • Index(es):
    • Date
    • Thread