Instantly hide LaunchBar window when running slow script.

General discussions about LaunchBar
Post Reply
drylight
Rank 1
Rank 1
Posts: 21
Joined: Tue Dec 09, 2008 5:20 am

Instantly hide LaunchBar window when running slow script.

Post by drylight » Tue Dec 09, 2008 5:24 am

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.

ludwigschubert
Rank 4
Rank 4
Posts: 285
Joined: Fri Jun 29, 2007 5:54 pm
Location: Germany, Bavaria

Post by ludwigschubert » Tue Dec 09, 2008 9:46 am

You can add a line to the beginning of your script that hides LaunchBar:
open location "x-launchbar:hide"

drylight
Rank 1
Rank 1
Posts: 21
Joined: Tue Dec 09, 2008 5:20 am

Post by drylight » Tue Dec 09, 2008 10:06 am

Excellent! Thank you @ludwigschubert. I did try and do a search but could not come up with the right answer.

Appreciate your help.

sjk
Wizard
Wizard
Posts: 315
Joined: Thu Sep 13, 2007 9:46 pm
Location: Eugene
Contact:

Post by sjk » Tue Dec 09, 2008 8:42 pm

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!

Dennis
Rank 3
Rank 3
Posts: 146
Joined: Mon Dec 10, 2007 7:47 pm
Location: California

Post by Dennis » Tue Dec 09, 2008 10:10 pm

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:

~/Documents/Miscellaneous/test.txt

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"



-Dennis

ludwigschubert
Rank 4
Rank 4
Posts: 285
Joined: Fri Jun 29, 2007 5:54 pm
Location: Germany, Bavaria

Post by ludwigschubert » Wed Dec 10, 2008 11:53 am

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?

Post Reply