HELP! Remote Connect + Ignore Errors

I would like a script that remotely connects to multiple Macs and opens a specific file (actually another script). However, if there are is a Mac that is turned off, I want the script to just ignore it immediately and continue on to the other machines. Here’s my current script:

tell application “Finder” of machine “eppc://user01:111@”
open file “”
end tell
tell application “Finder” of machine “eppc://user02:222@”
open file “”
end tell
tell application “Finder” of machine “eppc://user03:333@”
open file “”
end tell

How do I modify this script such that the sending Mac doesn’t wait for feedback from machines that are off or sleeping but instead forces execution of the file on all machines?


The following addresses your request to ignore the sleepers, and slims the script down by recycling the “tell app - of machine” code.

Hope this helps,

Tested under 10.3.5

--make sure your ip/user/password lists line up
property lisIP : {"", "", ""} --your ip list
property lisUsr : {"usersname", "someone", "someoneelse"} --your user names
property lisPass : {"pass1", "pass2", "pass3"} --your passwords

repeat with x from 1 to count lisIP
	set thisMachine to "eppc://" & (item x of lisUsr) & ":" & (item x of lisPass) & "@" & (item x of lisIP) as string
		tell application "Finder" of machine thisMachine to open file ""
	on error theErr
		log theErr--optionally log the error?
	end try
end repeat

It works…sort of. I logged out and put to sleep the second machine. The script ran the remote script on the first machine but seemed to stall for 1 minute trying to connect to the second machine. After a minute went by the script continued and sent the command properly to machine 3. Is there anyway to get it to continue on immediately on to machine 3 without waiting?

[Here is what we’re trying to accomplish: We have a chat server (running Linux Slackware) that we want to send an alert to multiple Macs that a guest entered one of several rooms. Now the receiving Macs may be:

  1. On and Logged in
  2. On and at login window
  3. On and sleeping
  4. Turned off

The applescript must be able to run and send an alert to all of the employees in the “chat pool” the moment someone enters a room. If a employee is out that day and their computer is off, the script should just ignore it…IMMEDIATELY…and continue alerting the other employees.]

Issuing the eppc call does stall for a bit on ip’s that are not active.

I’m personally not aware of a fast way to determine if your ip’s are available before sending the message. You could use netstat to get a listing of ip’s of users that are currently logged in on the chat server and only send the message to them. But, you’d be omitting those that are at login.

set lisUsers to the paragraphs of (do shell script "netstat -anb -f inet | grep -i established | grep -v")
on error
set lisUsers to {}
end try

Should return something like:

That would be a fairly quick method to getting a list of usable ip’s to send to.

Or, perhaps someone with a little more shell scripting savvy knows of a way to force the eppc command, or some other messaging directive through something that doesn’t have to wait for a reply.

Sorry I couldn’t help more.

We pretty much figured it out. The following appears to ignore any computers that are turned off, sleeping, or otherwise unreachable:

ssh -o ConnectTimeout=2 user01@ /Users/user01/.filename

This line uses ssh from the server to open a hidden text document in the users home folder that contains the following:

open file “”

It works. What would be ideal is if I knew how to bury the destination applescript into a ssh osascript so the server can directly issue the applescript with need of any files. But I haven’t gotten that far.

I’m trying to do something similar, quitting remote applications, but when I use the code to create a machine to log into, it puts up an authentication dialogue, attempting to access the machine “userName” instead of “computerName”.

I’ve tried replacing “computerName” with an IP address with the same result. It works fine with a static string.

Any idea what the problem might be?

set remoteMachine to "eppc://" & userName & ":" & userPassword & "@" & computerName & ".local" as string

tell application "Quicksilver" of machine remoteMachine to quit