How move the Mouse to a position in an active Window
Hi,
I am trying to move the mouse to a Position Relative to an "active "Window" in Pro Tools using "Set Mouse Position" but goes relative to the Pro Tools window, what i have to add to indicate that is relative to the active window? .
.I want something like "Mouse click relative to a UI Element" but moving the mouse there(no click needed).
Thanks:)
- samuel henriques @samuel_henriques
Hello Reuven,
This should get you the first focused plugin for example.
Then you can move the mousefocusedPluginPos.x
andfocusedPluginPos.y +
the amount you need relative to the window.const focusedPlugin = sf.ui.proTools.windows.whoseTitle.startsWith("Plug-in").first const focusedPluginPos = focusedPlugin.frame
Let me know if you get stuck
Christian Scheuer @chrscheuer2022-07-08 13:16:33.414Z
Exactly - here it is including the mouse setposition action:
const focusedPlugin = sf.ui.proTools.windows.whoseTitle.startsWith("Plug-in").first; const focusedPluginFrame = focusedPlugin.frame; sf.mouse.setPosition({ position: { x: focusedPluginFrame.x + 100, y: focusedPluginFrame.y + 100, }, });
- In reply toReuven_Amiel⬆:Reuven Amiel @Reuven_Amiel
Thank you Samuel and Christian,
The Second script works,
but if I use these 2 scripts as different 2 actions together in a macro do not...why? I just wondered as I believe the first script is to get or focused on the active window and the second script for moving the mouse to the position in the active window...
const focusedPlugin = sf.ui.proTools.windows.whoseTitle.startsWith("Plug-in").first
const focusedPluginPos = focusedPlugin.frame
and
sf.mouse.setPosition({
position: {
x: focusedPluginFrame.x + 100,
y: focusedPluginFrame.y + 100,
},
});
Now can I have it all in one Script or one single macro? lets say where I want to get and assign a trigger for 6 different positions in the active window without creating a folder with 6 independent macros for each position?
Thank you guys for the help
Christian Scheuer @chrscheuer2022-07-08 17:17:04.250Z
You can't break up the script into 2 different parts - and there's no need to do that either. See my comment below on templates if you wish to reuse code and to be able to insert values into the code.
- In reply toReuven_Amiel⬆:Reuven Amiel @Reuven_Amiel
Also I have a question I want to know, it is possible for us, and if yes the answer how to do it or how can I learn to do this:
when you have a script where for example you can add different values or options and you want to see it when you add a value
like this:But if you have this script like this where you could add X,Y values:
sf.mouse.setPosition({
position: {
x: focusedPluginFrame.x + 100,
y: focusedPluginFrame.y + 100,
},
});and then you add it as an action on a macro, you will have the action with the fixed values but not the options to type in any value
What can I do to have my scripts showing up in action with options to add values and drop-down menus?
Christian Scheuer @chrscheuer2022-07-08 17:15:49.324Z
Hi Reuven,
You'd need to look into creating templates - see:
https://www.facebook.com/watch/live/?ref=watch_permalink&v=633065107406660
Reuven Amiel @Reuven_Amiel
Thanks, will check that.
now Now can I have it all in one Script or one single macro? let's say where I want to get and assign a different trigger for 6 different positions in the active window without creating a folder with 6 independent macros for each position?
will check the video of templates and presets...is the answer to this question there?
Christian Scheuer @chrscheuer2022-07-08 17:51:16.112Z
Yes I believe this is the answer to that question. A template is essentially a script that can have different variants of itself - each variant is called a preset. This means you only write the script once but can have many different presets with different input to the script, each preset can have its own triggers.
It's all explained in the video :)Reuven Amiel @Reuven_Amiel
Thank you, will watch the video and experiment with this.
- In reply toReuven_Amiel⬆:Reuven Amiel @Reuven_Amiel
Hi,
Watched the video and could to the template and presets but when ad X and Y the values always go to the 100, 100, so I imagine the idea is to change that "100" where Idid to locationValue ...was in green so I do not know if that is even something deepr or a bit more complex that replacing it by a name and then at top of the script adding :const locationValue = event.props.locationValue;
I did this using the script Christain gave us
const locationValue = event.props.locationValue;
const focusedPlugin = sf.ui.proTools.windows.whoseTitle.startsWith("Plug-in").first;
const focusedPluginFrame = focusedPlugin.frame;
sf.mouse.setPosition({
position: {
x: focusedPluginFrame.x + locationValue,
y: focusedPluginFrame.y + locationValue,
},
});if I can get the right "source" script would help me a lot to understand this, i got the idea on the example of the video...but only had one data input, when this one has two and that may be very different... I do not know
I tried to check the Script on "mouse click relative to a UI Element" but the scrpt conversion is not good, or des not allowed me to see it fully...must be protected I guess
Thanksbold text****bold text
Christian Scheuer @chrscheuer2022-07-09 19:17:25.732Z
Almost there :)
sf.mouse.setPosition({ position: { x: focusedPluginFrame.x + locationValue.x, y: focusedPluginFrame.y + locationValue.y, }, });
Please see here how to quote code in the forum:
Reuven Amiel @Reuven_Amiel
Awesome! checking now and will check that link too!
- In reply toReuven_Amiel⬆:Reuven Amiel @Reuven_Amiel
Great it worked!
thanks!
there is something I have in my mind... but want to ask you if this is possible first before even try to to this.
It is possible that Soundflow when I make a window active can read/catch or know which window is and automatically shows on a specific tablet a specific surface ?
Christian Scheuer @chrscheuer2022-07-09 20:32:24.021Z
Great! Yes you can use window triggers for this. It's better to ask that in a separate thread if you need help.
I'd also highly recommend checking out our learning SoundFlow playlist here if you haven't already:https://www.youtube.com/playlist?list=PLKWpZOwx5Z3jxnpNo_dQPhDQNRwp7DCNj
Reuven Amiel @Reuven_Amiel
Thank you..I will
But this is super cool, save time and is way more neat