--This little application connects Mac users to their network drives using the correct protocol (after initial config). By default, the correct protocol depends on what your IP address is, so it will require customization for your environment. I took this and saved it as an Application Bundle based on the configuration in my location. This will obviously be different based on deployment area. This will probably be mostly for Technical Support people. --This was made to be included in the spring 2006 deployment package by Michael Wyant Jr. It was completed March 30, 2006. global enfilter set enfilter to "" --Get IP address from ipconfig; if it is not blank then it continues on to LAN() try do shell script "ipconfig getifaddr en0 > /tmp/ifaddren0.tmp" do shell script "cat /tmp/ifaddren0.tmp" set ifaddren0 to result if ifaddren0 is not equal to enfilter then LAN() end if --ipconfig will error if there is no ethernet connected so the error will prompt a message and then point to the wireless() on error errMsg display dialog "There is no wired ethernet - trying wireless..." buttons {"OK"} default button 1 giving up after 1 wireless() end try on LAN() try do shell script "cat /tmp/ifaddren0.tmp | grep 111.111.111 > /tmp/ifaddren0-1.tmp" -- expand the IP out based on your network; i.e. class B, C, etc. LAN2() on error errMsg LAN2() end try end LAN on LAN2() do shell script "cat /tmp/ifaddren0-1.tmp" set en0filter to result do shell script "rm -rf /tmp/ifaddren0.tmp" do shell script "rm -rf /tmp/ifaddren0-1.tmp" try if en0filter is equal to enfilter then --display dialog "Please type in your username and password at the prompt." with icon note buttons {"OK"} default button 1 giving up after 2 tell application "Finder" open location "afp://server.domain.com/" end tell delay 5 else --display dialog "Please type in your username and password at the prompt." with icon note buttons {"OK"} default button 1 giving up after 2 tell application "Finder" mount volume "smb://server.domain.com/homes" end tell delay 5 end if on error errMsg display dialog "There was a problem connecting to your U drive. You may already have your U drive mapped. If not, please check network settings; i.e. Firewall, connectivity, and try again." buttons {"OK"} default button 1 giving up after 3 quit me end try success() end LAN2 --Get IP address from ipconfig; if it is not blank then it continues on to wireless2(). If it is blank, then it will go to noconnection() on wireless() try do shell script "ipconfig getifaddr en1 > /tmp/ifaddren1.tmp" do shell script "cat /tmp/ifaddren1.tmp" set ifadden1 to result if ifadden1 is equal to enfilter then noconnection() else wireless2() end if on error errMsg noconnection() end try end wireless on wireless2() try do shell script "cat /tmp/ifaddren1.tmp | grep 111.111.111 > /tmp/ifaddren1-1.tmp" -- expand the IP out based on your network; i.e. class B, C, etc. wireless3() on error errMsg wireless3() end try end wireless2 on wireless3() do shell script "cat /tmp/ifaddren1-1.tmp" set en1filter to the result do shell script "rm -rf /tmp/ifaddren1.tmp" do shell script "rm -rf /tmp/ifaddren1-1.tmp" if en1filter is equal to enfilter then tell application "Finder" open location "afp://server.domain.com/" end tell --display dialog "If prompted, please type in your username and password." with icon note buttons {"OK"} default button 1 giving up after 2 delay 5 else tell application "Finder" mount volume "smb://server.domain.com/homes" end tell end if success() end wireless3 on success() quit me --display dialog "You are connected!" with icon note buttons {"OK"} default button 1 giving up after 1 end success on noconnection() display dialog "Please check your network connection and try again." with icon note buttons {"OK"} default button 1 giving up after 3 end noconnection