Re: scripting the launcher
Re: scripting the launcher
- Subject: Re: scripting the launcher
- From: Mr Tea <email@hidden>
- Date: Thu, 14 Dec 2000 23:19:27 +0000
This from Matt Binkowski - dateline 13/12/00 9.55 pm:
>
i was wondering if anyone has ever tried to applescript the launcher
Well, yes actually. I wanted to have interchangeable sets of Launcher items,
and about a year ago I knocked up a script to automate this.
Actually most of the action takes place in the Finder, shuffling stuff
between the Launcher Items folder and a 'Launcher Items (Disabled)' folder I
created for the purpose.
The only scripting of the Launcher that actually takes place is hiding it
(if running) at the start of the script, and activating it at the end. That
being said, the script works well and adds to the functionality of the
Launcher. Your question gives me an excuse to air the script on this list
and see if it can be improved. As it stands, it represents a little
scripting knowledge mixed with a lot of trial and error and a dab of lateral
thinking.
The script requires the presence in your system folder of a 'Launcher Items
(Disabled)' folder, which should contain three sub-folders to hold your
alternative launcher items sets. At start of play, two of the folders should
contain launcher sets, with the third empty - ready to receive the currently
active set. Label index of the empty folder should be set to 1.
Here's the script, and, as ever, watch those line breaks.
tell application "Finder"
activate
copy (((path to system folder) as text) & "Launcher Items (Disabled):")
as alias to LID
copy (path to the launcher items folder) as alias to LI
if exists (process "Launcher") then set visible of process "Launcher" to
false
set choiceOne to item 1 of (every item of LID whose label index is 0) as
alias
set choiceTwo to item 2 of (every item of LID whose label index is 0) as
alias
set HoldingBay to item 1 of (every item of LID whose label index is 1)
as alias
display dialog "Choose a Launcher set:" buttons {name of choiceOne, name
of choiceTwo, "Don't bother"}
if the button returned of the result is name of choiceOne then
move every item of LI to HoldingBay
set label index of HoldingBay to 0
move every item of (choiceOne) to LI
set label index of choiceOne to 1
else if the button returned of the result is name of choiceTwo then
move every item of LI to HoldingBay
set label index of HoldingBay to 0
move every item of (choiceTwo) to LI
set label index of choiceTwo to 1
end if
open file "Launcher" of the control panels folder
end tell
Mr Tea
--
"Let the pot stand for at least five minutes before serving."