I am searching for a solution that positions the mouse to a specific location just once and then perform a scroll wheel simulation. My goal is to use an external controller to change values under a dedicated mouse position.
First I tried the scroll action setting the mouse location manually which works fine. I would need to activate the mouse positioning just once in this macro so I tried "Execute Actions Until Conditions Met".
If I take the terms or result "The last action result: = OK" in combination with a "Click at…" literally, I expect the result to be OK when the mouse position is reached once. But obviously it doesn't work like this. The result returns "(currently true)" no matter where the mouse position is located. Which also means that the action "Click at…" is triggered constantly. As follows the first version:
Can you give us a better idea of what it is you're trying to do? What are you clicking, in what app and why? What's the end goal? That's the best way to get help. Screenshots would also be useful.
If you only want to move the pointer to a position, select "Just move" rather than "Click" in the action's options.
If you want to be sure the pointer is in position before you do the scrolling -- the macro can run faster than the GUI sometimes -- then use a "Pause Until" action where the condition is the desired pointer location. You can use the %CurrentMouse% token to get both coordinates at the same time, so your action would be:
I have to apologize about my kind of silly question. After my post late in the night on my end I investigated a bit more and became more clear that it couldn't work at all. Since the MIDI trigger is triggering the whole macro with each change the mouse positioning also will be triggered always.
I can't share any screenshots or details about the app I'm using because it is an internal one. But that is not necessary. As I mentioned I just wanted to control a value field like this example…
… which can be changed using the mouse scroll action using an external controller sending MIDI data. I am am already able to control it. I just searched for a way to position the mouse automatically which would enable me to assign particular hardware knobs from my controller to dedicated value fields.
But I think it is not possible without a separate macro positioning the mouse and one for the control action itself.
Thanks so much and again apologies for my not very smart question.
Does that matter? If the pointer is already in position, the "Move" will just leave it where it is.
But it looks from your screenshot as though you also need to activate the field, which is why you need the "Click" action. Is it the second click on the already-activated field that's breaking things (e.g. putting the field into text-entry mode, so that scrolling doesn't work)? An "is a field active" condition is often tricky, but in this case you should be able to use pixel colour detection -- a pixel between the / and the lower o of the % symbol, for example.
Indeed those are great ideas to give it another try which I will do when I have time to get back to this "construction site".
Regarding your question:
That's correct for the positioning. But my experience is that even though the "Move" doesn't have to change the positioning anymore after it's done once the constantly triggering kind of disturbs the scroll wheel action. I can see that it doesn't scroll that smoothly with the mouse positioning included compared to without the "Move" action.
In the meantime I'm considering to place another button below my knob controller to activate this particular one. This would give me the option to connect the "Move" action separately as well as setting the value of the controller to a dedicated value to be able to start controlling from there.
You might just need a short "Pause" between the two -- 0.2s seems to be the general Forum consensus for a good starting point.
But I like this too. Even better, it'll let you have different buttons for different positioning but will let you use the scroll for all of them (these things have a habit of growing!). Even even better -- it has @noisneil's seal of approval!
How about this? The macro below will click and then scroll smoothly when you move your MIDI encoder. After a period of inactivity (currently set to 1sec), it will reset a global variable. At this point, moving the encoder will click and scroll again.
Setup: change the MIDI channel and CC, redefine the click coordinates and choose a pause length.
Edit: for some reason I can't quite fathom, you have to manually set the Executing Instance variable for the macro cancel (by trying the action), the first time you ever run this macro. After that, it works fine. I've accounted for this with an If\Else in the version a few posts below this one, but I'd love to know why that's happening. Presumably the macro aborts if that variable doesn't yet exist, but there's no option not to abort. @peternlewis, is that the case?
Thanks so much @noisneil. This works awesome! Such great ideas. I am really impressed.
In the meantime I also had the second solution with the separate button working but your macro probably makes it unnecessary to work like this.
The benefit from it all is that I again learned a lot. Because beside KM the investigation to gain the solution on the controller gave me a lot of additional perspectives for the future.
I've updated it above so that each executing instance of the macro cancels the previous one. This means only one instance is ever running at a given time, and mitigates system resource usage from a buildup of macros running the 1sec pause concurrently. Delete the one you're using and download it again.
Great. Let me know if you'd also like the mouse to return to its original position (before you touched the MIDI control). That's easily done and might be another workflow improvement.
Edit... Couldn't resist; here's a version that optionally does that: