Re: Newbie wants to move drive icons
Re: Newbie wants to move drive icons
- Subject: Re: Newbie wants to move drive icons
- From: "Marc K. Myers" <email@hidden>
- Date: Wed, 24 Jan 2001 00:43:23 -0500
- Organization: [very little]
Dale Saukerson wrote:
>
Date: Tue, 23 Jan 2001 19:43:47 -0600
>
To: email@hidden
>
From: Dale Saukerson <email@hidden>
>
Subject: Newbie wants to move drive icons
>
>
I'm new to this list and still at the Kindergarten level of
>
AppleScript scripting knowledge.....I'm comfortable with FileMaker
>
and QuicKeys scripting.
>
>
I'm writing a script to do some desktop volume icon positioning at
>
startup--I can move fixed volume icons just fine, but I run in to
>
trouble trying to move removable drive icons like an Audio CD mounted
>
via the built in DVD player.
>
>
My trouble is I don't have a reliable way to first test to see if an
>
Audio CD icon is available before commanding it to move.
>
Another weakness of my script is I that depend upon a fixed name
>
(Audio CD 1). This works fine at startup when any mounted CD is named
>
Audio CD 1 but not later on after I've popped a few CDs in and out
>
and the get their consecutive numbering (Audio CD 1, Audio CD 2, etc).
>
>
I've used the AudioCDgh addition for a few years now, but it
>
apparently is not entirely compatible with a DVD drive. If the drive
>
is empty (regardless if a disc was ejected or never inserted) the
>
drive is reported a stopped rather then offline. So I can not use it
>
to properly test to see if the drive is empty.
>
>
I've been to MacScripter.net, but I haven't found any additions to
>
help me determine simply if the drive is empty or full.
>
I have the book "The Tao of AppleScript".
>
>
Here is my elementary script
>
>
tell application "Finder"
>
activate
>
select disk "Audio CD 1"
>
set position of selection to {80, 711}
>
end tell
>
>
This script of course fails if the drive is empty or the mounted
>
volume name does not match.
>
>
Questions:
>
1-Is there a way to halt a script if *any* error occurs rather than
>
trapping for specific errors?
>
This would be quickest for me but not conducive to learning
>
more fundamental concepts.
>
2-How can I determine if the DVD drive is empty or full?
>
3-How can I look for a variable CD name as opposed to a known fixed name?
>
4-Can I use a wildcard for the last character when referring to a volume name?
>
5-Could you make this work for *any* disc mounted in the drive (like
>
a DVD or Photo disc rather that an Audio CD?
>
>
Please help educate me! My forehead has been banging on the keyboard
>
a lot lately....The only book I own is the Tao of AppleScript.
tell application "Finder"
set theCD to ""
try
set theCD to some disk whose ((ejectable is true) and [optn-L]
(name starts with "Audio"))
on error
end try
if theCD is not "" then
[execute your code to move it]
end if
end tell
This should answer questions #1 ===> #4. I don't know how to test for
an ejectable volume in a particular drive, but if you know that there
would be only one ejectable drive you could leave out the name test altogether.
Marc K. Myers <email@hidden>
http://AppleScriptsToGo.com
4020 W.220th St.
Fairview Park, OH 44126
(440) 331-1074
[1/24/01 12:39:49 AM]