Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Script to run a command in new Terminal window works un-reliably.



Now I remember why I needed all that long long script :-(. It looks like, your version will produce one extra empty Terminal window in case when Terminal application was not running.

set tCommands to "osascript -e 'say \"Hallo Andrei\"'; cd /; ls -ls"

tell application "Terminal"
 activate

if (not (exists front window)) then
-- Use either one of the two 'tell application "System Events" ...' lines below.
--tell application "System Events" to tell process "Terminal" to click menu item "New Shell" of menu "File" of menu bar item "File" of menu bar 1
tell application "System Events" to tell process "Terminal" to keystroke "n" using command down
delay 1 -- Adjust the delay value accordingly.
end if


 do script tCommands in the front window
end tell
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden

This email sent to email@hidden
References: 
 >Script to run a command in new Terminal window works un-reliably. (From: Andrei Tchijov <email@hidden>)
 >Re: Script to run a command in new Terminal window works un-reliably. (From: Andrew Oliver <email@hidden>)
 >Re: Script to run a command in new Terminal window works un-reliably. (From: Andrei Tchijov <email@hidden>)
 >Re: Script to run a command in new Terminal window works un-reliably. (From: Andrei Tchijov <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.