Make launchbar go to volumes

Sharing and discussing custom actions for LaunchBar
Post Reply
aristidesfl
Rank 3
Rank 3
Posts: 120
Joined: Sat Feb 27, 2010 12:54 am

Make launchbar go to volumes

Post by aristidesfl » Thu May 12, 2011 9:05 pm

I'm writing an applescript to mount a specific volume using a shell script.

I would like lauchbar to go to Volumes smart folder after the shell script is done.
How can I do this?

BTW, is there anyway to make this specific applescript run in the background always? Without having to press Option every time I launch it?


Thanks

manfred
Objective Development
Objective Development
Posts: 561
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna
Contact:

Re: Make launchbar go to volumes

Post by manfred » Thu May 26, 2011 3:57 pm

I would like lauchbar to go to Volumes smart folder after the shell script is done.
How can I do this?


Something like this?

Code: Select all

tell application "LaunchBar"
   set selection to "/Volumes"
end tell


BTW, is there anyway to make this specific applescript run in the background always? Without having to press Option every time I launch it?

AppleScripts placed in ~/Library/Application Support/LaunchBar/Actions are running in background per default.

aristidesfl
Rank 3
Rank 3
Posts: 120
Joined: Sat Feb 27, 2010 12:54 am

Re: Make launchbar go to volumes

Post by aristidesfl » Thu May 26, 2011 11:05 pm

Something like this?
CODE: SELECT ALL
tell application "LaunchBar"
set selection to "/Volumes"
end tell

This selects /Volumes.. any way of showing its contents instead? Or perhaps show the contents of the smart folder called Volumes?


AppleScripts placed in ~/Library/Application Support/LaunchBar/Actions are running in background per default.

Not here.. running an action that takes a while, causes launchbar to hang (just like when you copy big files).
Using Option, launchbar goes away while the script executes.

manfred
Objective Development
Objective Development
Posts: 561
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna
Contact:

Re: Make launchbar go to volumes

Post by manfred » Fri May 27, 2011 11:55 am

aristidesfl wrote:This selects /Volumes.. any way of showing its contents instead? Or perhaps show the contents of the smart folder called Volumes?

Currently only via launchbar url – a hidden functionality wohoo ;)
Using AppleScript it might look like this:

Code: Select all

open location "x-launchbar:browse?path=/Volumes"

Whether you want to search this selection or not, it is possible to append »&subsearch«


Not here.. running an action that takes a while, causes launchbar to hang (just like when you copy big files).
Using Option, launchbar goes away while the script executes.

Ups, my bad. It works with shell scripts but not with Apple Scripts.

aristidesfl
Rank 3
Rank 3
Posts: 120
Joined: Sat Feb 27, 2010 12:54 am

Re: Make launchbar go to volumes

Post by aristidesfl » Fri May 27, 2011 3:10 pm

open location "x-launchbar:browse?path=/Volumes"


This produces the same effect... it doesn't show the content of Volumes

manfred
Objective Development
Objective Development
Posts: 561
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna
Contact:

Re: Make launchbar go to volumes

Post by manfred » Fri May 27, 2011 3:26 pm

What version of LaunchBar do you use? This feature is available in LaunchBar 5.1

aristidesfl
Rank 3
Rank 3
Posts: 120
Joined: Sat Feb 27, 2010 12:54 am

Re: Make launchbar go to volumes

Post by aristidesfl » Fri May 27, 2011 4:31 pm

Version 5.1 beta 2 (705)

The feature is working.. but the result is not the intended.
I want to see a list of mounted volumes. That shows me a folder called volumes, not the contents..

manfred
Objective Development
Objective Development
Posts: 561
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna
Contact:

Re: Make launchbar go to volumes

Post by manfred » Fri May 27, 2011 4:41 pm

This is what LaunchBar looks like if I run the AppleScript:
screen.png
screen.png (18.66 KiB) Viewed 8112 times

It shows a list of all devices mounted to /Volumes. Isn't it the same on your computer?

aristidesfl
Rank 3
Rank 3
Posts: 120
Joined: Sat Feb 27, 2010 12:54 am

Re: Make launchbar go to volumes

Post by aristidesfl » Fri May 27, 2011 4:57 pm

This what happens here:
Screen shot 2011-05-27 at 3.55.32 PM.png
Screen shot 2011-05-27 at 3.55.32 PM.png (11.66 KiB) Viewed 8098 times

manfred
Objective Development
Objective Development
Posts: 561
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna
Contact:

Re: Make launchbar go to volumes

Post by manfred » Mon Jun 06, 2011 6:09 pm

Are there any mounted directories in /Volumes? If a directory is empty, LaunchBar can't browse it's content.

aristidesfl
Rank 3
Rank 3
Posts: 120
Joined: Sat Feb 27, 2010 12:54 am

Re: Make launchbar go to volumes

Post by aristidesfl » Mon Jun 06, 2011 6:29 pm

Yes, there are, and it's browsable manually

keitofu
Posts: 18
Joined: Tue Dec 01, 2009 10:03 am

Re: Make launchbar go to volumes

Post by keitofu » Wed Jun 08, 2011 11:08 am

I've tried the code provided by manfred and it works well here (Launchbar version 5.0.4 (682)).
Hey, I'm not up to date !! Well I'll download the last version right away :)


edit : still works after the update

aristidesfl
Rank 3
Rank 3
Posts: 120
Joined: Sat Feb 27, 2010 12:54 am

Re: Make launchbar go to volumes

Post by aristidesfl » Wed Jun 08, 2011 12:39 pm

Proof of my stupidity:
Screen shot 2011-06-08 at 11.38.16 AM.png
Screen shot 2011-06-08 at 11.38.16 AM.png (25.24 KiB) Viewed 8034 times


It was in the end of the script overriding the open location command

Thanks everyone

manfred
Objective Development
Objective Development
Posts: 561
Joined: Sat Jul 31, 2010 9:47 am
Location: Vienna
Contact:

Re: Make launchbar go to volumes

Post by manfred » Thu Jun 09, 2011 9:18 am

Every developer knows such situations all too well ;)
Nice that it works now!

Post Reply