Measure points of ruler tool

How can I take measurements of the beginning and end of a ruler in UXP? If this is not possible, is there a way to take the curvature tool points?

You mean, taking points of a ruler made by ruler tool?

const {executeAsModal} = require("photoshop").core;
const {batchPlay} = require("photoshop").action;

async function actionCommands() {
   const result = await batchPlay(
      [
         {
            _obj: "get",
            _target: [
               {
                  _property: "rulerPoints"
               },
               {
                  _ref: "document",
                  _id: app.activeDocument.id
               }
            ],
            _options: {
               dialogOptions: "dontDisplay"
            }
         }
      ],
      {}
   );
}

async function runModalFunction() {
   await executeAsModal(actionCommands, {"commandName": "Action Commands"});
}

await runModalFunction();

1 Like

Thank you very much, it helped. For some reason, it returned three points from the ruler, two of which are the same. But this is not a problem, I will just add what the method returns for other readers.