I have searched the archives but I can’t seem to find a definitive script to burn a CD.
The workflow I want is
Choose folder
get name of folder
choose cd writer (I have 2 in my intel)
open tray
on close tray automatically name cd with name of folder
burn
eject
I can do all the choose folder and get name stuff but I am stumped on the rest. I have tried automator but its not behaving.
I feel a bit of a leech 'cause I haven’t helped anyone else recently (sorry, been busy) but would be really grateful for any help on this.
Model: 1 G5 dual, 1 MacPro, Intel Imac, powerbook…
AppleScript: Version 2.1.1 (81)
Browser: Safari 412.2
Operating System: Mac OS X (10.4)
do you have Toast Titanium, it’s quite easy to do it with Toast
Selecting a recorder works unfortunately only with GUI scripting, but it works
activate application "Toast Titanium"
tell application "System Events"
tell application process "Toast Titanium"
click menu item 7 of menu 1 of menu bar item 5 of menu bar 1
tell window 1
repeat until sheet 1 exists
delay 0.5
end repeat
tell pop up button 2 of group 1 of tab group 1 of sheet 1
click
delay 0.5
pick menu item 2 of menus -- choose the item of your recorder
end tell
delay 0.5
click button "OK" of sheet 1
end tell
end tell
end tell
For burning a folder use something like this
on run
set theseFiles to choose folder with prompt "Choose folder to write on disk" without invisibles
toast(theseFiles as list)
end run
on open theseFiles
toast(theseFiles)
end open
on toast(theseFiles)
try
set {folder:fFolder, name:fName} to (info for 1st item of theseFiles)
if fFolder then
tell application "Finder"
try
set theseItems to items of 1st item of theseFiles as alias list
on error
set theseItems to items of 1st item of theseFiles as alias
end try
end tell
tell application "Toast Titanium"
activate
set newDisk to make new Data disc with properties {name:fName, file system type:Mac OS Extended}
add to newDisk items theseItems
write newDisk
end tell
end if
end try
end toast
I use do shell script "hdiutil create -srcfolder " etc to create disk images in the man pages there are options on test, burn & verify. Too complex for me to tackle but may provide an option not sure?
Well I have managed to cobble together something that works. The script allows you to choose a folder, burn then delete.
I have 2 CD writers in my mac and I would like to specify which one to write to so I can use both at the same time. I am sure this can be done through the hdiutil command but I am no good at the command line stuff. Any help there would be appreciated.
(*"Based on Burn CD ROM Script Script by Econ Technologies, Inc."
*)
-- Path to my destination folder...the folder I want copied to a CD
set myFolderName to choose folder
-- Name of the DMG that will be created prior to burning to CD
set docName to name of (info for myFolderName)
display dialog "Making CD ROM from folder: " & myFolderName
-- Verify folder exists through finder
tell application "Finder"
set workingFolder to folder myFolderName
if exists workingFolder then
set folderStatus to true
set folderSize to size of (info for myFolderName)
-- set folderPath to quoted form of POSIX path of myFolderName
set folderPath to POSIX path of (workingFolder as alias)
else
set folderStatus to false
end if
end tell
-- Create the CD
if folderStatus is equal to true then
set dataSize to ((folderSize / 1024) / 1024)
if dataSize > 640.0 then
display dialog "The size of the folder, " & dataSize & " MB, is larger than a typical writable CD." & return & "Do you wanto to continue?"
end if
-- Execute shell command to create intermediate DMG
do shell script "cd ~; hdiutil create -srcfolder " & quoted form of folderPath & " " & quoted form of docName
-- Execute shell command to burn DMG
do shell script "drutil -drive 1 tray open"
display dialog "Insert CD"
do shell script "drutil -drive 1 tray close"
do shell script "cd ~; hdiutil burn " & quoted form of docName & ".dmg"
-- Delete DMG
do shell script "cd ~; rm -f " & quoted form of docName & ".dmg"
display dialog "CD Complete. Would you like to delete folder " & docName & "?" buttons {"Not Now", "Delete"} default button 2
if the button returned of the result is "Delete" then
tell application "Finder"
delete myFolderName
end tell
end if
end if