# How can I extract cursor coordinate in Adobe Photoshop for use in Action script? [closed]

What I want to do in Photoshop (version CC, but I think this applies to any version) is label a point using count tool under my mouse's current position, and label it multiple times (for different labels). I have an macro action that essentially does this:

(1) Add to count (under one label) (2) Switch to second label (3) Add to count (under second label) (4) Switch to third label (5) Add to count (under third label)

And the problem is that I need to be able to have a variable in the action script that uses the cursor's current position (X and Y numbers) on the canvas to set these three points when the macro is activated. Currently I am only able to record the script using constant X, Y values (the same point is labeled over and over when I play the recorded action). I am able to extract the code for the action for editing (via xbytor2's suggestion in this forum: https://forums.adobe.com/thread/696989) and I see where the variable can go, I just don't know what exactly to put in place of the constant X, Y values that will let Photoshop input the mouse's current coordinates...

Any ideas? Much appreciated!!

## closed as off-topic by Ryan♦Nov 19 '15 at 17:19

• This question does not appear to be about graphic design within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

• Could you post your code or at least the part you want to get working? – KJP Apr 20 '15 at 12:01
• Yes of course! The values that I want replaced are 990.5 for X and 421.5 for Y: – user42420 Apr 21 '15 at 23:51
• -<ActionItem key="TEXT" expanded="true" name="Add To Count" hasDescriptor="true" event="countAdd" identifier="TEXT" dialogOptions="0" withDialog="true" enabled="true"> -<ActionDescriptor key="countAdd" count="2"> <DescValueType.DOUBLETYPE key="1478500384" double="990.5" sym="X " symname="X" id="1478500384"/> <DescValueType.DOUBLETYPE key="1495277600" double="421.5" sym="Y " symname="Y" id="1495277600"/> </ActionDescriptor> – user42420 Apr 21 '15 at 23:53
• I'm closing this question because it has nothing to do with design and is too old to migrate. – Ryan Nov 19 '15 at 17:19

There may not be an easy solution to your problem. However, using the ScriptingListener plugin may help. It produces javascript like this:

var list4 = new ActionList();
var desc33 = new ActionDescriptor();
var idHrzn = charIDToTypeID( "Hrzn" );
var idPxl = charIDToTypeID( "#Pxl" );
desc33.putUnitDouble( idHrzn, idPxl, 148);
var idVrtc = charIDToTypeID( "Vrtc" );
var idPxl = charIDToTypeID( "#Pxl" );
desc33.putUnitDouble( idVrtc, idPxl, 358 );
var idPnt = charIDToTypeID( "Pnt " );
list4.putObject( idPnt, desc33 );


As you can see, this is pretty much akin to you action xml so it might help. Although, it's a few years old, here's the link to installing and using it from Adobe's site: ScriptingListener plug-in