Re: Mounting volumes
Re: Mounting volumes
- Subject: Re: Mounting volumes
- From: Neil Laubenthal <email@hidden>
- Date: Tue, 13 Nov 2007 19:34:39 -0500
On Nov 13, 2007, at 15:21, Cliff Nowack wrote:
I have a script that needs to mount server volumes.
I used to use the mount volume syntax but it has issues with mounting
multiple volumes in the same script. Somebody pointed me to this
script. It could be modified to read the input file. The Open Location
command works correctly but opens a Finder Window . . the script keeps
track and then closes the windows.
-- variables to change
set diskNames to {"Volume1", "Volume2"} -- a list of the names of the
disks you want to mount
set ipaddress to "1.2.3.4" -- IP address of the computer where the
disks are attached
set username to "username" -- username used to log on to the external
computer housing the drives
set psswrd to "password" -- login password, if you leave blank then
you will be prompted for a password
set myDelay to 1
-- variables not to change
set numberDisks to count of diskNames
set numberMounted to 0
set diskList to {}
set finaldisk to {}
-- mount external hard drives, this will check to see if a drive is
already mounted when the script is run
delay 5
tell application "Finder"
repeat with i from 1 to numberDisks
set thisDisk to item i of diskNames
if not (exists disk thisDisk) then -- check to see if the drive in
the list is already mounted
try
open location ("afp://" & username & ":" & psswrd & "@" &
ipaddress & "/" & thisDisk) -- or mount volume which doesn't allow
passwords
set numberMounted to numberMounted + 1 -- keep a counter of the
number of drives mounted
set diskList to diskList & thisDisk -- make a list of the drives
mounted
end try
end if
end repeat
end tell
-- this section is only executed if some drives are mounted
if not numberMounted = 0 then
-- delay until the drives mount
set finaldisk to item numberMounted of diskList
repeat until (list disks) contains finaldisk
end repeat
delay myDelay
-- close finder windows opened by the mounting drives
tell application "Finder"
repeat with i from 1 to numberMounted
if Finder window 1 exists then close Finder window 1
end repeat
end tell
end if
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden