Check to see if volume mounted

I’m trying to use applescript to control and configure popfile via XMLRPC, and I’m having a problem with Apple’s handling of the return value from a call.

popfile returns a list of values for some calls, for example a get_buckets call, to list the different email classification buckets. The XML data is structured so that there are multiple return values not in a framework.

Box1 Box2 ... Box5

When I call a function that provides return values in this format, applescript will only get the value of the first parameter.

Most sites put a inside the first (and only) block and list their values as only one returned parameter.

From perl I can access these multiple return values, but I’m at a loss for how to do it in AppleScript.

Any help would be appreciated.


Don’t know much about XML or POPfile, but perhaps you need the free XML Tools scripting addition from Late Night Software. It might be able to handle your task.

I’m trying to get my script to check to see if a certain volume is mounted when it starts. If the volume isn’t mounted, the script mounts the volume then processes but if the volume is already mounted, the script stops. What am I missing?

set volume_ to “smb://user:password@server/share”
if (list disks) does not contain volume_ then mount volume volume_

Try this - you’ll have to modify it to suit…

property file_destination : alias “Your Volume Name:Destination Folder Name:”

on adding folder items to this_folder after receiving added_items
repeat with thisFile in added_items
tell application “Finder”
set mountedDisks to list disks
if mountedDisks does not contain “Your Volume Name” then
mount volume “afp://your.server.IP.address/Your Volume Name/” as user name “your username” with password “your password”
end if
move thisFile to folder file_destination replacing yes
end tell
end repeat
end adding folder items to

Quite simply, ‘list disks’ will never contain volume_

In your script volume_ is a string containing the URL to a remote server volume.

If you run list disks on its own you’ll see you get a list of strings of disk names, not URLs.

For example, list disks may return:

	"Macintosh HD", 
	"Apple Remote Desktop", 

None of these will ever match the “smb://server/share” URL. Instead you should compare just the share name:

if (list disks) contains "serverVol" then....