giovanni Posted April 1, 2021 Share Posted April 1, 2021 Hi, I found this nice (albeit older) workflow to manage Alfred workflows. https://github.com/jmjeong/alfred-extension/tree/master/managealfredextension I would like to add an action to open the workflow preferences (similar to entering `?[myWorkflow]` in Alfred). Is there an AppleScript command to achieve that? thanks! Link to comment
Vero Posted April 1, 2021 Share Posted April 1, 2021 @giovanni That's essentially built-in now, if I've understood correctly what you're looking for. Just type the question mark followed by any feature name, workflow name or keyword, even the word "hotkeys" or "keywords" to see relevant results from your features and workflows. More details about the feature can be found here: https://www.alfredapp.com/blog/tips-and-tricks/search-alfred-question-mark-trick/ Cheers, Vero Link to comment
deanishe Posted April 1, 2021 Share Posted April 1, 2021 1 minute ago, Vero said: That's essentially built-in now, if I've understood correctly what you're looking for. I think he wants the workflow to be able to send the user directly to its own configuration in Alfred Preferences. Link to comment
giovanni Posted April 1, 2021 Author Share Posted April 1, 2021 I meant launching through the workflow something like '?{query}' where {query} is a workflow name selected from a list of the installed workflows (which is provided by 'alfred-extension'). In other words: 1. the user launches 'alfred-extension` which returns a list of installed workflows 2. the user selects workflow X 3. Alfred opens the workflow X configuration page in Alfred preferences. Link to comment
Andrew Posted April 15, 2021 Share Posted April 15, 2021 Alfred internally has a URL scheme to open the preferences to certain pages, sometimes used by the ? keyword. I'm reluctant to make this a public accessible feature as this makes it significantly more tricky to make changes in the future for something which won't be used much. Having said that, in my wider plan, I do have some ideas written down to make a configurable user-facing "preferences" per workflow which would show when installing a workflow. universe, luckman212, giovanni and 3 others 6 Link to comment
giovanni Posted March 28, 2022 Author Share Posted March 28, 2022 (edited) I came back to this request as I am updating this old workflow, and I would really like to be able to open a workflow's configuration from it. I came up with this script below which works, but obviously flickers Alfred for a moment. I just wanted to check with the experts that this is currently a reasonable solution. Thanks! #!/usr/bin/env python3 # -*- coding: utf-8 -*- import subprocess myString = 'myWorkflow' launchArgs = "tell application id \"com.runningwithcrayons.Alfred\" to search \"?{}\"".format(myString) subprocess.check_call(["osascript", "-e", launchArgs]) launchArgs = "tell application \"System Events\" to key code 36" subprocess.check_call(["osascript", "-e", launchArgs]) Edited March 28, 2022 by giovanni Link to comment
vitor Posted March 29, 2022 Share Posted March 29, 2022 16 hours ago, giovanni said: this is currently a reasonable solution. Given the constraints, yes. You can improve it by using ?workflow myString instead of ?myString. That way you guarantee to only match against Workflow names, not their objects. But why are you running AppleScript code through Python, is it part of a larger script? If not, run it directly because it will be faster, more readable, and more resilient. giovanni 1 Link to comment
giovanni Posted March 29, 2022 Author Share Posted March 29, 2022 thanks @vitor! 44 minutes ago, vitor said: You can improve it by using ?workflow myString great idea 45 minutes ago, vitor said: run it directly yes, right now it is all in one script, but later I will split and run directly. 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