Hi folks. A colleague asked about doing a demo of Expose for his User group and wanted to know how to launch a bunch of apps like Steve Jobs did at the demo.
I wanted to start with a list of app names and code from there. This code, however, launches the named app when it executes the “path to application” expression (!).
Here is my trivial test code:
set theList to {"iPhoto", "iTunes"} -- make a list
repeat with theName in theList --loop
set thePath to path to application theName -- get the path
end repeat
Can somebody verify if this is launching iTunes and iPhoto on their system, and if so, why?
If you’re asking whether iTunes and iPhoto receive the “launch” in your first post, yes, in a sense, but it’s kind of an indirect way of doing it. The “path to application” is meant to be used with an application that is already running, so in order for AppleScript to execute that command, it first has to launch iPhoto and iTunes and tell them the “path to current application” command, which returns an alias to their location on your disk.
For example, I set the list to just iTunes, and I got the following in the “Event Log”:
tell application “iTunes”
path to current application
alias “Mac HD_OSX Panther:Applications:iTunes.app:”
end tell