Save current mouse position to a variable

It is possible to save the current mouse position to a variable? I've looked everywhere and just can't find a solution. I could use the restore saved mouse position action if I didn't need to drag with LMB to that position...
Any ideas?

I'm looking for this, too! (I'm trying to replicate rectangle pro functionality) - did you ever find a way to do this?

What exactly are you trying to do?
When using the "Save Current Mouse Position" action, the mouse position is saved in the variable saved_mouse_position however in the system standard point format: e.g. {610.19921875, 461.64453125}

I'd like to be able to perform a left click & drag action from a certain spot to the saved position. Is it possible to do currently?

you can probably achieve this, but it requires some java script.
First add a "start mouse drag" action, then add a run java script action and finally add a "stop mouse drag" action.

The Java Script can look like this. It gets the saved mouse position and then executes the "Drag Mouse To Position" action.


(async ()=> {
let savedX = await get_number_variable('saved_mouse_position_x');
let savedY = await get_number_variable('saved_mouse_position_y');
let actionDefinition = {

    "BTTPredefinedActionType" : 285,
    "BTTAdditionalActionData" : {
      "BTTMouseMoveX" : savedX,
      "BTTMouseMoveY" : savedY * -1,
      "BTTMouseMoveAnchor" : 0,
      "BTTMouseMoveUnitX" : 0,
      "BTTMouseMoveUnitY" : 0
    }
  };

await trigger_action({json: JSON.stringify(actionDefinition), wait_for_reply: true});

returnToBTT(`${savedX} - ${savedY}`);

})();