• 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: Matt Neuburg <email@hidden>
  • Date: Wed, 27 Feb 2008 05:40:58 -0800
  • Thread-topic: System Events versus Finder

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.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: <http://tinyurl.com/2rh4pf>
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>



 _______________________________________________
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: KOENIG Yvan <email@hidden>
  • Prev by Date: Re: What's wrong with this call to zip?
  • Next by Date: Re: System Events versus Finder
  • Previous by thread: Re: System Events versus Finder
  • Next by thread: Re: System Events versus Finder
  • Index(es):
    • Date
    • Thread