Applescript workspaces

by Giles Turnbull



Not long after I posted about how OS X users might employ Automator to manage separate location-based workspaces, Mac Devcenter reader Mark Hunte got in touch with a more refined and elegant solution to the problem.



Here's how Mark suggests doing things, again in Automator but with a twist of Applescript:





From the "Finder actions"

1. Get Specified Finder Items. (Select the "work" folder)

and then:

(Select the "road" folder)

Pay attention to the order, its important later. (Work first, Road second)


From the "Automator actions"

2. Run Applescript


on run {input, parameters}


display dialog "Where are You Today?" buttons {"Work", "Road", "Cancel"} default button 3
(*The order is the same as above - Work first Road second *)
set the button_pressed to the button returned of the result
if the button_pressed is "Work" then
set input to item 1 of input
else if the button_pressed is "Road" then (*again The order is the same as above - Work first Road second *)
set input to item 2 of input
else


end if


return input
end run



From the "Finder actions"

3. Open Finder Items (open with: Default Applications.) Save as application. and put in Login items.