rheckart Posted October 23, 2015 Share Posted October 23, 2015 I want to make a workflow that opens several tabs in a Terminal window, each doing something different. I discovered this ttab project that seems to do what I want, but it's not working correctly in my Workflow. When I enter a Terminal command as simple as ttab postgres -D /usr/local/var/postgres, the Workflow keeps executing the command over and over in new tabs, creating a race condition. How can I get this to run the command once and stop? Or is there a better way in a Workflow to to open new Terminal tabs and execute commands within them? Link to comment
Colin Posted October 26, 2015 Share Posted October 26, 2015 I am no expert by any means but senior members may suggest you post your workflow so they may see what may be wrong. Link to comment
rheckart Posted October 26, 2015 Author Share Posted October 26, 2015 A link to my workflow is here. Link to comment
Colin Posted October 27, 2015 Share Posted October 27, 2015 Not sure if this is exactly what you are after but it may help. It is an applescript I picked up somewhere. tell application "Terminal" activate -- Get a window that's not busy. -- If there are no open windows, open one. if (count of windows) is greater than 0 then repeat with currentWindow in windows if currentWindow is not busy then set targetWindow to currentWindow end if end repeat else do script "" set targetWindow to window 1 end if -- Do command 1. set firstCommand to "ls" do script firstCommand in targetWindow -- Open a new tab. tell application "System Events" to tell process "Terminal" to keystroke "t" using command down -- Do command 2. set secondCommand to "pwd" do script secondCommand in targetWindow -- And so on... end tell rheckart 1 Link to comment
deanishe Posted November 11, 2015 Share Posted November 11, 2015 A link to my workflow is here. Have you tried running the commands as normal Run Script actions instead of Terminal Command ones? Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now