Autohotkey: How to monitor changes on a minimized window?

111 views Asked by At

I'm using Anki for some of my chemistry classes and due to the way I have set it up, there are always cards that show up a while later after I have finished a normal study session. Usually I remember to check on them and clear them, but sometimes they end up carrying over to the following day because I forget about them and that messes with the per-card scheduling of cards that I already have a bit of trouble remembering.

What I'm trying to do is to write an AHK script that can monitor the Anki window in realtime while it is minimized and, whenever a card is ready to pass the final check, notify me by playing a sound of my choice. I could achieve this with OCR or by checking for pixels, but that should be the easy part which I'm confident I can figure out on my own. The problem is that I can't find a way to make AHK work inside minimized windows.

Alternatively, would it be posible to have the Anki window outside the visible part of the screen (and set to be always ontop) so that the script can monitor it in real-time and then bring it to the front when there are new cards ready?

The reason I want to do this is so that I can simply minimize Anki once I'm done with the main chunk of reviews and wait for the "alarm bell" to notify me of available cards while I'm doing something else, this way making sure that I don't miss a single card.

I've tried using the virtual desktop option on Windows before, but I've not had much luck with it since I don't believe the AHK script can monitor that.

A brute-force solution I thought of would be having a low power VM running in the background with Anki and the script checking for changes on the window (thus circumventing the whole windows minimization problem) but I'd rather not do that since my PC isn't strong enough to accomodate running a VM constantly (and it sounds quite silly anyways).

I also thought about having the script un-minimize the window for a few seconds to check for changes, before minimizing it back if there isn't anything new, but this would get in the way of whatever else I'd be doing at the time and would probably break down because of windows lagging or Anki generally being slow.

Also to my knowledge there are no Anki add-ons that add this functionality to Anki itself.

0

There are 0 answers