• 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: Coercion question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Coercion question


  • Subject: Re: Coercion question
  • From: Jan Pieter Kunst <email@hidden>
  • Date: Fri, 15 Jun 2001 17:49:32 +0200

Michelle Steiner (email@hidden) schreef op 15-06-2001 16:05 :

>> Hello all,
>>
>> Is it possible to coerce this:
>>
>> alias "Disk:Folder:File"
>>
>> to this:
>>
>> {file "File" of folder "Folder" of startup disk}
>
> tell application "Finder"
> set foo to the selection as alias list
> set bar to file (item 1 of foo)
>
> -->folder "PhotoDeluxe 2.0" of folder "Graphics" of startup disk of
> application "Finder"
>
> class of bar
>
> --> folder
>
> end tell


Thanks, I made something based on this (the variable x is always a single
alias):


tell application "Finder"

if class of file x is folder then

-- do folder stuff
else

-- do document stuff
end if

end tell


This seems more elegant to me than the other solution involving checking for
the last character of the alias as string being a colon or not. I haven't
checked which one is faster though.

JP


References: 
 >Re: Coercion question (From: Michelle Steiner <email@hidden>)

  • Prev by Date: trapping an apple event
  • Next by Date: Re: Total Newbie question
  • Previous by thread: Re: Coercion question
  • Next by thread: Re: Coercion question
  • Index(es):
    • Date
    • Thread