Page 1 of 1

Instantly hide LaunchBar window when running slow script.

Posted: Tue Dec 09, 2008 5:24 am
by drylight
I have an AppleScript which I run from LaunchBar. Works great. But the script takes about 5 - 10 seconds to complete, in which time the LaunchBar bar window stays on the screen. Is it possible to instantly hide Launchbar as soon as I hit enter to run the AppleScript?

It's kind of distracting just staying there when I've already run the task, sent it on its way and don't care about it - wanting to move on to something else.

Posted: Tue Dec 09, 2008 9:46 am
by ludwigschubert
You can add a line to the beginning of your script that hides LaunchBar:
open location "x-launchbar:hide"

Posted: Tue Dec 09, 2008 10:06 am
by drylight
Excellent! Thank you @ludwigschubert. I did try and do a search but could not come up with the right answer.

Appreciate your help.

Posted: Tue Dec 09, 2008 8:42 pm
by sjk
I see that's documented on the URL Commands page of LB Help, but x-launchbar:pref-pane isn't (anywhere I've looked). Is there a full list of URL commands somewhere? Thanks!

Posted: Tue Dec 09, 2008 10:10 pm
by Dennis
As an alternative to URL commands, LaunchBar itself is now scriptable. So you could use this line to hide LaunchBar as well:

Code: Select all

tell application "LaunchBar" to hide

In this particular case, it probably doesn't really matter which approach you take. But in other cases, it's probably better to use the new AppleScript support in LaunchBar.

Here's an example:

To print text in large type using the URL approach, you'd have to escape characters that are reserved in URLs. So to print a document path like this:


You'd have to actually use this:

Code: Select all

open location "x-launchbar:large-type?string=~%2FDocuments%2FMiscellaneous%2Ftest.txt"

But with AppleScript, you could just do this without having to do any URL encoding:

Code: Select all

tell application "LaunchBar" to display in large type "~/Documents/Miscellaneous/test.txt"


Posted: Wed Dec 10, 2008 11:53 am
by ludwigschubert
Yay! Dennis, you mean we don't have to control LaunchBar via URLs anymore? Cool! Although… I kind of liked the geekyness of controlling an app via URLs, so… :D

PS: So Applescript support and URL support… somebody else thinks it's time to enable LaunchBar to import those "Search Templates" with a single click on a website? Technically it's possible… anyone else to submit an official feature request to Objective Development?