• 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: Colonic irrigation (OS X)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Colonic irrigation (OS X)


  • Subject: Re: Colonic irrigation (OS X)
  • From: Christopher Nebel <email@hidden>
  • Date: Wed, 11 Feb 2004 17:05:53 -0800

On Feb 11, 2004, at 3:05 PM, Mr Tea wrote:

Either I'm confused about colons, or AppleScript is, or we both are....

tell application "Finder"
activate
open item ((path to desktop folder as string) & "F1:F2:")
end tell

That's straightforward enough. If there's a folder on my desktop called 'F1', containing a folder called 'F2', the above script will open it. However, if I replace the folder 'F2' with a file of the same name, the script will open that instead, without a whisper of complaint.

Similarly, if I leave the final colon off the file/folder path, AS will indiscriminately open F2 regardless of whether it's a file or a folder.

The magic formula for making AS 'colon-blind' seems to lie in the outer set of brackets in the 'open' line. When these are removed, the expected error messages are generated if the presence or absence of a final colon is inappropriate.

Bug or feature?

I don't think you read that error closely enough. If you leave off the outer parentheses, you change the ordering of the expression to open (item (path to desktop folder as string)) & ("F1:F2:"). In other words, AppleScript evaluates 'item "path:to:Desktop"', comes back with a Finder object specifier, tries to concatenate that with a string, and boggles. Adding or removing colons at this point won't help.


--Chris Nebel
AppleScript Engineering
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Colonic irrigation (OS X) (From: Mr Tea <email@hidden>)

  • Prev by Date: Re: Colonic irrigation (OS X)
  • Next by Date: Re: Efficient searching of Address Book
  • Previous by thread: Re: Colonic irrigation (OS X)
  • Next by thread: Re: Colonic irrigation (OS X)
  • Index(es):
    • Date
    • Thread