user12115161
user12115161

Reputation:

With AppleScript how do I tell when a external app is finished doing what I want

With AppleScript how do I tell when a external app is finished doing what I told it to do?

EG,

my DoStuff1()

my DoOtherAppThings()

my DoStuff2()

So, instead of using wait(10) I need something like:

my waitUntilOtherAppIsDone()

my DoStuff2()

Help accepted.

Upvotes: 0

Views: 85

Answers (1)

user3439894
user3439894

Reputation: 7555

From your comment:

The app is BBEdit and the wait is for BBEdit to finish doing (1) over-writing a file and (2) saving the edit.

There is no need to use a delay when telling BBEdit to save a file as any subsequent command does not trigger until the save is complete. Replacing (overwriting) an existing file of the same name is the default.

When executing, e.g., tell application "BBEdit" to save front document to POSIX file "/path/to/untitled text 1.txt" any subsequent command doesn't trigger until the save is complete. This is by design.

Here is a screen shot on Script Editor showing three commands, the first and third to show the date/time and the one in between BBEdit saving a 500 MB file. As you can see, it took 5 seconds after BBEdit started the save operation and command after it didn't trigger until the save operation completed.

enter image description here

Upvotes: 1

Related Questions