Mount volume flaky/broken in Tiger?

Is anyone else having issues with the mount volume command in Tiger? The following script works perfectly in Panther (actually, has worked well since 9.0.4 . . .)

 set diskList to (list disks)

if diskList does not contain “Common” then
mount volume “afp://” & useName & “:” & usePass & “@ourserver.domainname/Common”
end if
if diskList does not contain “Output” then
mount volume “afp://” & useName & “:” & usePass & “@ourserver.domainname/Output”
end if

And so forth for the many volumes my editors mount from our XServe. 

In Tiger, the results are extremely flaky. Usually, the first referenced volume will mount, but the next volumes in the list don’t. When I wrap the mount volume command in a try statement, I get the following returned as the error message and number:
“Disk some object wasn’t found” -35 Hence, the volumes aren’t being found for some bizarre reason. I’ve checked network connectivity, so that’s not the issue.
Even more strange: Sometimes all of the volumes mount perfectly. There seems no rhyme or reason or pattern to this. However, usually the script fails to mount all of the volumes.
Anyone have thoughts/workarounds on this?

Model: Dual 1.8 G5
AppleScript: 1.10
Browser: Safari 312
Operating System: Mac OS X (10.4)

I can confirm this behaviour in Tiger when trying to mount multiple disks. Sometimes it works, sometimes not. But the following seems to work. Ignoring error number -35 forgives disks that aren’t ready to mount immediately, but catches disk names that are totally fictitious.

set diskNames to {"Common", "Output"} -- etc.

repeat with i from 1 to (count diskNames)
  set thisDiskName to item i of diskNames
  repeat until ((list disks) contains thisDiskName)
      mount volume ("afp://" & useName & ":" & usePass & "@ourserver.domainname/" & thisDiskName)
    on error number n
      if (n is not -35) then exit repeat
    end try
  end repeat
end repeat

With fictitious names, ‘mount volume’ appears to act anomalously in the ‘try’ block. It displays an error message anyway, and then throws error number -128 (‘User canceled.’) for ‘try’ to catch. However, the script works more stably without fictitious names! :wink:

Thanks for the reply, Nigel! I’ve been having a lot of trouble mounting my network volumes since updating to Tiger!

One thing I noticed with the script is that I get some of my afp: volumes mounting, then immediately unmounting (per the log and the flashing disk icon on the desktop). I added a really short delay to the repeat block (delay .2) which seems to stop the incessant flashing, but it still mounts/unmounts/mounts each drive.

I have a bunch of afp Mac drives (on Windows 2003 servers) and one CIFS (Samba) drive. The script checks the ‘cifs’ server in case it’s unavailable, but doesn’t check the afp server.

I still occassionally get an AS error, “Disk some disk not found” that the try block can’t catch.

I hope this script helps others running into Tiger’s mounting difficulties.

property volumesToMount : {"afp://10.xx.xx.xx/ALLMACS", "afp://10.xx.xx.xx/DEPTMAC", ¬
	"afp://10.xx.xx.xx/DEPT1", "afp://10.xx.xx.xx/DEPT2", ¬
	"afp://10.xx.xx.xx/UTIL", "cifs://10.xx.xx.yyyyyy/ZDRIVE"}
set diskNames to {"ALLMACS", "DEPTMAC", "DEPT1", "DEPT2", "UTIL", "ZDRIVE"}
property myUserName : "000yyyyyxxxx"

repeat with thisVolume in volumesToMount
	set AppleScript's text item delimiters to "/"
	set shortDiskText to last text item of thisVolume
	set AppleScript's text item delimiters to "" -- Restore the original delimiters
	--	display dialog shortDiskText
	if ((list disks) does not contain shortDiskText) then
	end if
end repeat

list disks

on mountTry(thisVolume)
	set server_Off to "Server Not Available."
	set server_On to "Server Mounted."
	set server_AlreadyOn to "Server Already On"
	set cifsServer to "10.xx.xx.xx" -- SRVCIFS.MYCOMPANY.COM
	set ping_result to (do shell script "ping -c 1 " & cifsServer)
	if "100% packet loss" is in ping_result then
		display dialog (server_Off & return & cifsServer) buttons "OK" default button 1 with icon 2
		error number -128 --user cancelled
	end if
		mount volume (thisVolume) as user name myUserName
		display dialog (server_On & return & thisVolume) buttons "OK" default button 1 with icon 2 giving up after 5
	on error number -55
		display dialog (server_AlreadyOn & return & thisVolume) buttons "OK" default button 1 with icon 2 giving up after 5
		error number -128 -- user cancelled
	end try
	delay 0.2
end mountTry