Directing "do script with command" to existing Terminal window
Directing "do script with command" to existing Terminal window
- Subject: Directing "do script with command" to existing Terminal window
- From: Bob Majors <email@hidden>
- Date: Fri, 15 Feb 2002 09:02:36 -0800
This is a bit long; scan to "*******" to simply see my question.
I'm trying to automate the getting of a text string returned from Terminal,
while ssh'd into a remote host, e.g., I enter "hostname" and "everest<nn>"
is returned (<nn> is an active host cluster member number). I then want
AppleScript to put the returned hostname into a Fetch shortcut and upload
file from my OS X box to the remote host.
(sidebar: The reason for all this is because the OS X version of Fetch we're
using doesn't yet negotiate clusters properly, and a specific, currently
active host+clusterMemberNumber must be used. I'm mirroring a local
Dreamweaver directory with Fetch because Dreamweaver's WebDAV doesn't
support ssh, and the remote host disallows clear-text login passwords.)
I'm building two scripts that work with Terminal: the first to ssh to
another host; the second to execute commands to the open Terminal window.
(sidebar: I'm using two scripts because I want to manually enter my remote
host login password security reasons, and I'm not aware of any QuicKeys-like
'wait for user input' command that would allow a single script to pause and
resume).
tell application "Terminal"
do script with command "ssh email@hidden"
(* Closes that pesky extra window: *)
close window 2
end tell
This works fine, and if Terminal is already open I get:
Welcome to Darwin!
ssh email@hidden <-- Not sure why this is here.
[d-123-45-678-123:~] me% ssh email@hidden
email@hidden's password:
[I enter my password, press return & get:]
everest26% [or "everest05", etc. -- "26" is a cluster member number]
The problem is that next script always sends the "do script with command"
string to a newly-spawned window, no matter which window I specify. I've
even renamed the window "foo" and directed "do script with command" to it,
but with no success.
******* How can I direct commands to an existing Terminal window (that is
open to a remote host)?
These don't work:
tell application "Terminal"
do script with command "hostname"
end tell
tell application "Terminal"
(* I've also tried "window 2"; and "foo",
after first renaming the window "foo": *)
tell window 1
do script with command "hostname"
end tell
end tell
If I can get this to work, my next chore is to learn how to get the returned
hostname value, put it into my Fetch Mirror shortcut. thanks
Bob Majors
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.