Hi, Could some one take a look at the script below and tell me what could be wrong with it? The goal is to create new Terminal window and run a command in it. The script works most of the time, but once in a while, it will fail to do "run command" bit.
Your comments will be highly appreciated.
Very best regards, Andrei Tchijov Leaping Bytes, LLC
P.S. I am not sure if it make a difference, but I am running this script via the shell using osascript . P.P.S. Though "activate" in the last "tell application ..." seems redundant, I think it did improve reliability of the script. =================================================================== tell application "System Events" if not (exists process "Terminal") then tell application "Terminal" activate end tell else tell application "Terminal" activate end tell tell application "System Events" tell process "Terminal" tell menu bar 1 tell menu bar item "File" tell menu "File" click menu item "New Shell" end tell end tell end tell end tell end tell end if tell application "Terminal" activate do script "<command to run>" in the front window end tell end tell
|