Script running context confusion in editor

I'm trying to build a macro as a workaround to my previous topic: Restore Full Keyboard Access.

I'm apparently having a problem understanding how KM works. I wanted to use a UI elements script to test for the existence of a button in a window. Although I haven't created a trigger for the macro, the script seems to run every time I bring the editor window forward. I was finally able to quickly type in the comment before the activate line ("--") to stop that from happening so I could post this topic. When that first line isn't commented, why is this script able to bring Finder to the front even when there's no trigger for the Macro? Thanks.

Beautiful, hehe. I think I understand.

The KM Editor has the interesting feature of running conditions and calculations about once per second if they are visible on the screen. In a sense, that's an invisible trigger that occurs once every second.

From my experience when I turn off the KM Engine that solves the problem of the unwanted execution.

Another way I think you can solve it is to minimize the action (OPTION-LEFT ARROW) so that the script it not visible on the screen. This may be your best option.

Or just minimize the entire KM Editor window.

Thanks. Yeah, that's double trouble for me because I've been using option-arrows for Mission Control. I'll probably have to concede defeat for trying to override defaults for that.

I did solve the tab navigation (at least for some situations), which no longer plays leapfrog between Finder and KM Editor, using:

Is there a way to do it that won't run the macro every time Finder windows change?

Instead of using AppleScript Text, try an AppleScript file instead. That might stop it from executing. I'm guessing that will work.

Not sure I explained myself very well. What I meant was that I would rather use a trigger other than window change to run the macro. I would rather have a way to make it trigger only when that copy window appears. I don't know whether a trigger configured the current way might eventually be too taxing on computer resources due to the fact that it's Finder I'm dealing with.

Understood. But most of the time when people ask questions they don't tell us the importance of CPU efficiency. If a Find Image loop happens only once a day, for most people that's perfectly fine. but if you are running it 10 times an hour or more, that could be a problem.

I run Find Image almost 24 hours a day, and yes it does seem to make my computer a bit sluggish, and I'm always looking for ways to remove Find Images, but sometimes it's the only way.