• 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: System Events versus Finder
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: System Events versus Finder


  • Subject: Re: System Events versus Finder
  • From: KOENIG Yvan <email@hidden>
  • Date: Wed, 27 Feb 2008 14:55:47 +0100


Le 27 févr. 2008 à 14:40, Matt Neuburg a écrit :

On Wed, 27 Feb 2008 12:39:49 +0100, KOENIG Yvan <email@hidden> said:
Hello

I met what appears to be an odd behaviour.

If I have a variable named source containing a pathname (class alias)

tell application "Finder" to set dossier to (container of source) as
Unicode text
works well but
tell application "System Events" to set dossier to (container of
source) as Unicode text

doesn't.

Error message:

Impossible de transformer «class cfol» "Macintosh
HD:Users:yvankoenig:Desktop:" of application "System Events" en
Unicode text.

When you're talking to System Events, "container of source" returns a
reference to an object of type "folder". You are then asking System Events
to coerce this to a string. But System Events doesn't know how to perform
that coercion. To extract that pathname, use the folder object's "path" or
"POSIX path" property.


You may justly complain that an application's dictionary contains no
information as to what coercions it is willing to perform (p. 356 of my
book), but otherwise nothing surprising is going on here.


m.

Hello Matt

Glad to read you.

I bought your book some months ago.

I was not complaining but just asking if what I met was normal.
It appears that it is and that I am the culprit which didn't guess the difference of behaviour.


Now I know how I must code the instruction.

Perhaps you may explain if it is normal that

tell application "system events" to make new folder at <someFolder> with properties {name:"myNewFolder"} fails when it is described by:

make v : Make a new object.
make
new type class : The class of the new object.
[at location reference] : The location at which to insert the object.
[with data anything] : The initial data for the object.
[with properties record] : The initial values for properties of the object.
→ reference


in the dictionary.

Yvan KOENIG



_______________________________________________
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: System Events versus Finder
      • From: Matt Neuburg <email@hidden>
References: 
 >Re: System Events versus Finder (From: Matt Neuburg <email@hidden>)

  • Prev by Date: Re: System Events versus Finder
  • Next by Date: Re: What's wrong with this call to zip?
  • Previous by thread: Re: System Events versus Finder
  • Next by thread: Re: System Events versus Finder
  • Index(es):
    • Date
    • Thread