vquest Posted March 31, 2023 Share Posted March 31, 2023 Hi all, I'm new to Alfred. I'm building a workflow to clear my desktop when it becomes too cluttered. The steps so far are: 1. Keyword 2. Automation task: list folder contents ~/Desktop 3. File buffer That works great, but I'm struggling to find a way to filter the Desktop contents so that folders don't get placed in the buffer, or alternatively remove them once added. My plan is to move all the buffer contents to particular folders on the Desktop based on their file type, but I need to remove the folders first. Any ideas will be much appreciated. Link to comment
vitor Posted April 1, 2023 Share Posted April 1, 2023 Welcome @vquest, Between the second and third step add a Run Script. Leave the settings to the default and use this in the Script box: function alfred_args { /usr/bin/osascript -l JavaScript -e 'function run(argv) { return JSON.stringify({ alfredworkflow: { arg: argv } }) }' "${@}" } files=() for input_path in "${@}" do [[ -f "${input_path}" ]] && files+=("${input_path}") done alfred_args "${files[@]}" This will be made into an Automation Task in the next release. vquest 1 Link to comment
vquest Posted April 1, 2023 Author Share Posted April 1, 2023 Thanks, Vitor I need to look into how to use the terminal and write scripts. I'm loving Alfred. So very useful. It's a great app. Link to comment
vquest Posted April 1, 2023 Author Share Posted April 1, 2023 8 hours ago, vitor said: Welcome @vquest, Between the second and third step add a Run Script. Leave the settings to the default and use this in the Script box: This will be made into an Automation Task in the next release. One thing to be aware of when building the Automation Task is that the script didn't filter out alias folders that I had on the Desktop. I'm guessing probably because alias folders are actually just files that link to a folder elsewhere. Link to comment
vitor Posted April 1, 2023 Share Posted April 1, 2023 Precisely. An alias is still a file, and it can be located anywhere while pointing to its destination. So including them in files makes the most sense for the Automaton Tasks, the distinction is being made by standard tools. Link to comment
vquest Posted April 1, 2023 Author Share Posted April 1, 2023 I have a question about the get matching argument automation task. Is it possible to have an array of regular expressions in a single task? If so, how is it written? I have tried commas and a few other things, but without success. Link to comment
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