Jump to content

Possible to run multiple script actions sequentially before outputting?


Recommended Posts

Posted

I'd like to be able to string together multiple script actions. I'm basically trying to automate switching the URL in my browser between the local and production versions. For example, switch between:

 

http://localhost:3000/stuff

http://awesomeness.com/stuff

 

The way I was thinking I'd achieve this is:

 

1) Use applescript to grab the URL of the active tab

2) Pass the URL string to a new script action that manipulates it via JavaScript (or Ruby, or Python, or any high-level non-applescript language)

3) Pass that result back to a new script action that will use Applescript to load the new URL in the active browser tab

 

However, it seems that I can't string together multiple actions. Am I missing something, or is there an alternative solution?

Posted

There is no need to use multiple actions for this.
 
You can run AppleScripts from Python or chain the scripts together in a single Run Script Action using bash pipes:
 
osascript GetSafariURL.scpt | python fix_url.py | osascript OpenURLinSafari.scpt

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
×
×
  • Create New...