Jump to content

Get Currently Edited Workflow URI


Recommended Posts

Ref.: Twitter Post

---

 

I have a few complex (and many more simple) Alfred workflows and I keep separate documentation on them in another app. It happens to be Obsidian. When I run the workflow debugger I can get a URL for a component in the workflow, and from that a URI for the workflow. I can put this into my Obsidian note and it gives me a way to reference back to the workflow directly.

 

For example, if I trigger the "Browse Hook Bookmarks" flow in the workflow of the same name for the app Hook, I can extract the URI for the script filter step:

alfredpreferences:workflows>workflow>user.workflow.B012BDA7-3A8B-40FB-9692-48283E21C9AB>F9E79BE7-748B-4D2D-AA7F-547DD6972C86

 

It is a simple matter to then derive the URI for the workflow itself.

alfredpreferences:workflows>workflow>user.workflow.B012BDA7-3A8B-40FB-9692-48283E21C9AB

 

Once I know the workflow ID, I could effectively build the URI myself, but this is simply the most convenient way I have found so far.

 

As noted above, I do make use of the Hook app. I use this to help me create and maintain bidirectional links between resources. In this case, being able to use Hook would allow me to link from the Alfred workflow to my documentation; currently I can only link from the documentation to the workflow, and getting the URI involves a little extra effort on my part. If this doesn't make much sense as to what Hook is doing, their website has a variety of resources to help explain how it all works and fits together - certainly far better than I could explain here.

 

If Hook could get the ID or the full URI for the current workflow programmatically, this would enable it to be used for by Hook for linking/association, and would make things much easier for me 😁

 

Hook uses integration scripts to get information like this from apps, so having an x-callback-url to return the ID, or some AppleScript to get the URI would allow me to create an integration script.

 

I have not as yet been able to determine a way to programmatically retrieve this information for use in a Hook integration script, and so I am posting this as a feature request. But, if there is another way to approach this, I'm more than happy to take an alternative.

 

Thanks in advance for any consideration you might give to this request. 

Link to comment
Share on other sites

Posted (edited)
1 hour ago, sylumer said:

Once I know the workflow ID

 

That is the name of the Workflow’s directory. If you change that, so does the UID. You can get it easily by navigating to it however is most convenient to you. Or you can make Workflow UIDs (locally) predictable by renaming the directories in a consistent pattern (install with brew install vitorgalvao/tiny-scripts/alfred-workflows-renamer or manually rename them how you see fit) which will make UIDs resilient even if you uninstall and reinstall the Workflow.

Edited by vitor
Link to comment
Share on other sites

43 minutes ago, vitor said:

That is the name of the Workflow’s directory. If you change that, so does the UID. You can get it easily by navigating to it however is most convenient to you.

 

As noted above, I am using the debugger approach simply as the most convenient way to get the URI - I tend to find it fractionally quicker to do than opening finder and it at the terminal (though I could probably script it to generate and put on the clipboard I guess).

 

I have never renamed a workflow directory, so I have never had to change an ID, and I do not foresee a reason occurring where I would want change it. If there ever was (e.g. a case where I could not restore from backup ¯\_(ツ)_/¯ ?), then I would just rename those directories back to the original names to restore the previous functionality.

 

The original request remains that it is the programmatic access to the ID/URI of the workflow currently being edited that to allow Hook to do the bi-directional linking.

Link to comment
Share on other sites

CogSci Apps Corp. co-founder here (Hook app). If Alfred had a bit of AppleScript to get and use a link (name and stable address) to the current resource that would be grand. If the Alfred team finds it is overkill to construct a URL scheme for Alfred's workflows, then on the Hook side, we could construct a subscheme scheme for Alfred, something like hook://alfred/<id>. That would be possible as long as there's a stable ID that is available via automation (along with the item name, which can change), and an AppleScript method to open or show a workflow based on its ID.

 

That would be a nice next step in making these two complementary apps (Hook and Alfred) work even better together.

As  @sylumer mentioned, we've made available a workflow for browsing Hook's bookmark Alfred's.

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...