Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Applescript to erase CDRWs

Applescript to erase CDRWs
Thread Tools
xmacintosh
Dedicated MacNNer
Join Date: Dec 2001
Status: Offline
Reply With Quote
May 26, 2002, 10:19 AM
 
Hi

I found an applescript to erase CDRWs at MACOSXHINTS.COM, but when I paste the code into Script Editor I have a lot of erros. Can someone help me to create this application? I need it so much.

The Code:

(*
Erase ReWritable Media
Calls'hdiutil burn -erase' to erase rewritable media
without the terminal or Disk Utility
*)

beep
display dialog "Erase a rewritable disc?" buttons {"Cancel", "Yes"}
default button "Cancel" with icon note
set the user_choice to the button returned of the result
if the user_choice is "Yes" then

display dialog "Are you sure you want to erase a disc?" & return & return &
"You cannot undo this action." buttons {"Cancel", "OK"} default button "Cancel" with icon alert
set the user_choice to the button returned of the result

if the user_choice is "OK" then
display dialog "Press OK and insert your disc. It may take several minutes to erase your disc."
do shell script "hdiutil burn -erase"
display dialog "Your disc has been erased." buttons {"�"} default button 1 giving up after 10
end if

end if
     
Mactoid
Grizzled Veteran
Join Date: Sep 2000
Location: Springfield, MA
Status: Offline
Reply With Quote
May 26, 2002, 01:23 PM
 
</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">quote:</font><hr /><font size="1" face="Geneva, Verdana, Arial, sans-serif">Originally posted by xmacintosh:
<strong>Hi

I found an applescript to erase CDRWs at MACOSXHINTS.COM, but when I paste the code into Script Editor I have a lot of erros. Can someone help me to create this application? I need it so much.</strong></font><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">The code was ok, there were just two line breaks where there weren't supposed to be (I hate languages that are white-space dependent )

Anyway, here is how it should be.

</font><blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">code:</font><hr /><pre style="font-size:x-small; font-family: monospace;">(*
Erase ReWritable Media
Calls'hdiutil burn -erase' to erase rewritable media
without the terminal or Disk Utility
*)

beep
display dialog &quot;Erase a rewritable disc?&quot; buttons {&quot;Cancel&quot;, &quot;Yes&quot;} default button &quot;Cancel&quot; with icon note
set the user_choice to the button returned of the result
if the user_choice is &quot;Yes&quot; then

display dialog &quot;Are you sure you want to erase a disc?&quot; &amp; return &amp; return &amp; &quot;You cannot undo this action.&quot; buttons {&quot;Cancel&quot;, &quot;OK&quot;} default button &quot;Cancel&quot; with icon alert
set the user_choice to the button returned of the result

if the user_choice is &quot;OK&quot; then
display dialog &quot;Press OK and insert your disc. It may take several minutes to erase your disc.&quot;
do shell script &quot;hdiutil burn -erase&quot;
display dialog &quot;Your disc has been erased.&quot; buttons {&quot;�&quot;} default button 1 giving up after 10
end if

end if</pre><hr /></blockquote><font size="1" face="Geneva, Verdana, Arial, sans-serif">Note: If you want to break up a long line in the editor, you can do it. You have to go to where you want to break up the line and press option-return. This will make a new line, and have a little arrow character at the end of the old line. You need that arrow character to avoid any compiler errors.
We hope your rules and wisdom choke you / Now we are one in everlasting peace
-- Radiohead, Exit Music (for a film)
     
   
Thread Tools
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 11:19 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,