is there an applescript equivalent to Unix remote shell?

Is it possible for a script on one server to start the execution of a script on another server (like a Unix rsh)? TIA.

There are several things you can do, some of which may meet your need.
First of all, I wouldn’t try any of these things unless you were running OSX. I haven’t had good luck using OS9 for these things.

First, here is a primer that I found right here on Macscripter
It utilizes ssh and osascript to create and run scripts on remote machines.

Secondly, you can do Applescript over IP, and actually script the remote machines. For OSX, you must have “allow remote apple events” checked in the sharing tab. In OS9, it is a little more involved, I can’t remember the specifics.

Third, and this is an extension of the Applescript over IP method. Applescript the Finder to run a preexisting script. This doesn’t launch an applescript application, it just runs the script kind of in the finder itself. I don’t the technical terms to explain it. You could set up a script on the machine, and then “tell application “Finder” of machine blahblahblah”
to “run script file blahblah”

Fourth and last that I know of. I have a method of utilizing several scripts on my blog that may also be of interest.
This example uses 3 scripts running in conjuction. one is a local script that sends events. one is a remote script that listens for events, and then tells the third script what to do.

hope this helps

Thanks for the reply. I’ll look at that once I get my main script working. I think the 3rd option is what I need (I’m not running OS 9 although I do have an applicaton running under Classic that I have to deal with yet).

One solution is to rsh to the remote machine (perhaps via an AppleScript do shell scrip command), and use osascript on the remote machine to invoke an AppleScript there.

Note: For security reasons i’d use ssh rather than rsh, however.

I am now trying to run applescript over IP. Is there something that needs to be set in the applescript editor? When I try to do the following:

tell application "Finder" of machine ""

The editor strips off everything after “Finder”.

After a bit of searching I found that the correct syntax requires “eppc://” as teh machine name thus:

tell application "Finder" of machine "eppc://"

However, now syntax checking fails because it “Can’t get the applications’s event dictionary.” I suspect the real problem is still with my syntax because, although the userid and password are correct, I get a prompt for them with a “bad username or password” error. When I type in the authentication, I then get the above error whether the authentication is valid or not. It appears it doesn’t matter what the authentication is, it cannot connect.

Does anyone have any experience with this that can help? TIA

Have you tried using the IP address of the other machine?

tell application "Finder" of machine "eppc://userid:password@" to say Hi!"

Replace with your machines IP address.

I did now. It didn’t seem to matter.

In playing around with it I did notice that the editor likes to rewrite my syntax under certain circumstances. If I start using variables I get different results. In this case I get by syntax checking but running the script gives an error message about not understanding the “say” message. However, the application string, to me, seems all messed up. I have no idea what is going on or what this is supposed to really look like.
Here is what I typed:

set server_part to "username:password@"
tell application "Finder" of machine "eppc://" & server_part to say "Hi!"

Here is what the editor changes it to:

set server_part to "username:password@"
tell application"eppc://Finder" & server_part to say "Hi!"

It also should be noted that it does not like an “end tell” after this statement.

Your syntax is bad.

set x to "eppc://name:password@"
tell application "Finder" of machine x to say "Hi!"

Also, check the IP address of the target machine in the Network Prefernce pane. sounds like you are assigning the IP’s yourself. It should start with 254 if I recall correctly – not sure though. If your behind a router it should start with 192.168. xx.xx

That helps but only a little or at least the editor is not rewriting my syntax (I’m still puzzled why an ‘end tell’ is an error). I’m now getting an authentication failure error. Before you ask, yes, I’m sure the username and password are correct. :slight_smile:

P.S. The IP I posted is made up. I didn’t want to publish my real IP on a public forum.

Smart move, my IP is faked also. When you tell application “XYZ” to do something using the keyword ‘to’ in a one line script, it doesn’t need the “end tell” to terminate the script because it’s not in a “tell block”. example

is equivalent to

Thanks, that clears up my “tell” block confusion. Unfortunately the main problem still exists. Any further suggestions?

Is Personal File Sharing turned on in the Sharing Preferences pane of both machines?

No, just remote apple events.

Well then turn it on!!!

I did. :slight_smile:

I am a little concerned about security but I tried it to see if that matters. It appears that it does not.

Is it possible that you have a firewall that’s interfering?

– Rob

It might be a problem when I implement this script on production but for testing purposes, both machines are currently on the same wire. I should also note I can connect to the machines either way, using the same name and password.

Are there no tools to trace this on the “remote” machine?

I don’t know but I’m not aware of anything.

– Rob

While searching around I found an example that used a different syntax. Clutching at straws, I got a different result:

set server_part to "userid:password@"
set client_machine to "eppc://" & server_part
set script_name to "AIM Web Server:Users:webstar:Documents:Aim Operations:Stop 4D Print Client"
tell application script_name of machine client_machine to run

This gets the error, “Cannot find process on host.” It is referring to the string script_name. This might mean something to an expert, although I’m still clueless. I’m guessing that for some reason it is looking on the local host for this file rather then the remote.