Take action when Media Encoder queue finishes?
Copy link to clipboard
Copied
Right now, if I queue up long-running tasks in Media Encoder, I have to pretty much check out the window periodically to see if the jobs are done. I'd like to be able to run an AppleScript or something so I can get a notification that encoding is complete. Is there any way to do something like that?
Copy link to clipboard
Copied
I'm replying to my own post here in case someone stumbles across it. I ended up:
- Writing a little Python scrip that polls the output files until they have stopped growing. It waits for five minutes after the last change, and then exits.
- Using ffprobe to make sure that the files that Media Encoder produced are readble.
Slightly hacky, but it seems to work.
Copy link to clipboard
Copied
This Applescript code checks ME's menu item File > Stop Queue and finishes when the menu item is no longer enabled. This script can be connected to e.g. Folder Action to monitor output folder and activate ME and display dialog etc.
Cheers!
Funtom
set stopQueueEnabled to true
tell application "System Events"
repeat with processItem in processes
if name of processItem is "Adobe Media Encoder 2023" then
set processContents to entire contents of processItem
exit repeat
end if
end repeat
repeat while stopQueueEnabled is true
delay 10 -- seconds
set stopQueueEnabled to enabled of item 10 of menu items of item 1 of menus of item 3 of menu bar items of item 3 of processContents
end repeat
end tell
Copy link to clipboard
Copied
Of course omitting the year makes the code accept any version of ME.
if name of processItem starts with "Adobe Media Encoder" then
Copy link to clipboard
Copied
Clever! Thank you!
Copy link to clipboard
Copied
You could also use ExtendScript scripting to solve this. See here: https://ame-scripting.docsforadobe.dev/
Copy link to clipboard
Copied
My script is not clever enough. After testing I found out that for some reason Applescript slips from the loop although ME queue is still up and running. If anyone has some ame-js-script ready to directly listen the queue event, would be nice to see that. Thanks!
Copy link to clipboard
Copied
Please have a look at https://ame-scripting.docsforadobe.dev/ that also contains a lot of code samples for waiting for completion. Do a full text search in https://ame-scripting.docsforadobe.dev/reference/index.html for complete events. You should be able to copypaste the example.

