Open Path...

General discussions about LaunchBar
Post Reply
beerich
Rank 4
Rank 4
Posts: 161
Joined: Thu Apr 05, 2007 11:05 am
Location: Toronto

Open Path...

Post by beerich » Wed Jul 02, 2014 1:44 pm

Hi folks.

How can I open a location I know of? I want to open /users/rich/library/preferences/ but have no clue how to target that directory for viewing.

Any suggestions? I thought about adding it to the Index, but that seems a bit much for a single go-to.

Cheers

Jono
Rank 4
Rank 4
Posts: 161
Joined: Mon Feb 25, 2008 11:25 am
Location: UK
Contact:

Re: Open Path...

Post by Jono » Wed Jul 02, 2014 2:06 pm

One way of doing it could be to type Enter Text (or et) if you've trained it > hit the Spacebar > Paste or type the path > Hit Tab > Type Finder > Hit Return. It sounds quite a long process but is quite quick if you've done it a couple of times.

I access a few folders in ~/Library quite often through, so added it to the Index to just look folders at the top level.

beerich
Rank 4
Rank 4
Posts: 161
Joined: Thu Apr 05, 2007 11:05 am
Location: Toronto

Re: Open Path...

Post by beerich » Wed Jul 02, 2014 2:11 pm

OK, good to know. Just added it to my new version 6.

I'm surprised that this isn't an obvious one, like command-shift-G in the finder.

Cheers

Jono
Rank 4
Rank 4
Posts: 161
Joined: Mon Feb 25, 2008 11:25 am
Location: UK
Contact:

Re: Open Path...

Post by Jono » Wed Jul 02, 2014 2:15 pm

Yea, it would be good if you could do that.

Allsop
Rank 1
Rank 1
Posts: 30
Joined: Mon Oct 21, 2013 8:46 pm

Re: Open Path...

Post by Allsop » Wed Jul 02, 2014 7:16 pm

I do not know if this will work for your particular case but I have got a similar scenario to work by creating an alias of the destination, copy/paste that into LB and then assign an abbreviation. Works for me & worth a try. Interested to know if it works for you.

beerich
Rank 4
Rank 4
Posts: 161
Joined: Thu Apr 05, 2007 11:05 am
Location: Toronto

Re: Open Path...

Post by beerich » Wed Jul 02, 2014 7:32 pm

Hi there.

Yeah that works, but I go to various places all the time. Having a single action that allows me to point anywhere is the natural way to go about this. Like I said it's a bit strange there's nothing allowing me to point anywhere in the Finder.

Cheers

iRounak
Rank 4
Rank 4
Posts: 191
Joined: Fri Oct 23, 2009 7:11 pm
Contact:

Re: Open Path...

Post by iRounak » Wed Jul 02, 2014 8:22 pm

Having a single action that allows me to point anywhere is the natural way to go about this. Like I said it's a bit strange there's nothing allowing me to point anywhere in the Finder.

I don't quite understand what this means. What kind of behaviour do you want?

Here are a couple of ideas:

Code: Select all

on handle_string(theString)
   tell application "Finder"
      activate
      make new Finder window
      set target of front window to (POSIX file theString)
   end tell
end handle_string


1. Bring up this script in LB.
2. Press space
3. Enter the path like "/users/rich/library/preferences/"
4. Press return
Result: A new Finder window will open revealing the item in that path.


Code: Select all

on handle_string(theString)
   tell application "LaunchBar"
      remain active
      set selection to (POSIX file theString) as alias
   end tell
end handle_string

1. Bring up this script in LB.
2. Press space
3. Enter the path like "/users/rich/library/preferences/"
4. Press return
Result: LB will show you the item

Am I on the right path?

beerich
Rank 4
Rank 4
Posts: 161
Joined: Thu Apr 05, 2007 11:05 am
Location: Toronto

Re: Open Path...

Post by beerich » Thu Jul 03, 2014 5:19 pm

Yeah that's pretty much what I wanted to do. I thought this would have been an obvious one for LB.

Upon running this script, this is what I get:

error "Finder got an error: AppleEvent handler failed." number -10000

When using "as alias", this is what it gives me (I'll post the full syntax):

Code: Select all

on handle_string(theString)
   tell application "Finder"
      activate
      make new Finder window
      set target of front window to (POSIX file theString) as alias
   end tell
end handle_string

handle_string("~/Library/Preferences/")


error "Can’t make POSIX file \"~/Library/Preferences/\" of application \"Finder\" into type alias." number -1700 from file ":~:Library:Preferences:" to alias

iRounak
Rank 4
Rank 4
Posts: 191
Joined: Fri Oct 23, 2009 7:11 pm
Contact:

Re: Open Path...

Post by iRounak » Thu Jul 03, 2014 6:27 pm

As I wrote earlier:
3. Enter the path like "/users/rich/library/preferences/"


Anyway, now I have improved it to handle the tilde ~ character

Code: Select all

on handle_string(theString)
   if theString starts with "~" then
      set home_path to POSIX path of (path to home folder as string)
      set theString to home_path & (text 3 thru -1 of theString)
   end if
   tell application "LaunchBar"
      remain active
      set selection to (POSIX file theString) as alias
   end tell
end handle_string

beerich
Rank 4
Rank 4
Posts: 161
Joined: Thu Apr 05, 2007 11:05 am
Location: Toronto

Re: Open Path...

Post by beerich » Thu Jul 03, 2014 6:41 pm

Ah very good. Works.

Cheers

Post Reply