script o open shares silently...

i am currently using:

-- open all shares
tell application "Finder"
	open location "smb://user:password@machine/shareName"
	open location "smb://user:password@machine/shareName"
	open location "smb://user:password@machine/shareName"
	open location "smb://user:password@machine/shareName"
	open location "smb://user:password@machine/shareName"
end tell

to open all the shares on my network that are used often… The problem is that i end up with 5 open finder windows (one per share) is there anyway to do this silently so the finder windows dont open, yet the shares exist in the normal finder menu???

thanks in advance!

Model: imac, g5
AppleScript: not sure
Browser: Safari 419.3
Operating System: Mac OS X (10.4)


actually it will do to replace open location with mount volume

thanks much! i will try that…

my G5 is asking for “os classic 9” support… imac and laptop working fine…

very odd

I already climbed that mountain. I found that when using “mount volumes” I couldn’t put the login password into the script… so I chose to stick with “open location” for my home network. I found a way to take care of those pesky finder windows too. Maybe you’ll find this script useful, just make your changes in the “variables to change” section.

-- variables to change
set diskNames to {"Movies01", "Movies02", "TV"} -- a list of the disk names you want to mount
set username to "hmcshane" -- username used to log on to the external computer housing the drives
set psswrd to "" -- login password, if you leave blank then you will be prompted for a password
set ipaddress to "" -- login IP address
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
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
				open location ("afp://" & username & ":" & psswrd & "@" & ipaddress & "/" & thisDisk)
				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

-- skip this section unless 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

i was able to get the mount script to work but i had to build it on the g5… basically cut and paste into a new file… Very odd… that is the only non-intel mac we have in the house… when i opened the bad script in the applescript editor on that g5 it looked compiled…

regulus6633 - thanks for taking the time to put up that other script - i will save it for the future…