Mouse Position
Yeay!
Is there a way to move the mouse horizontally or vertically to the actual position?
Basically retaining one of the axes and set the other one to a specific distance from let's say one of the edges of the selected UI element?
I ve tried all the mouse command available but I can't wrap my head around it.
Basically this is what I am trying to achieve. in Ableton.
Assuming the mouse is somewhere In the arrange view, over a track. I want the mouse to move horizontally reaching the area where the name of the track is. Which should be about 270 pixels from the right edge of the main Ableton window.
thank yoU!
- Christian Scheuer @chrscheuer2021-03-17 16:55:00.420Z
Hi Fabio,
Yes - it's possible to get the value of the current mouse position, do some math on it, and then move the mouse to where you want.
See an example here that tries to do exactly what you requested:
//Get the frame of the Ableton Live main window var frame = sf.ui.abletonLive.mainWindow.frame; //Get the current mouse position var mousePos = sf.mouse.getPosition().position; //Move your mouse accordingly sf.mouse.setPosition({ position: { x: frame.x + frame.w - 270, y: mousePos.y, }, }); //Note: use sf.mouse.click instead of sf.mouse.setPosition if you just want to click :)
- FFabio Capelli @Fabio_Capelli
hell yeah!! this will make life so much easier!
you just saved me at least 1 second worth of mouse clicking :) :)Can I add your script to a macro I already have or I would have to convert the macro I already have into a script and only work from the terminal?
Christian Scheuer @chrscheuer2021-03-17 19:59:14.101Z
This particular script could be called from within a larger macro by just adding the script as an action in your macro (click Add Action and choose the script).
You would have had to first create this as a stand alone script for that to work.
- FFabio Capelli @Fabio_Capelli
I only have EXECUTE JXA SCRIPT or EXECUTE APPLESCRIPT and they don't work..
Christian Scheuer @chrscheuer2021-03-20 11:01:20.390Z
To add a script to a package, choose "+ New" and instead of choosing Macro, choose Script.
Give the script a name. Then, in the bottom right corner, add the script I sent you above.
This is how you make SF scripts.
Now, if you want to call that script inside of a Macro, you can add a reference to that script by searching for its name when you click Add Action.
I'd highly recommend watching more of our Learning SoundFlow tutorials here - they cover most of this:
https://www.youtube.com/playlist?list=PLKWpZOwx5Z3jxnpNo_dQPhDQNRwp7DCNj