Re: Sending Commands to Terminal Windows
Re: Sending Commands to Terminal Windows
- Subject: Re: Sending Commands to Terminal Windows
- From: Christopher Nebel <email@hidden>
- Date: Sat, 24 Aug 2002 21:34:56 -0700
On Saturday, August 24, 2002, at 08:43 PM, Jeffrey Berman wrote:
...while you still can't issue a command and respond to a prompt in
one shot, you can do it in two:
do script "slogin somewhere.com"
do script "password" -- types the password.
Would there need to be an "in" parameter for the second line to avoid
spawning a new window?
Oh, duh. Yes, of course there is. That's what I get for typing it in
by hand instead of using copy and paste. : \
Having tried it for real now, I find that what works well is to let the
first command spawn a new window, and then use "in window 1" for the
rest, since the spawned window is created frontmost. (I suppose if
you're being paranoid, you should get window 1 immediately after the
first command, stuff it in a variable, and use that. That way, you
won't be sensitive to people re-ordering windows while the script is
running.)
Also, and this is irritating but not surprising and may depend on the
command, login sequences like this are sensitive to timing. You'll
probably need a "delay" statement between the initial command and the
password.
Putting that all together, I can get a telnet session going using the
following:
tell application "Terminal"
do script "telnet metropolis"
set w to window 1
delay 5
do script "nebel" in w
delay 1
do script "password" in w -- no, my password isn't really "password".
end tell
--Chris Nebel
AppleScript Engineering
_______________________________________________
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.