I am trying to connect with a remote machine (that may or may not be available), but for some reason the timeout does not work.
Does anyone have a clue why not…?
set theMach to ("eppc://myname:" & passWord & "@" & "192.168.1.3") as string
using terms from application "System Events"
with timeout of 7 seconds
try
tell application "System Events" of machine theMach
set procnamez to name of the application processes
set eyetvApp to (name of every process whose name is "EyeTV") as string
end tell
on error
set procnamez to ""
end try
end timeout
end using terms from
Hi Eelco,
System Events doesn’t run in every case on the remote machine,
it’s better to use the Finder instead (process is a part of the Finder’s dictionary, but not documented)
Note: the result of your first line is a string anyway, so no coercion is needed
Hi Stefan,
Thanks!
You’re right, but the issue is merely that I CAN handle a (non-existing) process issue on a remote machine,
but I can’t handle a call to a non-existent machine (IP not found on the network or machine down…)
This may relate to the well-known bug in OSX where the Finder/system hang if a sever incidentally goes down,
with the painstaking pizza cursor along…
Here is a little routine to determine the available file servers and their IP addresses
tell application "System Events" to set servers to name of disk items of disk "Network" whose its file type is "slua"
set serverIPs to {}
repeat with i in servers
set theIP to do shell script "arp -n " & i & ".local | cut -f 2 -d '(' | cut -f 1 -d ')'"
if theIP is "" then
set end of serverIPs to "not available"
else
set end of serverIPs to {contents of i, theIP}
end if
end repeat
serverIPs -- list of {file server, IP}
Hi Stafan,
Thanks, this is quite similar to what I do
set IPs to paragraphs of (do shell script "arp -a | awk '{print $2}' | tr -d '()'")
and then relating these IP’s to a known config file (all of my IP’s are fixed).
The quirky thing comes in when machines go to sleep, get unplugged or leave the office.
This can be prevented by your check, but that takes quite some time.
As I learne somewhere, Leopard will solve the issue…