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

List of aliases contains alias


  • Subject: List of aliases contains alias
  • From: Jim Skibbie <email@hidden>
  • Date: Fri, 11 May 2012 02:33:01 +0000
  • Thread-topic: List of aliases contains alias

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



The issue is that when I compare the variable DroppedFiles which is a list of aliases to x which is a single alias to see whether x is contained in DroppedFiles, in 10.6, this resolves to true even when it isn't. Is this type of comparison no longer valid in OS X 10.6?

If I coerce DroppedFiles from a list of aliases to a string and do the same for x and then compare them, it seems to work:


if (DroppedFiles as string) does not contain (x as string) then


The other odd thing is that in Script Debugger, the condition resolves correctly, but if I save out the script as a droplet, the condition resolves first incorrectly (comparing aliases) and then correctly (comparing strings).

Any help in this behavior would be appreciated!

 _______________________________________________
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: Christopher Stone <email@hidden>
  • Prev by Date: Re: Online AppleScript application dictionary archive
  • Next by Date: Re: List of aliases contains alias
  • Previous by thread: Re: Online AppleScript application dictionary archive
  • Next by thread: Re: List of aliases contains alias
  • Index(es):
    • Date
    • Thread