I need to move all the items in a folder to the trash, empty the trash and restart. I have written an applescript that does all that and works perfectly when run. I saved the script as an app so that I could run it at 3:40 AM through Calendar. When the app executes (but not when the script is run) it displays a dialog with an Empty Trash dialog. Because no one is present to click the Empty Trash button the restart command times out.

The script is:
tell application "Finder"
delete every item of folder "Caches" of folder "Library" of home
delay 5
empty trash
delay 15
restart
end tell

How do I make the script (or rather the app) click the Empty Trash button immediately after the empty trash step?