Google Answers Logo
View Question
 
Q: Applescript: Need short program ( No Answer,   3 Comments )
Question  
Subject: Applescript: Need short program
Category: Computers
Asked by: rosalind-ga
List Price: $10.00
Posted: 09 Jul 2003 13:35 PDT
Expires: 08 Aug 2003 13:35 PDT
Question ID: 227102
Hello Googlers --

I need a short Applescript program to do the following:

on opening, launch an SSH program. Connect to a particular server (it
is the default, and so a user just presses "enter" usually.) Enter a
username and password (this goes into a dialog box.) In the terminal
window, enter a few shell commands (these can be passed as text, I
guess.) Close the terminal. Exit SSH. Delete the script (i.e., the
script erases itself at the end of launch.)

I am using Mac OS 8.6.

I realize that maybe I will need to provide the correct paths to
various places on my hard drive for this program to work correctly.
Please mark those places in the code or wherever. Finally, I am not
sure how to get the computer to recognize a text file as an
applescript program; please let me know how to do this.

Please reply quickly! (In the next few days, before Friday night, for
a 25% tip!)
Answer  
There is no answer at this time.

Comments  
Subject: Re: Applescript: Need short program
From: zarby-ga on 10 Jul 2003 14:11 PDT
 
You didn't mention the SSH program you're using.

If you're using MacSSH, you can do the following:
tell application "MacSSH PPC"
    connect host "<the machine>" login "<the login>" password "<the
password>"> command "--sloppy-host-authentication --nop --execute='ls'
--execute='exit'"
end tell

to execute ls on the server.
--nop will prevent lsh to spawn a new shell.
--sloppy-host-authentication will bypass the host is unknown dialog.
try --help (i.e. command "--help") for more lsh options.

I don't think that Nifty Telnet SSH is scriptable.

By default, MacSSH will close the window once the connection is
complete.

If you also want to quit MacSSH, you need to wait until the connection
has been made. Try to add 'waiting "yes"' (without single quotes) at
the end of the connect line. Then add quit before end tell to tell
MacSSH to quit.

Deleting the script starts looking suspicious, so you'll have to find
by yourself.

To create an AppleScript, open script editor, enter the script and
then you can run it or check the syntax and finally save it as an
application (an applet). Any double click on this applet in the Finder
will run the script.
Subject: Re: Applescript: Need short program
From: rosalind-ga on 10 Jul 2003 18:40 PDT
 
Thank you -- I will give it a shot!

I am not being suspicious; I'm giving my machine to a friend, and want
to leave an Easter egg. So, any ideas on how to get a self-removing
script?
Subject: Re: Applescript: Need short program
From: haversian-ga on 10 Jul 2003 19:22 PDT
 
I suspect deleting itself is impossible.  After all, the item is "in
use".

You may be able to have 1 script which launches another (the one that
runs SSH), waits until it is done, and deletes it.  That leaves you
one fairly innocuous script rather than a script with a username,
pasword, and list of commands in it.

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy