Screen Image Trigger?

I'm looking for a way to trigger a macro when a certain, unique dialog box opens on a Chrome webpage.

How do I do that?

I was thinking of running a macro in the background that searched for a unique screen image. Not sure that's the right approach though.

Thanks for any advise.

You cannot trigger on a screen image, so you will need to trigger some other way. You could periodically trigger, but periodically searching for a screen image will be extremely draining for CPU and Battery so it is not recommended except for short periods of time. For example, if you had a macro that was going to cause the dialog to appear, you could then have enable a macro that periodically looked for the image, and then have it disable itself after it found it (and the original macro should pause for a longer period of time and then disable the macro as well in case the dialog never appears).

But just scanning for an image all the time would be a bad idea.

Thanks for the response, Peter. I thought that might be the case. We have a macro that works fine. The challenge is that some artists click a button manually instead of using the macro. I am looking for a way to trigger a "Reminder Alert" in case the artist does not use the macro to complete a given task.

Possibly. If you can identify the specific web page an HTML element that appears, then yes.

Here's an example to explain the idea. This is NOT a finished Macro ready for production.
==Your will need to adjust for your needs.==

Setup:

  1. Put it in a Macro Group activated only when Chrome is frontmost.
  2. The Macro is triggered only when the Title of the frontmost Chrome page changes, so you need to further qualify the page using the below IF/THEN Action
  3. Set the URL in the Macro Action to that which will be present when you want the macro to be triggered:
  4. image
  5. Set the CSS of the JavaScript querySelector() to identify the HTML element that will be present:
var abandonBtn = document.querySelector('a.btn.btn-danger');

MACRO:   Trigger Macro When Chrome Dialog Box Appears


#### DOWNLOAD:
<a class="attachment" href="/uploads/default/original/3X/f/a/fa753f8e2e3efbe627de1dab4c8b7cf4c8560b73.kmmacros">Trigger Macro When Chrome Dialog Box Appears.kmmacros</a> (5.2 KB)
**Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.**

---



![image|597x1041](upload://ecrWZOtDmlSJbisGe3v16seC8Bu.png)

---

To test/demo this, use this procedure:

1. Start a new topic in the KM forum
2. Enter the topic title, and a line or two in the body.
3. Click on the "cancel" button
4. You may have to switch away from this page, and then back.

---

### Questions?
2 Likes

Could you disable the button on the web page?

1 Like

What about creating a macro specific to Chrome that uses a left mouse click as a trigger? The macro then uses an if/then to determine whether the specific button in question is being clicked. If so, then the warning is displayed. If not, then a left click is executed.

1 Like

Thanks, all, for your suggestions. I'll consider them all and let you know what works.

This issue is evolving. It involves "printing" something at the end of a process, when the user doesn't always use a macro. Another option is to force the "Print" routine at the beginning when the user ALWAYS uses a macro. That might be the simplest solution.