I have a number of apps that talk to a server over the LAN

I used to always keep this appleScript in a customProp

tell application "Finder"
mount volume "afp://192.142.103.8/Varuna" as user name "MyName" with password "MyPassword"
end tell

and either

hardwire my user name and password to the script or use replacement strings like this:

tell application "Finder"
mount volume "afp://192.142.103.8/Varuna" as user name "###USER###" with password "###PASSWD"
end tell

and then in the UI prompt the user to enter credentials and save those to a preferencs file locally and reload as needed on boot.

I keep a "ping.txt" file on the server to check for connectivity etc.

But, over the years I found that there were way too many scenarios to try to manage from the app. So now I take the "low road" -- ping the remote machine by asking for a file... if I don't get it, then prompt the user "Please mount the remote volume" I still keep the user name and password stored somewhere as there are odd moments when the server still wants authentication, so we can provide that in the background as needed.

 I tried the above appleScript today in Mavericks and it still works.

Perhaps this is of some use to you, Pete:

command checkConnectivity tIP
# typically I will pass an IP for one of our domains on a remote web server
# assumes if user cannot get to the web server, then he's not even connect to the network. # there are other methods, but this one is pretty fail safe... of course if there is an enterprise firewall # preventing access to the outside while user can still see other machines on the LAN, this won't work.

   put  hostAddressToName(tIP) into tServer
   if tServer is Empty then
set the dialogData to "Sorry, there is a connection problem. Turn on airport or make sure your ethernet cable is pluggedin, then try again."
      showStatus
      wait 1 second
      exit to top
   else
      CheckVarunaIsMounted
   end if

end checkConnectivity

command mountVaruna

   set the dialogData to  "Mounting Varuna..."
   showStatus
   put the uAppleScripts of  stack "KA-Media-Player" into tScripts
   set the itemdel to "|"
   do item 1 of tScripts as applescript
   checkVarunaIsMounted

end mountVaruna

command CheckVarunaIsMounted

   repeat ten times
put url "file:/Volumes/Varuna/Sound Projects/Gurudeva Audio in Process/Control-Files/KA-Media-Player_Access-Control.txt" into gControlFile
      if gControFile is not empty then
         loadACL
      else
         send checkVarunaIsMounted to me in 1 second
      end if
   end repeat

   if gControlFile is empty then
      mountVaruna
   end if

end CheckVarunaIsMounted






Swasti Astu, Be Well!
Brahmanathaswami

Kauai's Hindu Monastery
www.HimalayanAcademy.com



Kay C Lan wrote:
Pete, thanks for the shell 'mount' pointer. I didn't get it to work first
try but I'm sure it will be the solution.

_______________________________________________
use-livecode mailing list
[email protected]
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to