luckman212 Posted April 28 Posted April 28 (edited) I was re-reading https://www.alfredapp.com/help/workflows/inputs/script-filter/json/ today checking for recent changes that were introduced in 5.5. I noticed that there's an "action" key (apparently not new...) that can be used to customize the behavior when used with Universal Actions. I might be having a "slow brain" day, but I can't quite wrap my head around how this works or when it would be useful. Anyone got any examples (real world or hypothetical) of this feature? Edited April 28 by luckman212
vitor Posted April 28 Posted April 28 Real example. Download Media, after downloading the file, writes the origin URL to its metadata. When listing such a file in Watch List, calling the Universal Action will either act on the file itself or its origin URL, depending on the Workflow’s configuration. action is used to control that dynamic nature.
luckman212 Posted April 29 Author Posted April 29 Thanks @vitor I had a play and think I grasp it now. So when actioning an item via <TAB> key from a Script filter, the "action": { ... } will override the value passed into the remainder of the workflow, overriding the arg key. And, some detection is done to see if it's text, file(s) or url. Is this correct? Still unclear to me whether it makes sense to have multiple types defined e.g. "action": { "text": "one", "auto": "two" } In that case, if the arg was a string abc would the output be one or two ? Is there a way to determine which format was autodetected further downstream in the script via some variable?
vitor Posted April 30 Posted April 30 18 hours ago, luckman212 said: the "action": { ... } will override the value passed into the remainder of the workflow, overriding the arg key. 18 hours ago, luckman212 said: Is there a way to determine which format was autodetected further downstream in the script via some variable? Once you enter the Universal Actions panel, you’re effectively leaving the workflow and triggering something else, so there is nothing further downstream on that run. 18 hours ago, luckman212 said: Still unclear to me whether it makes sense to have multiple types It might. Depends on what your Universal Actions take as input. 18 hours ago, luckman212 said: In that case, if the arg was a string abc would the output be one or two ? Both. You can see them in the Universal Action preview after tabbing.
luckman212 Posted May 2 Author Posted May 2 (edited) Another question @vitor if you have a moment. I noticed that if an item has an empty arg then the action: {...} seems to be ignored, and the Universal Action cannot be invoked for that item. This is causing a minor problem for one of my workflows, because I actually DO want the user to be able to invoke the UniversalAction, but also if they simply hit [ENTER] to action the item, I do not want any argument passed into the next step. Example (Script Filter) cat <<EOJ { "items": [ { "title": "Fruit", "arg": "Apple", "subtitle": "arg='Apple' ua='Orange'", "action": { "auto": "Orange" } }, { "title": "Folder", "arg": "~/Documents", "subtitle": "arg='~/Documents' ua='~/Desktop'", "action": { "file": "~/Desktop" } }, { "title": "URL", "arg": "https://www.alfredapp.com/help/workflows/inputs/script-filter/json/", "subtitle": "arg='Alfred JSON help' ua='https://alfredapp.com'", "action": { "url": "https://alfredapp.com" } }, { "title": "Thing with no arg", "arg": "", "subtitle": "arg='' ua='~/Documents'", "action": { "file": "~/Documents" } }, ]} EOJ Edited May 2 by luckman212
luckman212 Posted May 2 Author Posted May 2 I added this question over in bug reports in case it is an actual bug.
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