As the title says, Is it possible to move mouse until a certain color is underneath the cursor and then stop?
I'm currently using the find image on screen to find a set of words, and then I need the mouse to move right until a certain color is found. Once it is found, I need it to click and hold the mouse down. The distance between the image and color varies so it would be nice to have it find the image and move right until it sees the color.
Any idea if this is possible?
I'm not sure if this is really the best way to accomplish the task you want to automate, but yes, it's possible. This example macro shows how it can be done:
Move Mouse Until Color is Under Cursor.kmmacros (3.8 KB)
Just make sure to use the image the words you're using now, and to set the color appropriately. You can adjust the number in the X axis field (marked with a right arrow, currently set at 3) to control how quickly the pointer moves, though of course if you make this number too high it may end up skipping over the color you want it to stop on.
This seems to have gotten me really close! I might be misunderstanding (or we are thinking of achieving two slightly different tasks).
It appears now it can find the image and get to the color, but after it finds the color, it's just clicking at the original found image instead of on the color that it found. Is it possible to make it click on the color?
Glad we're almost there! The macro I provided definitely clicks and holds on the color it finds when I test it, so I'm not sure from your description alone what the problem could be. Do you perhaps have the macro set to click and hold relative to the found image, rather than relative to the current mouse location, after it finds the color? If that's not the problem, you may want to upload the macro as you're currently using it, as that's a much, much easier way to diagnose what could be going wrong.
Mouse color macro.kmactions (8.5 KB)
Here is what I have setup currently. If it would help, I can upload a screen recording of what I am trying to accomplish as well.
I'm afraid you only uploaded the "Execute Actions Until Conditions Met" action in your macro, so I couldn't verify that it was set up properly in the KM editor on my machine. Nonetheless, it does seem like it is set up properly from your image, so again, I'm not sure why it's clicking on the original image instead of the current mouse position. If you could upload a screen recording of what happens when you run this macro, that should definitely help.
Oh sorry! Here is the macro (hopefully) as well as the link for the screen recording. Might take a minute to process.
Color search.kmmacros (14.9 KB)
Aha, I see the problem now. The pointer was only moving a pixel away from the center of the found image over and over, instead of across the screen. Try this variant where it finds the image and then moves the pointer relative to its current position and see if it doesn't do the trick:
Color search 1.1.kmmacros (23.2 KB)
This was my oversight for not testing with a found image myself. Sorry for the confusion!
No worries! That did the trick!
This might be me being too picky, but is it possible to have it find the color quicker/instantly? I tried moving the cursor faster, but it just ends up skipping the color. With this macro I'm hoping to press a button and have it instantly allow me to scale the image.
Even if it isn't possible to find it quicker, this was really good to learn about. Appreciate all your help!
You're welcome! Hmm. If there's no image for KM to find (which I imagine there isn't, since you're relying on pixel color now) then I don't think there's a way to make this happen instantly, but I would think there's still room to make it faster without it skipping the color. Does it still skip if you change the "Just move" setting to 2 or 3 or another small number? You could even try increments like 1.5 if even 2 is too fast. At any rate, I'm glad this helps!
I can get it up to about 5, but it's still too slow. I think ideal speed would be around 100.
Definitely an understanding limitation though! I have other ways to work around this macro. I can just keep my workspace the same and just use the "mouse and click" action to always go to the same coordinates. I was just hoping to give myself a tiny bit more flexibility with my workspaces.
Not a huge issue though.
Yes, I do this in one of my macros using the PIXEL function. Specifically I want the mouse to move down until the brightness of the pixel changes significantly. ScreenX and ScreenY can be set from the MOUSEX and MOUSEY functions. Adjust as necessary.
Ha. That's awesome. Glad to see others automating Premiere in here!
I'm working on a similar thing for the Lumetri panel's controls, that's rad.
My solve for this was simply to save a Window Layout that forced the Effects panel to the same spot every time, pair with a keyboard shortcut that cue'd up that panel, then use more absolute mouse positioning to get to the blue text (or using Found Image). I've got a layout I like for Premiere that allows quick toggling of all panels, so this works for me. If you're interested, find my website and shoot me an email and we can chat for days about Premiere macros, ha.
Interesting thread - I think I may have stumbled across what I'm looking for.
I'd like the mouse to move horizontally until the mouse pointer changes from an arrow to a hand, and then click at that point - i.e. it clicks when it finds the link.
Is it a website? I'd say it's better/more solid to check the link by the HTML
No, it's not a website, it's part of a program. Within the program, an arrow appears at the end of a line of text and clicking on that opens up a menu. The issue is that the length of the line of text varies.