Jump to content

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

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

  • 1 year later...
  • 5 weeks later...

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