Latest Download to Launchbar

Sharing and discussing custom actions for LaunchBar
gabrielroth
Posts: 2
Joined: Sun Sep 23, 2018 3:25 am

Latest Download to Launchbar

Postby gabrielroth » Sun Sep 23, 2018 3:29 am

I found myself constantly navigating to my Downloads folder and arrowing in to get the file I'd just downloaded, so I thought I'd make it easier.

Here's an AppleScript one-liner that gets the most recent item in your Downloads folder and passes it to LaunchBar. Paste into a file in Script Editor, save in ~/Library/Application Support/LaunchBar/Actions/ and run from LaunchBar.

Code: Select all

tell application "LaunchBar" to set selection to (path to downloads folder as text) & (do shell script "cd ~/Downloads; ls -t | head -1") as alias

Rahlir
Posts: 2
Joined: Thu Sep 13, 2018 8:59 pm

Re: Latest Download to Launchbar

Postby Rahlir » Sat Sep 29, 2018 9:57 pm

Thanks! Great idea. The only thing I would point out is that there really is no reason to use applescript at all - I tried to avoid that if I can since AppleScript is quite an inefficient language. You can just write a shell script such as

Code: Select all

#!/bin/bash
cd ~/Downloads && echo "$PWD/"$(ls -t | head -1)""

The only additional requirement would then be to make Info.plist since you need to specify that LBResutltType is path


Return to “LaunchBar Actions”

Who is online

Users browsing this forum: No registered users and 3 guests