I need to be able to choose a cd in Disk Utilility using UI Elements. I know it will always be the 3rd volume but the name will always be different. Here is the code I have tried but has not worked.:x
tell application “Disk Utility”
activate
end tell
tell application “System Events”
tell process “Disk Utility”
tell row of outline of scroll area of window “Disk Utility”
click static text 3
end tell
end tell
end tell
Thanks,
Terry
This begs the question of why you need to do this.
If you’re planning on running a disk check on the selected volume, you can do the exact same thing with:
do shell script "fsck -y " & pathToVolume"
where ‘pathToVolume’ identifies the disk to check.
If you’re planning on reformatting/partitioning the disk, the same thing can be done via do shell script with diskutil.
In other words, almost anything you want to do with Disk Utility can be done more directly via shell scripts, after all, Disk Utility is only a GUI wrapper on the exact same commands, so you’re trying to put an AppleScrript wrapper on top of a GUI wrapper on top of shell commands. Might as well eliminate the middle man.