user3056783
user3056783

Reputation: 2646

AppleScript: Put text in Terminal ONLY (no execution)

I am using AppleScript to launch a certain python script. This python script uses arguments. I know how to use do script to launch commands but this time I just want to have python myscript.py ready. After that I would type my own argument and hit RETURN.

I don't know how to put the text in Terminal. Arguments will be different everytime I want to use the script, otherwise I would just use do script.

Upvotes: 1

Views: 225

Answers (1)

Digital Trauma
Digital Trauma

Reputation: 16016

This will type your command into the current active terminal window:

tell application "Terminal" to activate
tell application "System Events" to keystroke "python myscript.py "

If you need to select which terminal window, then there will be a bit more work to do.

Upvotes: 1

Related Questions