With a tip from Andre, we solved this problem... it's really pretty neat. Perhaps someone else may need this.

Mac Only

This queries the hardware-network interface and give you and instant response... if the users just unplugs from the network or turns of her airport, with a remote volume mounted... you want to be sure you don't try to interact with the server...otherwise you will get a 2 minute time out waiting before the system gives back the CPU to RunRev....

Do this first: (disclaimer, any code I offer probably could be highly optimized)

function connectionStatus

   put shell("ifconfig") into tStatus

   # Parse for ethernet status
   put lineOffset ("en0:",tStatus) into tTarget
put line ((lineOffset ("Status:",tStatus,tTarget))+tTarget) of tStatus into tEN0status
   set the itemdel to ":"
   if (item -1 of tEN0status) = " active" then
      return "true"
   else
      return "false"
   end if

   # Check Airport-Wireless status
   put lineOffset ("en1:",tStatus) into tTarget
put line ((lineOffset ("Status",tStatus,tTarget))+tTarget) of tStatus into tEN1status
   set the itemdel to ":"
   if item -1of tEN1status = " active" then
      return "true"
   end if
end connectionstatus

Then all other places you need to interact with the server:

command CheckVarunaIsMounted
   if connectionStatus() <> "True" then
answer "You appear to be offline line. Connect to the network by ethernet or airport. Then try again." with "OK"
      exit to top
   else
put URL "file:/Volumes/Varuna/WWW/*Sites/varuna.hindu.org/ping.txt" into gControlFile
      if gControlFile = "true" then
         set the icon of btn "Connected" to 1097
         put "true" into gVarunaMounted
         set the uVarunaMounted of this stack to "true"
      else
         put "false" into gVarunaMounted
         set the uVarunaMounted of this stack to "False"
         set the icon of btn "Connected" to 1098
answer "Varuna is not mounted. Shall I mount it for you?" with "OK"
         mountVaruna
         exit to top
      end if
   end if

end CheckVarunaIsMounted

command Checkin pFileName

   CheckVarunaIsMounted

   if the uVarunaMounted of this stack <> "true" then
answer "Sorry, Varuna is not mounted, you cannot check in files." with "OK"
      exit to top
   end if

# increment revision number; change co to CI; retain user initials; rename local file
   put pFileName into tNewFileName

etc...

end checkIn

Then I always run this every time I set the default folder to the server, when done getting the file listing:

command unTetherStackFromServer
   set the defaultFolder to ($Home&"/Documents/")
end unTetherStackFromServer

and then the user gets no msg saying he can't unmount the volume because it is in use by RunRev.

HTH somebody...


Sivakatirswami



_______________________________________________
use-revolution mailing list
use-revolution@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-revolution

Reply via email to