Page 1 of 1

How to chain Launchbar actions

Posted: Wed Jul 09, 2014 3:44 pm
by danielgm
I am looking to put existing launchbar actions and custom actions in a chain that can be executed with a single trigger.

Specifically, I want to:

- quit specific programs
- turn off bluetooth
- switch network location to a specific location

How can this be done?

Re: How to chain Launchbar actions

Posted: Wed Jul 09, 2014 5:16 pm
by iRounak
LB supports use of "perform action" in applescript

Re: How to chain Launchbar actions

Posted: Thu Jul 10, 2014 1:06 am
by danielgm
thanks, that worked for bluetooth.

Network locations are not an action in Launchbar and apparently not scriptable...

Quitting an app is an action but somehow passing an argument does not work.

Code: Select all

perform action "Quit Application" with string "Mail"


Any ideas?

Re: How to chain Launchbar actions

Posted: Thu Jul 10, 2014 3:22 am
by iRounak
You can use

Code: Select all

tell application "System Events" to quit application "Mail"


For network, try:

Code: Select all

tell application "System Events"
   tell network preferences
      --set allLocations to the name of every location
      
      --set activeLocation to the name of current location
   end tell
end tell

Re: How to chain Launchbar actions

Posted: Thu Jul 10, 2014 11:01 am
by danielgm
Nice, quitting applications via System events works!

The network location script looks good but what is the action name to actually change locations?

I tried activate and connect but they don't work.

Re: How to chain Launchbar actions

Posted: Thu Jul 10, 2014 11:50 am
by danielgm
I got it to work using a shell script

Code: Select all

do shell script "scselect '" & ("Automatic") & "'"

Re: How to chain Launchbar actions

Posted: Thu Jul 10, 2014 1:11 pm
by ptujec
danielgm wrote:Nice, quitting applications via System events works!


Code: Select all

quit application "Mail"

… works too. Less typing ;)

Re: How to chain Launchbar actions

Posted: Sun Jul 13, 2014 7:59 pm
by danielgm
even better, thanks!