Re: Scripting THROUGH terminal?
Re: Scripting THROUGH terminal?
- Subject: Re: Scripting THROUGH terminal?
- From: Dave Stewart <email@hidden>
- Date: Tue, 1 Oct 2002 15:39:43 -0700
On Tuesday, October 1, 2002, at 01:12 PM, David A. Cox wrote:
Did you try something like
tell application "Terminal"
do script "Command" in window "NAMEOFWINDOW"
end tell
You will need the """ marks in this to make it work.
an example would be:
tell application "Terminal"
do script "ps" in window "PSwindow"
end tell
Yeah, but what's the name of the window? I know it's title, the .term
file that created it, I can even get the window to show me the shell
it's running and it's tty (using the window settings), none of which
works, so how do I discern the window's name itself? I've tried a
number of things over the last day or so, but I just can't figure this
out. Keep in mind the script hasn't created the window, the window is
already running and I'm trying to "hook" into it with the script
(assuming that's possible). We start the window by double-clicking the
.term file we've created, which basically opens a terminal window and
performs the telnet command within it to connect to an AIX server,
which runs the business software.
Some else also suggested I access the window by number, ala
do script "ps" in window 1
but alas this also doesn't seem to hit my running window. It does cause
another window (not a terminal) to pop up, titled "the result" which
contains a text area which simply contains a pair of empty quotes (""),
but I have no idea what that means. Should that be telling me something
(other than I'm lost)?
Other dazzling failures include:
--this failure causes a "variable windowname is not defined" execution
error (?)
set windowname to window name
do script "IC3" in windowname
--this failure causes a NSCannotCreateScriptCommandError
set windowname to application name
do script "IC3" in windowname
"IC3" is a shortcut in the software we're running which takes us to a
particular menu, we would normally type in at the prompt (not a
standard *nix prompt, mind you, but a prompt from the software running
through the terminal. Does that matter? The cursor is guaranteed to be
there, we don't have to click anything to get it there). There are
probably half a dozen other similar things I've tried, inspired by the
Terminal Dictionary itself. Unfortunately the only thing I have gained
from it is a slightly elevated stress level. :-)
(Of course, all the above was inside a tell block)
By the way, where did you find instructions on "how to create a CGI
with
AppleScript" at? I am working on what I think is something similar, and
your find might be of help.
Apple's AppleScript Resources (under "Essential Subroutines"). The page
itself is at
http://www.apple.com/applescript/guidebook/sbrt/pgs/sbrt.12.htm
Lots of good stuff in there, just nothing like what I'm doing. :-(
On Tue, 1 Oct 2002, Dave Stewart wrote:
Greetings list,
I am a newbie to AppleScript and am trying to automate a company
procedure. We are using (or starting to use) the Mac Terminal app (in
Jaguar) as an emulator, using telnet to connect to the company server
and running the business software through it.
I want to send commands through the OPENED terminal window to the
business software, but can't seem to figure out how to reference the
opened terminal. I can send commands to an unnamed window, which
causes
a new terminal window to be created, but that doesn't help much
(unless
I decide to try to create the telnet connection in that new window,
but
I already have the window running when I want the script to run.
Closing the window to run the script to reopen the connection seems
clumsy, especially since it's not me running the end product but
another company employee). How would I reference a terminal window
that's already opened on my desktop? We've set the title of the
window,
but that doesn't seem to do much good (or am I simply missing
something
important here?) We open the telnet connection using a .term file
we've
saved, but I don't see how that will help either. I could try using
the
tty of the process, but 1) that isn't working either and 2) I'm not
guaranteed to have the same tty from one day to the next, since the
window MAY BE closed after hours and restarted first thing in the
morning (not guaranteed, although the connection will be dropped after
a timeout).
I've found docs detailing how to create a CGI with AppleScript, surely
what I want to do is much easier than that?!? So what's the trick?
Thanking you all in advance for any help or insight,
Dave Stewart
Aqua-flo (Goleta)
email@hidden
_______________________________________________
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.
Dave Stewart
Aqua-flo (Goleta)
email@hidden
_______________________________________________
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.