Some favorite site feeds aggregated locally: iPhone Development RSS   Adobe Labs RSS   Macrumors RSS

Wednesday, January 28, 2009

AppleScript to launch the IDE and open some files on boot

Wednesday, January 28, 2009    0 Comments

My morning routines revolve around some degree of automation. When I boot my Mac, I have things that kick off via Startup Items (look in your System Preferences > Accounts: Login Items. I have an AppleScript that launches and connects me to several servers around the company (I use them all the time, why bother connecting by hand?) This alone saves me some time.

Now, I also am working most of the time on a certain project & am I using the Flash CS4 IDE at the moment. It's a combination of several FLAs and also some classes. If I were able to use FlashDevelop on the Mac, I wouldn't need to worry... same goes with Flex for either since we're talking projects at that point. I do have several of those going, but they aren't currently active.

Anyway, I wanted to add to my script the auto-launch of Flash CS4 and to open up several FLAs and files from a server I like to use to keep my work files on.

Below is pseudo code (beautified for JavaScript since I don't have AppleScript as an option yet) - I just removed the real paths. But I've been using this for a little while now and it's nice.
-- you can access local stuff with DriveName:
-- you can access remote stuff using Volumes:
set flpath1 to POSIX path of "Volumes:userName:Directory:FolderOne:Folder Two :file.fla"
set flpath2 to POSIX path of "Volumes:userName:Directory:FolderOne:Folder Two :file2.fla"
set flpath3 to POSIX path of "Volumes:userName:Directory:FolderOne::file3.fla"

tell application "Adobe Flash CS4"
activate
try
set command to "open " & quoted form of flpath1
do shell script command
set command2 to "open " & quoted form of flpath2
do shell script command2
set command3 to "open " & quoted form of flpath3
do shell script command3
end try
end tell
Paste this stuff into ScriptEditor, edit to your liking, and save it off someplace. Link it up in Startup Items & you'll enjoy boots into your work (using the IDE) a little better.

Labels: , ,