I am actually very surprised that I have received 0 responses to this. I 
thought sure that there would be a ton of people that were good with 
Applescript. Oh well, thank you to each of you that read it and tried to figure 
things out.

On Oct 28, 2010, at 9:41 AM, Jason Brown wrote:

> I have a problem that I need some help with. I have an apple script that I 
> compile into an application that checks the server it is attempting to 
> connect to and makes sure the drives stay mapped. I will include the script 
> as well as the tag lines of where I obtained the original script that I 
> modified for my purposes for you to look at. The problem that I am having is 
> that as of 10.5 and 10.6, if a server is rebooted or even if the machine is 
> rebooted, there is a chance that it will create a folder with the servers 
> share name. For example on these machines they mount Vol1, Vol2 and 
> Onevision2 shares. If Vol1 and Vol2 get disconnected which are both on the 
> same server, one or both could be mounted as Vol1-1 and Vol2-1 for example 
> because an empty folder of the name of the share gets deposited in /Volumes. 
> I have an idea of how to correct this, but I am unsure as to how exactly it 
> would be best to implement it into the script. I want it as some form of 
> sanity check before it attempts to mount the drive. Check for the folder and 
> delete it and maybe have it check if the drive is mounted under anything but 
> its real name and then unmount it and let the script re-mount it. The line I 
> am looking at implementing, and I hope I have it right is below.
> 
> ----------
> 
> if (count items) of Vol1 is 0 or ((count items) of Vol1 is 1 and name of item 
> 1 of Vol1 is ".DS_Store") then delete Vol1
> 
> ----------
> 
> I am uncertain how or where to put this into place with the script and the 
> dismount remount commands I am completely unsure of. Any help or insight is 
> greatly appreciated. Thank you in advance. The script is pasted below.
> 
> ----------
> 
> -- Original script courtesy of Jenny Kortina. Found at:
> -- 
> http://theappleblog.com/2008/05/15/hacktackulous-auto-remount-disconnected-shares/
> --
> -- Script Modifications by Jason Brown, The Birmingham News.
> 
> repeat
>       
>       set intnt to do shell script "ping -c 1 10.50.3.221; echo -n"
>       set paras to number of paragraphs in intnt
>       if paras < 5 then
>       else
>               set serverIP to "afp://10.50.3.221/Vol1"
>               set UserAccount to "sysadmin"
>               set ServerPassword to "password"
>               tell application "Finder"
>                       try
>                               if disk "Vol1" exists then
>                               else
>                                       with timeout of 5 seconds
>                                               mount volume serverIP as user 
> name UserAccount with password ServerPassword
>                                       end timeout
>                               end if
>                       end try
>               end tell
>       end if
>       
>       set intnt to do shell script "ping -c 1 10.50.3.221; echo -n"
>       set paras to number of paragraphs in intnt
>       if paras < 5 then
>       else
>               set serverIP to "afp://10.50.3.221/Vol2"
>               set UserAccount to "sysadmin"
>               set ServerPassword to "password"
>               tell application "Finder"
>                       try
>                               if disk "Vol2" exists then
>                               else
>                                       with timeout of 5 seconds
>                                               mount volume serverIP as user 
> name UserAccount with password ServerPassword
>                                       end timeout
>                               end if
>                       end try
>               end tell
>       end if
>       
>       set intnt to do shell script "ping -c 1 10.50.3.8; echo -n"
>       set paras to number of paragraphs in intnt
>       if paras < 5 then
>       else
>               set serverIP to "afp://10.50.3.8/Onevision2"
>               set UserAccount to "sysadmin"
>               set ServerPassword to "password"
>               tell application "Finder"
>                       try
>                               if disk "Onevision2" exists then
>                               else
>                                       with timeout of 5 seconds
>                                               mount volume serverIP as user 
> name UserAccount with password ServerPassword
>                                       end timeout
>                               end if
>                       end try
>               end tell
>       end if
>       
>       delay 10
>       
> end repeat
> 
> -- 
> You received this message because you are a member of G-Group, a group for 
> those using G3, G4, and G5 desktop Macs - with a particular focus on Power 
> Macs.
> The list FAQ is at http://lowendmac.com/lists/g-list.shtml and our netiquette 
> guide is at http://www.lowendmac.com/lists/netiquette.shtml
> To post to this group, send email to [email protected]
> For more options, visit this group at http://groups.google.com/group/g3-5-list

-- 
You received this message because you are a member of G-Group, a group for 
those using G3, G4, and G5 desktop Macs - with a particular focus on Power Macs.
The list FAQ is at http://lowendmac.com/lists/g-list.shtml and our netiquette 
guide is at http://www.lowendmac.com/lists/netiquette.shtml
To post to this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/g3-5-list

Reply via email to