Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var x = sf.ui.cubase.getWindowWithTitleStartingWith('Cubase Pro').position.x + 1303; //set the x relative position of subject
- var y = sf.ui.cubase.getWindowWithTitleStartingWith('Cubase Pro').position.y + 117; //set the y relative position of subject
- var flexPosX = 25; // set a number the mouse can be move within after being placed at position x,y
- var flexPosY = 25; // set a number the mouse can be move within after being placed at position x,y
- var moved = globalState.mouseToAudioTranspose; // set name of globalState Function.
- sf.ui.cubase.appActivateMainWindow(); // activates Cubase / puts cubase in front.
- if (!sf.ui.cubase.getMenuItem('Audio', 'Open Sample Editor').isEnabled) { log('Audio Not Selected'); return; }
- moved = !moved;
- if (moved) {
- globalState.posX = Math.floor((sf.mouse.getPosition().position.x));
- globalState.posY = Math.floor((sf.mouse.getPosition().position.y));
- sf.mouse.setPosition({ position: { x: x, y: y } });
- }
- if (!moved) {
- let xNow = Math.floor(sf.mouse.getPosition().position.x)
- let yNow = Math.floor(sf.mouse.getPosition().position.y)
- if (xNow < x + flexPosX && xNow > x - flexPosX && yNow < y + flexPosY && yNow > y - flexPosY) {
- sf.mouse.setPosition({ position: { x: globalState.posX, y: globalState.posY } });
- }
- else {
- globalState.posX = Math.floor((sf.mouse.getPosition().position.x));
- globalState.posY = Math.floor((sf.mouse.getPosition().position.y));
- sf.mouse.setPosition({ position: { x: x, y: y } });
- !moved;
- }
- };
Add Comment
Please, Sign In to add comment