• 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: List of aliases contains alias
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: List of aliases contains alias


  • Subject: Re: List of aliases contains alias
  • From: KOENIG Yvan <email@hidden>
  • Date: Fri, 11 May 2012 14:59:59 +0200


on open DroppedFiles
-- the variable DroppedFiles is a list of bookmarks
--{«class bmrk» "SnowLeopard Drive:some file.pdf", «class bmrk» "SnowLeopard Drive:some other file.pdf"}
tell application "Finder" to set DroppedFiles to (the selection as alias list)
set x to "Macintosh HD:Users:yvankoenig:Desktop:green pisse.pages:"


try
DroppedFiles does not contain (x as alias)
display dialog "test #1 : " & result
set {oTids, AppleScript's text item delimiters} to {AppleScript's text item delimiters, return}
set Dropped_Files to DroppedFiles as text
set AppleScript's text item delimiters to oTids
DroppedFiles as text does not contain x
display dialog "test #2 : " & result
if DroppedFiles does not contain (x as alias) then
display dialog ("I should not get here." & return & return & "Files dropped: " & return & DroppedFiles & return & return & "File coerced to alias: " & return & x)
end if
end try
end open


With this code, the list of dropped files is not the one received by the droplet, it's the list of selected items which contain the same items but in an other format.
This time both tests behave flawlessly.

I don't know which is wrong.
Is it the system whith pass the wrong kind of items
or the AppleScript's User Guide which describes wrongly what is passed to on open handlers.

In the late guide we may read :

open Handlers

Mac OS X applications, including script applications, receive an open command whenever the user drops file, folder, or disk icons on the application’s Finder icon, even if the application is already running.

If the script in a script application includes an open handler, the handler is executed when the application receives the open command. The open handler takes a single parameter which provides a list of all the items to be opened. Each item in the list is analias (page 79) object. [ the typo (missing space) is in the Guide]


Yvan KOENIG (VALLAURIS, France) vendredi 11 mai 2012 14:59:37


 _______________________________________________
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: List of aliases contains alias
      • From: Shane Stanley <email@hidden>
References: 
 >Fwd: List of aliases contains alias (From: KOENIG Yvan <email@hidden>)

  • Prev by Date: Re: List of aliases contains alias
  • Next by Date: Re: List of aliases contains alias
  • Previous by thread: Re: List of aliases contains alias
  • Next by thread: Re: List of aliases contains alias
  • Index(es):
    • Date
    • Thread