Re: Calling Apple Script Experts

2010-11-01 Thread Jason Brown
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 

Re: Calling Apple Script Experts

2010-11-01 Thread glen




- Original Message 
 From: Jason Brown jason_brown1...@att.net

 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. 

The only help I can suggest is to find an Applescript group. Maybe someone on 
list can suggest a good one. I know they exist from my experience in the 
graphic 
arts industry. I remember posts for needs of scripts for a specific needs and 
know there is a great group or two out there that can help. I don't remember 
the 
name of the group(s).  Search? --glen


  

-- 
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 g3-5-list@googlegroups.com
For more options, visit this group at http://groups.google.com/group/g3-5-list


Re: Calling Apple Script Experts

2010-11-01 Thread Doug McNutt
At 15:39 -0700 11/1/10, glen wrote:
- Original Message 
 From: Jason Brown jason_brown1...@att.net
 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. 

The only help I can suggest is to find an Applescript group. Maybe someone on 
list can suggest a good one. I know they exist from my experience in the 
graphic 
arts industry. I remember posts for needs of scripts for a specific needs and 
know there is a great group or two out there that can help. I don't remember 
the 
name of the group(s).  Search? --glen
***

List-Post: mailto:applescript-us...@lists.apple.com
List-Help: mailto:applescript-users-requ...@lists.apple.com?subject=help
List-Subscribe: http://lists.apple.com/mailman/listinfo/applescript-users, 
mailto:applescript-users-requ...@lists.apple.com?subject=subscribe

These folks are quite helpful, especially Apple's Chris Nebel.

Be sure you provide the version of AppleScript you want, or are required, to 
use. The details change with every OS release. It also helps to show what you 
have tried.

-- 

Applescript syntax is like English spelling:
Roughly, though not thoroughly, thought through.

-- 
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 g3-5-list@googlegroups.com
For more options, visit this group at http://groups.google.com/group/g3-5-list


Calling Apple Script Experts

2010-10-28 Thread Jason Brown
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 g3-5-list@googlegroups.com
For more options, visit this group at http://groups.google.com/group/g3-5-list