Re: When did Remote Access Commands get depreciated?
Re: When did Remote Access Commands get depreciated?
- Subject: Re: When did Remote Access Commands get depreciated?
- From: Emmett Gray <email@hidden>
- Date: Sun, 8 Apr 2001 12:40:26 -0400
I discovered another little NSS problem: NSS tell blocks do not wait
for a connection to complete (I guess this is part of the "status"
bug - how does it know if there's a connection if it can't get the
status). So, if you are trying to log on to a server, the logon part
of your script will occur immediately, even before a dial tone.
With the help of others who have contributed on this topic here and
also on the Macscript list and privately, I've finally devised a
working NSS connection/Fetch FTP logoon script, and am offering it
FWIW.
--Emmett
set PPPalready to false -- optional, for making a log-off decision later
set ipAddress to checkIPAddr()
if ipAddress is not "0.0.0.0" then
set PPPalready to true
else
try
tell application "Network Setup Scripting"
open database
set the current_config to (first Remote Access configuration whose
active is true)
connect current_config
close database
end tell
on error
try
tell application "Network Setup Scripting" to close database
end try
end try
set firstLoop to true
repeat 40 times
set ipAddress to checkIPAddr()
if not firstLoop then -- no point in checking while dialing
try
tell application "Fetch"
open remote directory ("
ftp://myName:myPass@myServer/")
end tell
end try
if ipAddress is "0.0.0.0" then
delay 1
else
exit repeat
end if
else
delay 10
set firstLoop to false
end if
end repeat
if ipAddress is not "0.0.0.0" then
tell application "Fetch"
open remote directory ("
ftp://myName:myPass@myServer/")
end tell
else
error "Unable to log on to FTP server: PPP connection failure."
end if
end if
on checkIPAddr()
set ipAddress to "0.0.0.0"
with timeout of 2 seconds
try
tell application "Network Setup Scripting"
open database
set ipAddress to IP address of (first TCPIP v4 configuration
whose active is true)
end tell
end try
try
tell application "Network Setup Scripting" to close database
end try
end timeout
return ipAddress
end checkIPAddr