My scipt works! But times out. Any suggestions?

I’ve got a weekly script that backs up my system folder. Works like a charm. Kinda. The problem is that the script times out while waiting for disk copy to do its thing. So far, this isn’t a major problem because all that doesn’t execute is “end tell”. However, I want to do more with the script after the disk copy process. Therefore timing out is a bad thing. heck, it’s sloppy programming anyway. But I’m relatively new to AS debugging, so here goes:

set x to the day of the (current date)
set Y to the month of the (current date)
set fileNdate to "Sprite:Mausoleum:System Folder - " & x & " " & Y & ".img"

-- the script needs to wait while this process completes
tell application "Disk Copy"
 activate
 save alias "Pixel:System Folder:" in disk image (file fileNdate) using format NDIF Compressed logical blocks 1326000 with zeroing without image signing and leave image mounted
end tell

How can I tell AS to wait for the disk copy process to finish? I’ve noticed that when setting up repeating dialog reminders (display dialog, give up after set time, repeat) AS will time out over time. So there’s something going on here I don’t have figured out yet. Any help would be appreciated. Thanks!

Bug

OK, that sounds interesting. I’ve not experimented with “stay open” apps… Sending commands to other running scripts is just a little wee bit ahead of my current abilities. Does this mean I’ll have to manually quit the script?

Tell “Disk Copy” to quit after completing its job. Should have done that anyway. LOL So simple to implement. (-_-);

Add an idle handler. Then check for the absence of Disk Copy. Let me take this one at a time. Doing a little research, I found that Akua Sweets does what you suggest, so the following works like a charm:


all processes named "Disk Copy"
if result as string is equal to "Disk Copy" then
 display dialog "Oh, baby"
else
 display dialog "Oh no!"
end if

What I don’t know how to do is that idle handler. mac_guy suggested “with timeout of 300 seconds – put statement that takes 4 minutes in here end timeout”. Where would I put that?