lilyball Posted October 19, 2014 Share Posted October 19, 2014 I'm working on a workflow, and I want a script filter result to be invalid, but to be valid if I hold Option. Is there any way to accomplish this? The context is that holding Option lets you delete a result, but the regular action isn't valid unless you type a second argument. Link to comment
deanishe Posted October 19, 2014 Share Posted October 19, 2014 That's not possible, I'm afraid (at least not according to my tests). An item is either valid or invalid. If it's invalid, Alfred won't let you action it so modifiers will have no effect. If it's valid, Alfred will "action" it even if there's no action connected (i.e. Alfred's window will just close, but nothing will actually happen). If you're working with filepaths, you could work around it (File Actions still work for items whose type is "file" even if they are invalid). You could work around this (in a hacky fashion) by the default (no modifier) action reopening Alfred with the same query, but that'd probably be quite nasty. You'll probably have to rejigger the way your workflow works. Link to comment
Andrew Posted October 20, 2014 Share Posted October 20, 2014 I've added a note to have a think about this when I do a bit of workflow fettling in the future, I can see that this scenario could be useful Link to comment
deanishe Posted October 20, 2014 Share Posted October 20, 2014 Perhaps you could twizzle the <subtitle mod="cmd"> XML into a mod tag: <mod key="cmd" valid="yes"> <subtitle>My alternate subtitle</subtitle> <arg>my alternate arg</arg> </mod> Having (optional) alternate args would make it easier to, say, open URLs to different websites or copy different formats of dates/colours/whatever to the clipboard without having to wrangle half a dozen Run Script/Open URL/Copy to Clipboard actions. It'd also make it easier for workflows to manage their own configuration without having to re-write their own info.plist, which is not an optimal solution. Florian and Andrew 2 Link to comment
Florian Posted October 20, 2014 Share Posted October 20, 2014 Perhaps you could twizzle the <subtitle mod="cmd"> XML into a mod tag: <mod key="cmd" valid="yes"> <subtitle>My alternate subtitle</subtitle> <arg>my alternate arg</arg> </mod> Having (optional) alternate args would make it easier to, say, open URLs to different websites or copy different formats of dates/colours/whatever to the clipboard without having to wrangle half a dozen Run Script/Open URL/Copy to Clipboard actions. It'd also make it easier for workflows to manage their own configuration without having to re-write their own info.plist, which is not an optimal solution. A thousand times YES ! Link to comment
deanishe Posted October 20, 2014 Share Posted October 20, 2014 (edited) To expand on that suggestion a bit: it could (should?) be possible to override any of the standard <item> values that make sense (I guess overriding UID wouldn't serve any purpose, seeing as the item still refers to the same thing, nor the copy/large text). So, I could change the title and/or the icon, too. As a trivial example, I could write a workflow that mimics the fallback searches (Google, Wikipedia, etc.), but when the user presses a mod key, the search would go to google.de or de.wikipedia.org instead of the English site. And I could show a different icon with pretty black, red and yellow (not gold) stripes atop the standard Google/Wikipedia icon. Edited October 20, 2014 by deanishe 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