Re: Directing "do script with command" to existing Terminal window
Re: Directing "do script with command" to existing Terminal window
- Subject: Re: Directing "do script with command" to existing Terminal window
- From: Matt <email@hidden>
- Date: Fri, 15 Feb 2002 14:59:06 -0500 (EST)
On a similar topic, I only responded directly to the poster, but in case
others on this list are interested, or if key persons may be reading this
list, or, maybe just to generate more interest in a scriptable telnet app
on OS X (since there's already a bunch on OS 9 that could be Carbonized!),
here's part of that private note:
---START NOTE---
...
Of course, that means you'd need a scriptable telnet client for OS X,
which brings you back to square 1, except for the following FYI which I
wanted to point out...
There is at least a small glimmer of hope from "MacTelnet X", which may
fit the bill, once it gets released for X (nobody else seems to even be
trying at this point, and MacTelnet X is claiming Spring 2002):
http://home.austin.rr.com/telnet/
---END NOTE---
Thanks,
-Matt
On Fri, 15 Feb 2002, Bob Majors wrote:
>
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.
>
Matthew Kozak
Rutgers University-Camden
email@hidden
**************************************************************************
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." -Ben Franklin
**************************************************************************
_______________________________________________
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.