I have automator running several applescript commands that I want to happen sequentially. For example, I have an empty trash
command, then a shut down
command. When I run the script, the computer shuts down before the trash empties more than a few files.
How do I make sure that automator completes one task before moving on?
I also have a terminal command for backing up using time machine. I would also like that one to finish before the shut down.
Best Answer
Unfortunately
empty trash
is a message sent to Finder, and, from Automator's point of view, the task finishes when the message is sent.In this conversation there's a possible solution. You have to modify your Applescript task with a check on the size of the trash:
This way the task will not end until the size of the trash stops decreasing.
If you use tmutil for time machine backup terminal command, there is a
-b
option forstartbackup
command that tells the script to wait until the backup is finished before exiting.