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

Fwd: List of aliases contains alias


  • Subject: Fwd: List of aliases contains alias
  • From: KOENIG Yvan <email@hidden>
  • Date: Fri, 11 May 2012 09:01:31 +0200



Début du message réexpédié :

De : KOENIG Yvan <email@hidden>
Objet : Rép : List of aliases contains alias
Date : 11 mai 2012 08:19:38 HAEC
À : Jim Skibbie <email@hidden>
Mime-Version: 1.0 (Apple Message framework v1278)
Content-Type: multipart/alternative; boundary="Apple-Mail=_0E0868C0-A30F-4002-845F-BDEA32E48C89"
X-Smtp-Server: smtp.sfr.fr
X-Universally-Unique-Identifier: c255209d-e944-44ec-9cf5-86a89aa308ed
In-Reply-To: <email@hidden">email@hidden>
References: <email@hidden">email@hidden>
Message-Id: <email@hidden>


Le 11 mai 2012 à 04:33, Jim Skibbie a écrit :

I have a script that has been working without issue under OS X 10.4 and 10.5. Recently, some users have upgraded to OS X 10.6.8, and now the script does not work.

Basically, the script tries to see if a file is already in the DroppedFiles list of aliases, and if it isn't, it adds it, but under OS X 10.6.8, it fails the condition and adds an alias to the DroppedFiles list even though it already exists in DroppedFiles.

Here's an example:

on open DroppedFiles
-- the variable DroppedFiles is a list of aliases
--{alias "SnowLeopard Drive:some file.pdf", alias "SnowLeopard Drive:some other file.pdf"}
set x to "SnowLeopard Drive:some file.pdf"
try
set x to x as alias
display dialog ((DroppedFiles does not contain x) as string)
display dialog (((DroppedFiles as string) does not contain (x as string)) as string)
if DroppedFiles does not contain x then
display dialog ("I should not get here." & return & return & "Files dropped: " & return & DroppedFiles as string) & return & return & "File coerced to alias: " & return & (x as string)
end if
end try
end open

I am unable to test under 10.6.8 so I tested under 10.7.4 (Apple Script Editor).
I added some instructions to check the class of passed items.

I got :

on open DroppedFiles
-- the variable DroppedFiles is a list of aliases
--{alias "SnowLeopard Drive:some file.pdf", alias "SnowLeopard Drive:some other file.pdf"}
set x to "Macintosh HD:Users:yvankoenig:Desktop:green pisse.pages:"
display dialog "" & class of item 1 of DroppedFiles
-- > «class bmrk »
tell application "Finder"
set DroppedFiles to DroppedFiles as alias list
end tell

display dialog "" & class of item 1 of DroppedFiles
-- > «class bmrk »
try
set x to x as alias
display dialog "" & class of x
--> alias
display dialog ((DroppedFiles does not contain x) as string)
display dialog (((DroppedFiles as string) does not contain (x as string)) as string)
if DroppedFiles does not contain x then
display dialog ("I should not get here." & return & return & "Files dropped: " & return & DroppedFiles as string) & return & return & "File coerced to alias: " & return & (x as string)
end if
end try
end open


So, it's normal that your comparison fail.

DroppedFiles is not seen as a list of aliases but a list of «class bmrk» objects.
What is really puzzling is the fact that they remain of this kind after coercing the list « as alias list »

Yvan KOENIG (VALLAURIS, France) vendredi 11 mai 2012 08:19:27



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