denns
September 22, 2003, 12:38am
#1
Here’s the applesscript
with timeout of 18000 seconds
try
tell me to activate
display dialog “Starting backup…” buttons {“Cancel”, “Erase/Cont.”, “Continue”} default button “Continue” with icon note giving up after 15
if the button returned of the result is “Erase/Cont.” then
display dialog “Please insert a blank disk.” buttons {“OK”} default button 1 giving up after 2
do shell script “hdiutil burn -erase”
–
do shell script “hdiutil create -fs HFS+ -volname XXXX -size 4400m /Users/XXXX/Desktop/XXXX.dmg”
do shell script “hdiutil mount /Users/XXXX/Desktop/XXXX.dmg”
–
do shell script “/usr/bin/ditto -v -rsrc /Users/XXXX/Library/Scripts /Volumes/XXXX/scripts”
do shell script “/usr/bin/tar -czf /Volumes/XXXX/personal.tar.gz /Users/XXXX/Documents/personal”
do shell script “/usr/bin/tar -czf /Volumes/XXXX/ideascubed.tar.gz /Users/XXXX/Documents/ideascubed”
do shell script "/usr/bin/tar -czf /Volumes/XXXX/iphoto.tar.gz /Users/XXXX/Pictures/iPhoto "
do shell script “/usr/bin/tar -czf /Volumes/XXXX/album.tar.gz /Users/XXXX/Pictures/album”
do shell script “/usr/bin/tar -czf /Volumes/XXXX/images.tar.gz /Users/XXXX/Pictures/images_personal”
do shell script “/usr/bin/tar -czf /Volumes/XXXX/installers.tar.gz /Users/XXXX/Documents/installers”
do shell script “/usr/bin/tar -czf /Volumes/XXXX/library.tar.gz /Users/XXXX/Library”
–
do shell script “hdiutil unmount /Volumes/XXXX”
do shell script “hdiutil burn /Users/XXXX/Desktop/XXXX.dmg -noverifyburn -noeject -optimizeimage”
do shell script “/bin/rm -v /Users/XXXX/Desktop/XXXX.dmg”
do shell script “/usr/sbin/disktool -r”
–
tell application “Finder”
display dialog “Erase Disk and Backup have completed successfuly.” buttons {“OK”} default button 1 giving up after 5
end tell
else if the button returned of the result is “Continue” then
do shell script “hdiutil create -fs HFS+ -volname XXXX -size 4400m /Users/XXXX/Desktop/XXXX.dmg”
do shell script “hdiutil mount /Users/XXXX/Desktop/XXXX.dmg”
–
do shell script “/usr/bin/ditto -v -rsrc /Users/XXXX/Library/Scripts /Volumes/XXXX/scripts”
do shell script “/usr/bin/tar -czf /Volumes/XXXX/personal.tar.gz /Users/XXXX/Documents/personal”
do shell script “/usr/bin/tar -czf /Volumes/XXXX/ideascubed.tar.gz /Users/XXXX/Documents/ideascubed”
do shell script "/usr/bin/tar -czf /Volumes/XXXX/iphoto.tar.gz /Users/XXXX/Pictures/iPhoto "
do shell script “/usr/bin/tar -czf /Volumes/XXXX/album.tar.gz /Users/XXXX/Pictures/album”
do shell script “/usr/bin/tar -czf /Volumes/XXXX/images.tar.gz /Users/XXXX/Pictures/images_personal”
do shell script “/usr/bin/tar -czf /Volumes/XXXX/installers.tar.gz /Users/XXXX/Documents/installers”
do shell script “/usr/bin/tar -czf /Volumes/XXXX/library.tar.gz /Users/XXXX/Library”
–
do shell script “hdiutil unmount /Volumes/XXXX”
do shell script “hdiutil burn /Users/XXXX/Desktop/XXXX.dmg -noverifyburn -noeject -optimizeimage”
do shell script “/bin/rm -v /Users/XXXX/Desktop/XXXX.dmg”
do shell script “/usr/sbin/disktool -r”
–
tell application “Finder”
display dialog “Backup has completed successfuly.” buttons {“OK”} default button 1 giving up after 5
end tell
end if
end try
end timeout
It’s basically a backup script to backup files to a DVD. Here’s what’s wrong. Every time the script gets to this line:
the whole script just quits after it has finished excecuting this line. In both if statements.
This is what I have done to debug it:
1 I’ve added an ignoring application response.
2 I deleted all the spaces after the ‘command’ in question thinking that something might be there that I couldn’t see.
3 I’ve deleted all the remark lines, taken away all the spaces.
4 It all started when I added the line in question.
5 I added a try statement.
If you can figure this one out I will probably elevate you to the status of God Hero
Camelot
September 22, 2003, 1:26am
#2
The command in question is undoubtly throwing some error or other, so your code is falling through to the ‘on error’ command, where you basically ignore it.
Replace the line:
end try
with:
on error theErrMsg
display dialog theErrMsg
end try
This will at least tell you why the command is failing, enabling you to sort out the root cause.
denns
September 22, 2003, 5:49am
#3
Camelot,
Thanks for the help. It turned out to be permission errors. I couldn’t copy certain files so my script would quit at that point.