advertisement

Article:
  AppleScript Primer for Mac OS X
Subject:   Directing "do script with command" to existing Terminal window
Date:   2002-02-14 10:46:02
From:   senior
I'm building a 2 scripts to interface with the Terminal; the 1st to ssh to another host; the 2nd to execute commands to the open Teminal window. (I'm using 2 scripts because the first requires my login password which I'd rather do manually, and I'm not aware of any QuicKeys-like 'wait for user input' command).


1st thing I've hacked is:
--beg--
tell application "Terminal"
activate
tell window 1
do script with command "ssh me@host.com""
end tell
(* Closes that pesky extra window:*)
close window 2
end tell
--end--


Problem is the next script always sends the command to a newly-spawned window, no matter which windows I specify. How can I direct it to the window opened in the 1st script?


--beg--
tell application "Terminal"
tell window 1
do script with command "clear"
end tell
end tell
--end--