Hi! Hope everyone is enjoying BTT!
This 'Run Real JavaScript' is for moving the mouse pointer to a stored position. But it doesn't work on an external display - so if a stored mouse position (mb_1_x
and mb_1_y
) is on an external display, it doesn't work. It works well as expected on a macbook's screen.
(async ()=> {
let mx = await get_number_variable({variable_name:'mb_1_x'})
let my = await get_number_variable({variable_name:'mb_1_y'})
// copied from a configured trigger
// you can use the following with BTT's "Run Real Java Script" action
let result = undefined;
result = await trigger_action({json: JSON.stringify({
BTTActionCategory: 0,
BTTPredefinedActionType: 153,
BTTPredefinedActionName: 'Move Mouse To Position', // the name is maybe optional
BTTAdditionalActionData: `{\"BTTMouseMoveX\":${mx},\"BTTMouseMoveAnchor\":0,\"BTTMouseMoveUnitX\":0,\"BTTMouseMoveY\":-${my},\"BTTMouseMoveUnitY\":0}`,
BTTEnabled2: 1,
}), wait_for_reply: true});
returnToBTT(result);
})();
Note that mb_1_x
and mb_1_y
are stored this way.
'Run Real JavaScript':
(async ()=> {
let savedX = await get_number_variable('saved_mouse_position_x');
let savedY = await get_number_variable('saved_mouse_position_y');
let result = await set_number_variable({variable_name: 'mb_1_x', to: savedX});
returnToBTT(result);
result = await set_number_variable({variable_name: 'mb_1_y', to: savedY});
returnToBTT(result);
})();
Tested on macOS 14 and 15. In both cases, BetterTouchTool 5.085 (alpha).
Thanks.