Suzuka Posted April 21, 2007 Share Posted April 21, 2007 Im working on a script that will mount or unmount a drive depending on if its mounted or not, so far I have this, tell application "Finder" if exists folder "/Volumes/Advent iPod" = false then diskutil mount "/dev/disk2s3" else if exists folder "/Volumes/Advent iPod" = true then diskutil unmount "/Volumes/Advent iPod" end if end tell however, when I run it, I get a Syntax error Expected “then”, etc. but found “. it then highlights the " in the line if exists folder "/Volumes/Advent iPod" = false then what am I doing wrong, I'm not very experienced in applescripts Link to comment Share on other sites More sharing options...
PascalW Posted April 22, 2007 Share Posted April 22, 2007 Im working on a script that will mount or unmount a drive depending on if its mounted or not, so far I have this, tell application "Finder" if exists folder "/Volumes/Advent iPod" = false then diskutil mount "/dev/disk2s3" else if exists folder "/Volumes/Advent iPod" = true then diskutil unmount "/Volumes/Advent iPod" end if end tell however, when I run it, I get a Syntax error it then highlights the " in the line if exists folder "/Volumes/Advent iPod" = false then what am I doing wrong, I'm not very experienced in applescripts You could try something like: set x to "0" try do shell script "ls '/Volumes/Advent iPod'" on error set x to "1" end try if x = "0" then do shell script "disktool -u disk2s3" else if x = "1" then do shell script "disktool -m disk2s3" end if Just save it as an applescript app and run it. If the ipod is mounted it will unmount it and quit the app, if it is not mounted it will mount it and then quit. Link to comment Share on other sites More sharing options...
A Nonny Moose Posted November 8, 2007 Share Posted November 8, 2007 you shouldn't need the "" in the folder path unless you're trying to treat more than one word as a collective unit. Link to comment Share on other sites More sharing options...
Recommended Posts