Jocke Bohlin Posted November 1, 2006 Share Posted November 1, 2006 Hello I want to unmount my network volume "Backup-disc" with an applescript. I´m running OS9.2 Why does not this work: tell application "Finder" if disk "Backup-disc" exists then eject "Backup-disc" end tell The result is syntaxerror "Expected "Else" but found "End Tell"." //Jocke Link to comment Share on other sites More sharing options...
Infamous Posted November 1, 2006 Share Posted November 1, 2006 you did not specify what do do if backup-disc doesnt exist that's why you need to put _else_ there Link to comment Share on other sites More sharing options...
McSkywalker Posted November 1, 2006 Share Posted November 1, 2006 The eject command refers to CD's in mac OS 9, I think. Instead, try this script: tell application "Finder" if disk "Backup-disc" exists then move disk "Backup-disc" to trash end if end tell It ejects the volume, but finder prompts you whether you want to eject it or not. I just tested this script on my good old iMac G3, under mac OS 9 and it works. The help for script editor was better in 8.5 or 8.6, as far as I remember.. Link to comment Share on other sites More sharing options...
A Nonny Moose Posted November 1, 2006 Share Posted November 1, 2006 Unfortunately, you can't GUI script, so the if/then scenario works out the best Link to comment Share on other sites More sharing options...
McSkywalker Posted November 1, 2006 Share Posted November 1, 2006 Unfortunately, you can't GUI script, so the if/then scenario works out the best Do you have a better thing to eject volumes? I would really like to do it without the finder prompt. Link to comment Share on other sites More sharing options...
A Nonny Moose Posted November 2, 2006 Share Posted November 2, 2006 In OS X you can script the GUI using System Events. You can go to the Applescript forum here and find a tutorial on how to do it. I don't think it will work in the Classic OS though. Link to comment Share on other sites More sharing options...
McSkywalker Posted November 2, 2006 Share Posted November 2, 2006 Ok, thank you. I haven't been using applescript for a while, and've forgotten quite a lot. Not unrecoverable, anyway Link to comment Share on other sites More sharing options...
Recommended Posts