I used UI Browser to get the path to the search field in Logic's Apple Loops browser:
But when I add an action to click it, nothing happens
Find in loop browser.kmmacros (2.2 KB)
I used UI Browser to get the path to the search field in Logic's Apple Loops browser:
But when I add an action to click it, nothing happens
Find in loop browser.kmmacros (2.2 KB)
AppleScript is a minefield in Logic. Click relative to the front window's top-right corner instead.
Good trick for his particular scenario. Thanks
Now for some reason, it's not accepting one of the IF THEN actions (#2):
Search in loop browser.kmmacros (140 KB)
If the images are available it jumps right to the Notification step instead of going to the condition with the Cancel This Macro action... I can't seem to understand what's happening here. Do you see anything I don't?
(off topic: how do you make the images here on the forum be closed by default? I've done that before and I don't remember anymore. I want to add that to my "tips" document)
I assume the second (nested) If/Else is for testing only so that the images are highlighted onscreen, as you don't actually need it.
Just to check... Are you testing this while Logic is at the front?
I use this macro to upload:
Upload Macro to KM Forum.kmmacros (77 KB)
Change any mentions of Brave Browser
to whichever browser you use.
If, while writing a comment, I want to enclose an image, I use this:
KMF - Enclose Details.kmmacros (53 KB)
I'm using this to also open the Loop Browser, not only when it's already open, so I need that to check if the browser is already open or closed. So what's weird is that it skips that IF action, I don't know why?
Think with me, assuming the browser is closed
It first checks if the images are NOT present, which is true. It uses the shortcut to open the browser and leaves the IF section, straight to the notification (this was just so I could see where it was jumping to). Then from there it runs the rest of the actions which is to check if the images are present and all that, and clicks the search field.
Assuming the browser is already open, it checks if the images are NOT present again. In this case, it's false, so it should go to the "otherwise execute the following actions" (IF #2), use the shortcut to close the browser and cancel the macro. But right now it jumps from checking if the images are NOT present, straight to the notification.
Am I missing something here?
Thanks for sharing the macros. Will take a look at them. That's a lot of stuff just for posting to the forum. Damn!
Yes, that's why I am able to run the first part of the macro (when the browser is closed), but not when I'm supposed to close it
It posts to the comment being currently edited.
Try this. It assumes you haven't removed the Loop Browser button from the far right of your toolbar:
Search Loops.kmmacros (56 KB)
But you are missing something. This is the state of when it's closed:
And this is when it's open:
So you need 2 conditions for this, right? That's why I have the nested IF THEN
Also, I still don't understand why it isn't working the way I set it up, because it doesn't make sense it doesn't. Would like to see if there's something I'm missing here...
Why do you have the 1st and last variables? Why not use the Restore Mouse Position?
Check the logic -- the first "If" will be true
if any of those three images are missing, and they look like variations of a single image so I'm guessing you'll only ever have one present. You'll always do the keystroke action and never the "otherwise" that leads to the "Cancel".
This is one where popping a "Display" action at the head of each branch in your logic will help you see what's going on as it runs. Old-school, but I find it easier than the debugger!
Ok I finally got it! Yes, I should change it to "all" instead of "any"
Small details that make so much difference! Thank you so much for that!
It was driving me nuts!
You mean the Display Progress or Display Text? I usually just use the Notification with some message, if necessary. Is that how you use it?
Still related to this macro, but this would apply to other macros:
I believe I remember @noisneil once mentioning that relying on the Show Menu action is not a good approach (I don't remember your exact words, Neil, sorry), so I picked the shortcut route instead. Actually, today, for some reason, KM wasn't working properly when I was using the menu action. It wouldn't find it no matter what.
Thoughts on this? Neil, can you also remind me why you said that?
In this particular case, when the browser is closed, none of the images is present, actually. Those 3 variations are when it's open and depending on what's in focus or not, it changes. Not sure if the 2 gray variations are different enough for KM to sometimes have a hard time with them, but I always include stuff like this to avoid potential glitches
@noisneil funny enough, when I tried your macro with the icon (I changed it to mine, of course), KM didn't see any difference when it comes to the difference shades of gray... Sometimes it does, sometimes it doesn't. It's hard to predict. Sometimes stuff that's super subtle, it doesn't work. Now that the shade is very noticeable, no issues... go figure
The macro I posted does the following:
Only one condition is needed, as if the button isn't in one state, it's in the other.
Have I misunderstood what you want to do?
Because I started the macro by adding those actions in case more than one click was needed. I'd rather the mouse position was recalled only once, at the end. As it turned out, only one was needed, so you could equally use the gear menu function.
It's a quirk of Logic that the menu item states aren't updated until you actually open the menu. There's a workaround, but it's a bit clunky and slower than using found images, so I didn't suggest it.
What I mean is that since the button state is different when it's open or closed, as you can see from my images, if you are scanning for images, I would assume KM would see those 2 states as different images. One has a darker background. Apparently, it didn't, but more often than not, it needs something more accurate. That's why I added extra conditions, to check both states.
I see. Minimizing the extra "load". I always use the Restore mouse position feature on every action, just in case. But I will save this idea of yours as well, because if I don't need the mouse, it's just faster and easier to do it at the end.
Oh I thought when you said that that you were saying it was not good in general, for all KM macros and when possible, rely on other approaches. So it's just with Logic, ok. Thanks for clarifying!
Sounds like you've got it working now, but it seems slightly longwinded, so...
Not in my experience. I've found it to be extremely reliable if the fuzziness isn't set too high. Besides, even if you're doing two checks, the image search would return false positives/negatives, if it wasn't sufficiently accurate. Something else is going on in your testing.
There's a chance the image search bounds need to be altered for your screen setup.
This version highlights the area to be checked for the button image. Make sure it's looking in the right place. Also, replace the screenshots of the button states for good measure.
Search Loops.kmmacros (56 KB)
I've seen reports of the same thing with other apps, but I can't remember which ones. The only one I've found issue with (so far) is Logic.
These "logical combinations" drive most people nuts, especially when NOT
s and OR
s (or "any of" in KM terms) are involved.
"Display Text", because they stay on screen after the fact and don't trample over each other. Just remember that the most recent one is frontmost so, to follow the flow of your macro, you have to start with the dialog at the back and then work forward.
Thanks for the tip. Will see how I can implement that into my macro creation process
Ok I will test this and see how it goes. Thanks for sharing