Burning a disc of files from within Rev

Thomas J McGrath III 3mcgrath at adelphia.net
Mon Jan 19 22:00:53 EST 2004


Barry,

I too, apologize. It sounded very '' I don't know, pushy  or something  
to me.

Actually the answer is very difficult. You will need to understand the  
command line and how to implement it then you can look into a solution  
from within REV.

Here is some info on hdiutil burn from the command line.

Here is how to create a 100MB drive image, backup data to it, and then  
burn it onto a CD (directly in the commandline, with only the built-in  
tools). One possible application: This could be easily modified and  
incorporated into a script that will backup your Entourage mail  
databases every week, good for up to six uses (6x100MB) depending on  
the size of your mail data...

hdiutil create -fs HFS+ -volname Backup -size 100m ~/Desktop/backup.dmg
hdiutil mount ~/Desktop/backup.dmg
ditto -rsrc -V ~/Desktop/datatobackup /Volumes/Backup >>  
/Volumes/Backup/backup.log
hdiutil unmount /Volumes/Backup
hdiutil burn ~/Desktop/backup.dmg -noverifyburn -noeject


It will prompt you for a disc, insert one and it will burn your disc:


Code:
------------------------------------------------------------------------

Please insert a disc:
Starting
Initializing
Saving temporary image
Opening session
Writing track
........................................................................ 
....
Finishing writing
........................................................................ 
....
------------------------------------------------------------------------

OR here is another example of the Burn usage in  
applescript.......................................

Here is a script to backup the Entourage mail database to a CD. I have  
mine as a cron task that runs every Friday before I leave work.
The CD tray opens at the set time as if to say "Feed me"!
Simply insert a CD and off it goes! Ahh, the power of Mac OS X.

Please note that this script requires fileutils to be installed. The -h  
in du -sh is for Human readable, meaning it will return the results in  
megabytes.
A pre-compiled binary can be obtained here:
http://homepage.mac.com/rgriff/file.html
or fink install fileutils works for those with using the fink pagackage  
manager.


Code:
------------------------------------------------------------------------
#!/bin/sh
#This script will backup your Entourage mail database to a CD

username="`who | fgrep console | awk '{ print $1 }'`"
if [ "$username" = "" ]; then
     echo "No one logged in via GUI (console)" >&2
     exit 1
fi
userhome="`eval echo ~$username`"date=`date +%Y.%m.%d`
size=`/usr/local/bin/du -sh "/Users/$username/Documents/Microsoft User  
Data" | awk ' { print $1 } '`

#Quit Entourage and give it time to write its database to disk
/usr/bin/osascript -l AppleScript -e 'tell Application "Microsoft  
Entourage" to quit'
/bin/sleep 4

/usr/bin/hdiutil create -fs HFS+ -volname Backup-$date -size $size  
/Users/$username/Desktop/backup.dmg
/usr/bin/hdiutil mount $userhome/Desktop/backup.dmg
/usr/sbin/disktool -r
echo $date >> /Volumes/Backup-$date/backup.log
/usr/bin/ditto -rsrc -V "$userhome/Documents/Microsoft User Data/Office  
X Identities/Main Identity/" /Volumes/Backup-$date/ >>  
/Volumes/Backup-$date/backup.log
/usr/bin/hdiutil unmount /Volumes/Backup-$date
/usr/bin/hdiutil burn "$userhome/Desktop/backup.dmg" -noverifyburn  
-noeject

#Clean up and relaunch Entourage
/bin/rm -f $userhome/Desktop/backup.dmg
/usr/sbin/disktool -r
/usr/bin/osascript -l AppleScript -e 'launch Application "Microsoft  
Entourage"'
------------------------------------------------------------------------
This works very well for those of us with tray-loading drives, as the  
opening tray is probably sufficient reminder to insert a blank disc.
Those with slot-loading drives should probably add this line before the  
'burn' command:
osascript -l AppleScript -e 'tell Application "Finder" to activate &  
speak "Please insert a blank CD-R disc."'



On Jan 19, 2004, at 8:46 PM, Barry Levine wrote:

> Thomas,
>
>> Maybe I missed something here BUT I am a bit thrown off by the tone of
>> your email and the attitude you express.
>
> Obviously, my post was poorly worded enough to cause your reaction. If  
> so, I apologize.
>
>> But Rev can do this!!!
>
> Would you be kind enough to identify the Rev command that does this? I  
> can't seem to find it.
>
>> with not even a please or thanks or anything.
>
> Actually, I did write "TIA" (thanks in advance).
>
> Please & Thank you,
>
> Barry
>
> ;-)
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>

Macintosh PowerBook G-4 OSX 10.3.1, OS 9.2.2, 1.25 GHz, 512MB RAM, Rev  
2.1.2


Advanced Media Group
Thomas J McGrath III	• 2003 •	3mcgrath at adelphia.net
220 Drake Road, Bethel Park, PA 15102





More information about the use-livecode mailing list