Page 1 of 1

Latest Download to Launchbar

Posted: Sun Sep 23, 2018 3:29 am
by gabrielroth
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

Re: Latest Download to Launchbar

Posted: Sat Sep 29, 2018 9:57 pm
by Rahlir
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