My end-goal is to create a script that allows you to press a hotkey and “snap” or set the position of a selected layer to the position of your mouse cursor in the After Effects viewer. Basically I have to hand position a lot of elements or track things to video a lot and I would like to just press a button or click and have a layer snap to where my mouse is pointing.
The two images below show what information I’m hoping to get. When my mouse is in the corner of the comp you can see the Info window is able to display that my mouse is currently near 0,0 in comp space, at precisely -8,-8 pixels.
I would like to get exactly that data from the Info panel if possible, but if not I would love to know if there is a workaround that will allow me to get the cursor relative to the dimensions of the comp. Perhaps I need to autofit the viewer to comp size, and then create a new ScriptUI window to get the mouse position? Or maybe I can get the mouse position *based* on the viewer window itself without creating a new window?
Thanks in advance if you can shed some light on this!