Is it possible for a Macro to run after a program is done processing? For example, If I am ripping a DVD using handbrake, is it possible to create a Macro that says when the ripping process is complete eject the DVD?
To clarify, this is more than launching or quitting apps.
If you can tell me how you visually discern with your eyes that a program has done processing, then KM can look for the same condition and solve our problem. We would probably need to see a series of visual screenshots of your program before, during and after the RIP. I do this all the time for my apps. And sometimes I check more than one visual cue to be certain. In fact sometimes I even wait for ten consecutive failures to detect the condition before I conclude that we aren't there.
If you are unable to discern with your eyes when the program ends, we might be able to solve this using audio cues. For example ripping an audio DVD makes actual noise, and with some tricky audio programming we can tell when the RIP has ended. As long as you don't have music playing in the background. I've done this too, with actual audio coming out of my tinny speakers.
There are even more ways to tackle this. I've noticed that many programs free up their memory when they are finished a major task like RIPping a CD. So if we monitor the program's memory usage we can discern when the Rip is complete. I have actually used this approach to tell when a program is finished to great success. Here's an image of a macro which tells me when an app has finished and returned to its main screen:
Then of course there's the AppleScript approach would be easy. But is the application you are using compatible with AppleScript responses? Sometimes it's very easy for AppleScript code to wait util an "Abort" button has disappeared.
Yes, I believe "Handbrake" is scriptable. because it can be used in CLI.
Oh, well in that case there is no problem at all. The program is completed when the script is done. Have you tried making that work in a macro?
When the command line finishes, then the KM action to Execute s Shell Script has ifinished and now "knows" the program is ready for successor.
Here is an example of Transmission done processing:
Here is Handbrake done processing:
Is there a standard script for when a program is done downloading/processing? so that I can add actions to quit the program or eject DVD?
You may be able to solve it in specific cases, especially ones like this, if they use a shell tool (like ffmpeg). If so, you can detect when that is running using the
Alternatively, you may be able to detect a menu item that changes enable when all the processing is finished (eg, there might be a menu like "Stop All" which is dimmed when all the transfers are completed).
But basically, you have to find something you can detect for the specific application and specific case, there is no general solution to this.
So, if I understand this correctly, the Folder trigger with the option to ignore partial or changing files may not always work. From the KM Wiki:
You can have the trigger ignore partial or changing files, so for example if a file is being downloaded or copied in to the folder, the trigger will wait until the download/copy has completed and can ignore partial files (files with extensions that are known to be “in progress” files).
So it seems like the Wiki needs an update to advise the user that option may not always work, and maybe provide some possible workarounds.
I think there may be a way to accomplish our goal via a script found at Transmission Scripts but I'm not sure how to go about finding the one that would work for me. Unfortunately, I'm not a scriptwriter so most of the scripts I use were written by someone else. My AppleScript abilities are very, very basic. But I absolutely love it when I find a script that I can get to do what I need with the Keyboard Maestro.