Bhishan Posted October 25, 2018 Posted October 25, 2018 (edited) This might be a very simple question, but I could not find an easy way to assign a keyboard shortcut to run Alfred with another workflow command arguments: For example: In Alfred: " throw" command will throw all the contents from the Downloads folder to Trash Folder. (workflow: Trash Downloads axelpeigne.trashdownloads) In Alfred: "emptytrash" command will empty the Trash contents using Alfred built-in command. Is there a way to combine these two commands and assign keyboard shortcuts for them? Required: ctrl-shift-E should run alfred commands `throw` and then `emptytrash`. My attempt workflow is here. Pesudocode: ``` tell application "Alfred 3" to run command "throw" tell application "Alfred 3" to run command "emptytrash" ``` Then just prepend a HOT key trigger to this File Script. I just don't know the actual AppleScript commands. Thanks. Edited October 31, 2018 by Bhishan
CJK Posted October 25, 2018 Posted October 25, 2018 Yes, I believe so. You can take the first workflow (`throw`) and append a _System Command_ action, for which you would choose "Empty Trash". Then prepend to all of this a hotkey that triggers this sequence of events. No AppleScript ought to be needed. Bhishan 1
Bhishan Posted October 26, 2018 Author Posted October 26, 2018 Thanks a lot, I figured it out. -- cd to Downloads try set folderPath to POSIX file "{query}" on error set folderPath to (path to downloads folder as text) end try -- try to delete items in Downloads if any try tell application "Finder" set itemsToDelete to every item of folder folderPath delete itemsToDelete end tell end try -- empty trash tell application "Finder" empty trash end tell
vitor Posted October 27, 2018 Posted October 27, 2018 @Bhishan You have way too much code. You can do it with tell application "Finder" delete every item of folder (path to downloads folder as text) empty trash end tell Bhishan 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now