Jump to content
andrewning

Workflows: make "Open URL" an output in addition to an action

Recommended Posts

I've made more than one workflow where I wanted the ability to copy some text to the clipboard *or* open a URL in the browser (using an action modifier to trigger the URL case).  In both cases, I start with a script filter, but what I want to copy to the clipboard is not the actual URL, but some different data.  My script filter would like to send two pieces of information, and this is no problem to do just by concatenating them and adding a custom delimiter.  The problem is that "Open URL" can only be an action and not an output.  So because only one {query} is allowed, and "Open URL" has no parsing abilities (other than adding some static portions of the URL), I must past only the URL data through the query.  This means that I cannot pass the rest of the data to the clipboard copy portion of the workflow.  If only passing the URL, I'd basically need to duplicate the same code in the script filter.  Of course it's not hard to write your own script to open a URL in the default browser (which is what I've done), but if "Open URL" could be an output (and not just an action) then it would actual be useful for these use cases.

 

Example below is essentially what I'd prefer to do, instead I replace "Open URL" with a "Run Script" than handles the parsing and open URL functionality.  I'd still need the "Run Script" anyway to parse the two-part query, but it could reuse the exact same script from the top "Run Script".  Then I'd connect to "Open URL" on the far right if it was an output option.

 

X0USy1h.png

Share this post


Link to post
Share on other sites

I've made more than one workflow where I wanted the ability to copy some text to the clipboard *or* open a URL in the browser (using an action modifier to trigger the URL case).  In both cases, I start with a script filter, but what I want to copy to the clipboard is not the actual URL, but some different data.  My script filter would like to send two pieces of information, and this is no problem to do just by concatenating them and adding a custom delimiter.  The problem is that "Open URL" can only be an action and not an output.  So because only one {query} is allowed, and "Open URL" has no parsing abilities (other than adding some static portions of the URL), I must past only the URL data through the query.  This means that I cannot pass the rest of the data to the clipboard copy portion of the workflow.  If only passing the URL, I'd basically need to duplicate the same code in the script filter.  Of course it's not hard to write your own script to open a URL in the default browser (which is what I've done), but if "Open URL" could be an output (and not just an action) then it would actual be useful for these use cases.

 

Example below is essentially what I'd prefer to do, instead I replace "Open URL" with a "Run Script" than handles the parsing and open URL functionality.  I'd still need the "Run Script" anyway to parse the two-part query, but it could reuse the exact same script from the top "Run Script".  Then I'd connect to "Open URL" on the far right if it was an output option.

 

X0USy1h.png

 

You could simply do as Tyler suggested and replace the Open URL with a Run Script and use that to parse the output of the script filter and just end the Run Script with "open <url>" which is essentially the same thing as the Open URL item, unless you wanted to specify a different browser or something else special.

Share this post


Link to post
Share on other sites

Thanks, but actually I suggested that work around, because that is what I already do.  It's not a big deal, there is of course nothing hard about opening a url, or even doing the proper encoding if necessary.  I was just suggesting that perhaps allowing Open URL to be an output would make it a more useful option.  As an admittedly trivial example, some people I send these workflows to are not necessarily comfortable with changing code and want to open in a non-default browser.  The Open URL box is pretty easy for people to use because its a graphical way to change the browser.  It's also clearer at a glance what the workflow is doing without opening the script.  But again, no big deal, just a suggestion.

Share this post


Link to post
Share on other sites

Automator does a good job with this.

 

They have multiple variables go through the system.

If we assume that query is the only variable, then I wish action worked like script filter.

 

 

I was going through the UI to type up a suggestion in this thread, but noticed that open url has an output.

Is this still an issue?

 

--EDIT--

Found it:

 

I want the output of a script to be fed into open url.

The script would massage the input to form into a url

 

Sure want actions to feed into other actions.

Yes, in the mean time, I'm using "scriptfilter" instead of "trigger -> script" to do my work

 

 

ASIDE: thanks again for the awesome workflows

Edited by kbrock

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...