Jump to content

support count of workflow


Alan He
 Share

Recommended Posts

  • 4 months later...
On 2/10/2022 at 9:09 PM, vitor said:

This works great. it will be good if this code can be explained

 

sync_dir="$(osascript -l JavaScript -e 'function run(argv) { return JSON.parse(argv[0])["current"] } ' "$(cat "${HOME}/Library/Application Support/Alfred/prefs.json")")"
ls -1 "${sync_dir}/workflows" | wc -l | tr -d ' '

 

can the code be modified to find workflows using Python, workflows that are disabled or use auto-update feature? or perhaps create a list of workflow installed with their website / source location to easily share with your colleague?

Link to comment
Share on other sites

14 hours ago, pankajsz said:

it will be good if this code can be explained

 

It finds where your preferences are stored and counts the number of directories in the workflows directory. osascript, cat, ls, wc, tr are all standard tools you can find more about online or by running man TOOL_NAME in a terminal.

 

14 hours ago, pankajsz said:

can the code be modified to find workflows using Python, workflows that are disabled or use auto-update feature?

 

You’re repeating questions you’ve already been given answers to.

 

 

14 hours ago, pankajsz said:

or perhaps create a list of workflow installed with their website / source location to easily share with your colleague?

 

Keyword → Run Script → Copy to Clipboard. In Run Script:

 

readonly sync_dir="$(osascript -l JavaScript -e 'function run(argv) { return JSON.parse(argv[0])["current"] } ' "$(cat "${HOME}/Library/Application Support/Alfred/prefs.json")")"

for workflow in "${sync_dir}/workflows/"*; do
  /usr/libexec/PlistBuddy -c 'print name' "${workflow}/info.plist"
  /usr/libexec/PlistBuddy -c 'print webaddress' "${workflow}/info.plist"
  echo
done

 

Link to comment
Share on other sites

27 minutes ago, vitor said:
readonly sync_dir="$(osascript -l JavaScript -e 'function run(argv) { return JSON.parse(argv[0])["current"] } ' "$(cat "${HOME}/Library/Application Support/Alfred/prefs.json")")"

for workflow in "${sync_dir}/workflows/"*; do
  /usr/libexec/PlistBuddy -c 'print name' "${workflow}/info.plist"
  /usr/libexec/PlistBuddy -c 'print webaddress' "${workflow}/info.plist"
  echo
done

This is great vitor. Many many thanks. I am end user but will make efforts to understand the code above.

Link to comment
Share on other sites

On 6/25/2022 at 9:05 PM, vitor said:
On 6/25/2022 at 6:51 AM, pankajsz said:

can the code be modified to find workflows using Python, workflows that are disabled or use auto-update feature?

 

You’re repeating questions you’ve already been given answers to.

Found Alfred category, Show Enabled/disabled, Sort by feature, last modified. It is good.

 

We can add sort by author as feasible.

Link to comment
Share on other sites

On 6/25/2022 at 9:05 PM, vitor said:
On 6/25/2022 at 6:51 AM, pankajsz said:

or perhaps create a list of workflow installed with their website / source location to easily share with your colleague?

 

Keyword → Run Script → Copy to Clipboard. In Run Script:

 

readonly sync_dir="$(osascript -l JavaScript -e 'function run(argv) { return JSON.parse(argv[0])["current"] } ' "$(cat "${HOME}/Library/Application Support/Alfred/prefs.json")")"

for workflow in "${sync_dir}/workflows/"*; do
  /usr/libexec/PlistBuddy -c 'print name' "${workflow}/info.plist"
  /usr/libexec/PlistBuddy -c 'print webaddress' "${workflow}/info.plist"
  echo
done

@vitorHow to modify this code to export workflow selected in Alfred pane? This will be useful for sharing name and link of work with others

Link to comment
Share on other sites

7 hours ago, pankajsz said:

How to modify this code to export workflow selected in Alfred pane?


You’re asking about different kinds of things through this issue. The code isn’t modified to do the another thing, it’s written from scratch. Currently you can’t get the Workflow open in the preferences.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...