Skip to main content
Participating Frequently
September 24, 2019
Answered

Automate multiple Measurment log exports

  • September 24, 2019
  • 9 replies
  • 1306 views

Hello Community,

 

I need your brain power!

 

I am aiming to export the measurment log from an action that I have created for +100 photos, the action works great!

 

BUT, I either have to stop and individually name each exported Measurment Log (.txt file) or the automation will overwrite the excel sheet only providing the last images' measurments from the log..

 

I have added the menu item 'export measurements' to my action but this method forces me to name each text file as the batch process is running.

 

I want the text file (measurement log results) to have the same name as the photo that it took measurments from for each photo I batch. 

 

Words from the wise?

 

Thank you,

Brooke

This topic has been closed for replies.
Correct answer Chuck Uebele

Okay, try this. It might need some tweaking for what you're doing.

#target photoshop
var srcFolder = new Folder('~/desktop/MOOP_VYNl/');

var saveFolder = new Folder'~/desktop/Batch_out/')

if(!saveFolder.exists){saveFolder.create()};

var searchMask = '*.jpg';
var fileList = srcFolder.getFiles(searchMask);

for(var i =0;i <fileList.length;i++){
    var doc = open(fileList[i]); 
    var docName = doc.name.split('.')[0];
    playAction ();
    saveLog (docName);
    deleteLog ();    
    doc.close(SaveOptions.DONOTSAVECHANGES)
    }

function playAction(){
    var idPly = charIDToTypeID( "Ply " );
        var desc2 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref1 = new ActionReference();
            var idActn = charIDToTypeID( "Actn" );
            ref1.putName( idActn, "MY_MOOPY" );
            var idASet = charIDToTypeID( "ASet" );
            ref1.putName( idASet, "MOOPV5" );
        desc2.putReference( idnull, ref1 );
    executeAction( idPly, desc2, DialogModes.NO );    
    }

function saveLog(fName){
    var idexportMeasurements = stringIDToTypeID( "exportMeasurements" );
    var desc11 = new ActionDescriptor();
    var idFile = charIDToTypeID( "File" );
    desc11.putPath( idFile, new File( saveFolder +'/'+fName + '.txt') );
    executeAction( idexportMeasurements, desc11, DialogModes.NO );
    }    

function deleteLog(){
    var iddeleteMeasurements = stringIDToTypeID( "deleteMeasurements" );
        var desc28 = new ActionDescriptor();
    executeAction( iddeleteMeasurements, desc28, DialogModes.NO );    
    }
    
function recordLog(){
    var idrecordMeasurements = stringIDToTypeID( "recordMeasurements" );
        var desc25 = new ActionDescriptor();
        var idSrce = charIDToTypeID( "Srce" );
        var idmeasurementSource = stringIDToTypeID( "measurementSource" );
        var idfsel = charIDToTypeID( "fsel" );
        desc25.putEnumerated( idSrce, idmeasurementSource, idfsel );
        var iddataPoints = stringIDToTypeID( "dataPoints" );
            var list2 = new ActionList();
            var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
            var idArea = stringIDToTypeID( "Area" );
            list2.putEnumerated( idmeasurementDataPoint, idArea );
        desc25.putList( iddataPoints, list2 );
    executeAction( idrecordMeasurements, desc25, DialogModes.NO );
    }

9 replies

Chuck Uebele
Community Expert
Chuck UebeleCommunity ExpertCorrect answer
Community Expert
September 26, 2019

Okay, try this. It might need some tweaking for what you're doing.

#target photoshop
var srcFolder = new Folder('~/desktop/MOOP_VYNl/');

var saveFolder = new Folder'~/desktop/Batch_out/')

if(!saveFolder.exists){saveFolder.create()};

var searchMask = '*.jpg';
var fileList = srcFolder.getFiles(searchMask);

for(var i =0;i <fileList.length;i++){
    var doc = open(fileList[i]); 
    var docName = doc.name.split('.')[0];
    playAction ();
    saveLog (docName);
    deleteLog ();    
    doc.close(SaveOptions.DONOTSAVECHANGES)
    }

function playAction(){
    var idPly = charIDToTypeID( "Ply " );
        var desc2 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref1 = new ActionReference();
            var idActn = charIDToTypeID( "Actn" );
            ref1.putName( idActn, "MY_MOOPY" );
            var idASet = charIDToTypeID( "ASet" );
            ref1.putName( idASet, "MOOPV5" );
        desc2.putReference( idnull, ref1 );
    executeAction( idPly, desc2, DialogModes.NO );    
    }

function saveLog(fName){
    var idexportMeasurements = stringIDToTypeID( "exportMeasurements" );
    var desc11 = new ActionDescriptor();
    var idFile = charIDToTypeID( "File" );
    desc11.putPath( idFile, new File( saveFolder +'/'+fName + '.txt') );
    executeAction( idexportMeasurements, desc11, DialogModes.NO );
    }    

function deleteLog(){
    var iddeleteMeasurements = stringIDToTypeID( "deleteMeasurements" );
        var desc28 = new ActionDescriptor();
    executeAction( iddeleteMeasurements, desc28, DialogModes.NO );    
    }
    
function recordLog(){
    var idrecordMeasurements = stringIDToTypeID( "recordMeasurements" );
        var desc25 = new ActionDescriptor();
        var idSrce = charIDToTypeID( "Srce" );
        var idmeasurementSource = stringIDToTypeID( "measurementSource" );
        var idfsel = charIDToTypeID( "fsel" );
        desc25.putEnumerated( idSrce, idmeasurementSource, idfsel );
        var iddataPoints = stringIDToTypeID( "dataPoints" );
            var list2 = new ActionList();
            var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
            var idArea = stringIDToTypeID( "Area" );
            list2.putEnumerated( idmeasurementDataPoint, idArea );
        desc25.putList( iddataPoints, list2 );
    executeAction( idrecordMeasurements, desc25, DialogModes.NO );
    }
bstathisAuthor
Participating Frequently
September 26, 2019
Works like a charm! Thank you for your guidance.
Chuck Uebele
Community Expert
Community Expert
September 25, 2019

I will ha e to look later. I have some guest visiting. 

Chuck Uebele
Community Expert
Community Expert
September 25, 2019

Couple things with your code. The #target photoshop should be at the top of the script, but you can probably just remove it. 

You have one file hard coded to open, so only that file will work. Do you want the script to open files? If so, you can remove the section of code that you have and either create an action that will run the script, which you can then use batch processes script to run that action and open all the files. Or you can specify a folder, where the files are, the use a loop statement to open each of them. I'm not near my computer, and on my phone, so writing some sample code is difficult. But something like this:

 

var srcFolder = new Folder('folder path');

var searchMask = '*.psd';

//exchange pad for whatever file type you're opening, or use ???

var fileList = srcFolder.getFiles(searchMask);

for(var i =0;i <fileList.length;i++){

var doc = fileList[i].open();

//enter your code here

//you might need a statement to close the original file:

doc.close(SaveOptions.DONOTSAVECHANGES);

};

bstathisAuthor
Participating Frequently
September 25, 2019

I am getting really close to having a fuctional script! I haven't really done much coding with Photoshop, so your support has been awesome!

 

I want to have the script open all the files in the folder, execute the action for each, save the measurement log as a text file, clear the log and move on to the next folder. I am having some issues with the folder opening and loop statement, I kind of butchered it.. I would appreciate your expertise on the script, below is what I have; 

 

////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var srcFolder = new Folder('C:\\Users\\Bstathis\\Desktop\\MOOP_VYNl');
var searchMask = '*.jpg';
var fileList = srcFolder.getFiles(searchMask);
for(var i =0;i <fileList.length;i++)
var doc = fileList[i].open(); {
var c2t = function (s) {
return app.charIDToTypeID(s); };


File[] files = new File("C:\\Users\\Bstathis\\Desktop\\MOOP_VYNl").listFiles();
for (File file : files) {
if (!file.isFile()) continue;

String[] bits = file.getName().split(".");
if (bits.length > 0 && bits[bits.length - 1].equalsIgnoreCase("jpg")) {

// =======================================================
play();
function play() {
var c2t = function (s) {
return app.charIDToTypeID(s);
};

var s2t = function (s) {
return app.stringIDToTypeID(s);
};

var descriptor = new ActionDescriptor();
var reference = new ActionReference();

reference.putName( s2t( "action" ), "MY_MOOPY" );
reference.putName( s2t( "actionSet" ), "MOOPV5" );
descriptor.putReference( c2t( "null" ), reference );
executeAction( s2t( "play" ), descriptor, DialogModes.NO );
}

// =======================================================

#target photoshop
var doc = activeDocument;

var saveFolder = new Folder("C:\\Users\\Bstathis\\Desktop\\Batch_out\\")
if(!saveFolder.exists){saveFolder.create()};

var docName = doc.name.split('.')[0];

saveLog ();

function saveLog(){
var idexportMeasurements = stringIDToTypeID( "exportMeasurements" );
var desc11 = new ActionDescriptor();
var idFile = charIDToTypeID( "File" );
desc11.putPath( idFile, new File( saveFolder +'/'+docName + '.txt') );
executeAction( idexportMeasurements, desc11, DialogModes.NO );
}

 

 

// =======================================================
deleteMeasurements();
function deleteMeasurements() {
var s2t = function (s) {
return app.stringIDToTypeID(s);
};

var descriptor = new ActionDescriptor();

executeAction( s2t( "deleteMeasurements" ), descriptor, DialogModes.NO );
}

activeDocument.close(SaveOptions.DONOTSAVECHANGES);
}

Chuck Uebele
Community Expert
Community Expert
September 25, 2019

You have to make sure the action points to the script, and that everything is named and in the same place on both machines. That's why I don't use actions much.

bstathisAuthor
Participating Frequently
September 25, 2019

Understandably so! I have attached the script that works for one images but I am not sure how to write the code to have it open a set folder and complete the action for each JPG in the folder. 

 

// =======================================================
open(File( "C:\\Users\\Bstathis\\Desktop\\MOOP_VYNl\\.JPG" ));
function open(dontRecord, forceNotify, null2) {
 var c2t = function (s) {
  return app.charIDToTypeID(s);
 };
 var s2t = function (s) {
  return app.stringIDToTypeID(s);
 };
 var descriptor = new ActionDescriptor();
 descriptor.putBoolean( s2t( "dontRecord" ), dontRecord );
 descriptor.putBoolean( s2t( "forceNotify" ), forceNotify );
 descriptor.putPath( c2t( "null" ), null2 );
 descriptor.putInteger( s2t( "documentID" ), 201 );
 executeAction( s2t( "open" ), descriptor, DialogModes.NO );
}
// =======================================================
play();
function play() {
 var c2t = function (s) {
  return app.charIDToTypeID(s);
 };
 var s2t = function (s) {
  return app.stringIDToTypeID(s);
 };
 var descriptor = new ActionDescriptor();
 var reference = new ActionReference();
 reference.putName( s2t( "action" ), "MY_MOOPY" );
 reference.putName( s2t( "actionSet" ), "MOOP_V4" );
 descriptor.putReference( c2t( "null" ), reference );
 executeAction( s2t( "play" ), descriptor, DialogModes.NO );
}
// =======================================================
#target photoshop
var doc = activeDocument;
var saveFolder = new Folder("C:\\Users\\Bstathis\\Desktop\\Batch_out\\")
if(!saveFolder.exists){saveFolder.create()};
var docName = doc.name.split('.')[0];
saveLog ();
function saveLog(){
    var idexportMeasurements = stringIDToTypeID( "exportMeasurements" );
        var desc11 = new ActionDescriptor();
        var idFile = charIDToTypeID( "File" );
        desc11.putPath( idFile, new File( saveFolder +'/'+docName + '.txt') );
    executeAction( idexportMeasurements, desc11, DialogModes.NO );   
    }
 
 
// =======================================================
deleteMeasurements();
function deleteMeasurements() {
 var s2t = function (s) {
  return app.stringIDToTypeID(s);
 };
 var descriptor = new ActionDescriptor();
 executeAction( s2t( "deleteMeasurements" ), descriptor, DialogModes.NO );
}
Chuck Uebele
Community Expert
Community Expert
September 24, 2019

Look for what each section of the code does in the first couple lines. Usually it's pretty clear to see the sections that you recorded. 

bstathisAuthor
Participating Frequently
September 25, 2019
Thank you so much for your help today! I was able to clean up the code using Developed by CLEAN-SL Tomas Šinkūnas www.rendertom.com! I embedded the script into an action and when I try to send it to a different computer that script isn't staying connected to the action set. Any advice?
Chuck Uebele
Community Expert
Community Expert
September 24, 2019

scriptListener creates a lot of garbage. Get rid of all the modal, state change, etc. Just look for the command for what you a actually recorded.

Chuck Uebele
Community Expert
Community Expert
September 24, 2019

Just saw that you're using VB code. Here is some code, but it's javascript. Maybe it will give you an idea on how to convert it to VB.

#target photoshop
var doc = activeDocument;

var saveFolder = new Folder('~/desktop/Photoshop Measurement Log/')
if(!saveFolder.exists){saveFolder.create()};

var docName = doc.name.split('.')[0];

saveLog ();

function saveLog(){
    var idexportMeasurements = stringIDToTypeID( "exportMeasurements" );
        var desc11 = new ActionDescriptor();
        var idFile = charIDToTypeID( "File" );
        desc11.putPath( idFile, new File( saveFolder +'/'+docName + '.txt') );
    executeAction( idexportMeasurements, desc11, DialogModes.NO );    
    }
bstathisAuthor
Participating Frequently
September 24, 2019

That is helpful but for some reason the Scriptlistener log that I have not edited yet is giving me 8800 error when I try to run the script in photoshop. Photoshop is saying that this command is not available on this version. It's weird because it should be the record of what I just did in photoshop?

 

The JS script from Script Listener log without any edits to follow;

 

// =======================================================
var idinvokeCommand = stringIDToTypeID( "invokeCommand" );
    var desc111 = new ActionDescriptor();
    var idcommandID = stringIDToTypeID( "commandID" );
    desc111.putInteger( idcommandID, -713 );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc111.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idinvokeCommand, desc111, DialogModes.NO );
// =======================================================
var idOpn = charIDToTypeID( "Opn " );
    var desc112 = new ActionDescriptor();
    var iddontRecord = stringIDToTypeID( "dontRecord" );
    desc112.putBoolean( iddontRecord, false );
    var idforceNotify = stringIDToTypeID( "forceNotify" );
    desc112.putBoolean( idforceNotify, true );
    var idnull = charIDToTypeID( "null" );
    desc112.putPath( idnull, new File( "C:\\Users\\Bstathis\\Desktop\\MOOP_VYNl\\IMG_0739.JPG" ) );
    var idDocI = charIDToTypeID( "DocI" );
    desc112.putInteger( idDocI, 288 );
executeAction( idOpn, desc112, DialogModes.NO );
// =======================================================
var idlayersFiltered = stringIDToTypeID( "layersFiltered" );
executeAction( idlayersFiltered, undefined, DialogModes.NO );
// =======================================================
var idinvokeCommand = stringIDToTypeID( "invokeCommand" );
    var desc113 = new ActionDescriptor();
    var idcommandID = stringIDToTypeID( "commandID" );
    desc113.putInteger( idcommandID, 1461 );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc113.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idinvokeCommand, desc113, DialogModes.NO );
// =======================================================
var idautoCutout = stringIDToTypeID( "autoCutout" );
    var desc114 = new ActionDescriptor();
    var idsampleAllLayers = stringIDToTypeID( "sampleAllLayers" );
    desc114.putBoolean( idsampleAllLayers, false );
executeAction( idautoCutout, desc114, DialogModes.NO );
// =======================================================
var idinvokeCommand = stringIDToTypeID( "invokeCommand" );
    var desc115 = new ActionDescriptor();
    var idcommandID = stringIDToTypeID( "commandID" );
    desc115.putInteger( idcommandID, 1044 );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc115.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idinvokeCommand, desc115, DialogModes.NO );
// =======================================================
var idCrop = charIDToTypeID( "Crop" );
    var desc116 = new ActionDescriptor();
    var idT = charIDToTypeID( "T   " );
        var desc117 = new ActionDescriptor();
        var idTop = charIDToTypeID( "Top " );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc117.putUnitDouble( idTop, idRlt, 0.000000 );
        var idLeft = charIDToTypeID( "Left" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc117.putUnitDouble( idLeft, idRlt, 0.000000 );
        var idBtom = charIDToTypeID( "Btom" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc117.putUnitDouble( idBtom, idRlt, 4032.000000 );
        var idRght = charIDToTypeID( "Rght" );
        var idRlt = charIDToTypeID( "#Rlt" );
        desc117.putUnitDouble( idRght, idRlt, 3024.000000 );
    var idRctn = charIDToTypeID( "Rctn" );
    desc116.putObject( idT, idRctn, desc117 );
    var idAngl = charIDToTypeID( "Angl" );
    var idAng = charIDToTypeID( "#Ang" );
    desc116.putUnitDouble( idAngl, idAng, 0.000000 );
    var idDlt = charIDToTypeID( "Dlt " );
    desc116.putBoolean( idDlt, false );
    var idcropAspectRatioModeKey = stringIDToTypeID( "cropAspectRatioModeKey" );
    var idcropAspectRatioModeClass = stringIDToTypeID( "cropAspectRatioModeClass" );
    var idpureAspectRatio = stringIDToTypeID( "pureAspectRatio" );
    desc116.putEnumerated( idcropAspectRatioModeKey, idcropAspectRatioModeClass, idpureAspectRatio );
    var idCnsP = charIDToTypeID( "CnsP" );
    desc116.putBoolean( idCnsP, false );
executeAction( idCrop, desc116, DialogModes.NO );
// =======================================================
var idinvokeCommand = stringIDToTypeID( "invokeCommand" );
    var desc118 = new ActionDescriptor();
    var idcommandID = stringIDToTypeID( "commandID" );
    desc118.putInteger( idcommandID, 2842 );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc118.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idinvokeCommand, desc118, DialogModes.NO );
// =======================================================
var idmodalStateChanged = stringIDToTypeID( "modalStateChanged" );
    var desc119 = new ActionDescriptor();
    var idLvl = charIDToTypeID( "Lvl " );
    desc119.putInteger( idLvl, 1 );
    var idStte = charIDToTypeID( "Stte" );
    var idStte = charIDToTypeID( "Stte" );
    var identer = stringIDToTypeID( "enter" );
    desc119.putEnumerated( idStte, idStte, identer );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc119.putBoolean( idkcanDispatchWhileModal, true );
    var idTtl = charIDToTypeID( "Ttl " );
    desc119.putString( idTtl, """Measurement Scale""" );
executeAction( idmodalStateChanged, desc119, DialogModes.NO );
// =======================================================
var idtoolModalStateChanged = stringIDToTypeID( "toolModalStateChanged" );
    var desc120 = new ActionDescriptor();
    var idLvl = charIDToTypeID( "Lvl " );
    desc120.putInteger( idLvl, 1 );
    var idStte = charIDToTypeID( "Stte" );
    var idStte = charIDToTypeID( "Stte" );
    var identer = stringIDToTypeID( "enter" );
    desc120.putEnumerated( idStte, idStte, identer );
    var idTool = charIDToTypeID( "Tool" );
        var desc121 = new ActionDescriptor();
        var idIdnt = charIDToTypeID( "Idnt" );
        desc121.putString( idIdnt, """meaT""" );
        var idTtl = charIDToTypeID( "Ttl " );
        desc121.putString( idTtl, """Ruler Tool""" );
    var idTool = charIDToTypeID( "Tool" );
    desc120.putObject( idTool, idTool, desc121 );
    var idKnd = charIDToTypeID( "Knd " );
    var idKnd = charIDToTypeID( "Knd " );
    var idmouse = stringIDToTypeID( "mouse" );
    desc120.putEnumerated( idKnd, idKnd, idmouse );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc120.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idtoolModalStateChanged, desc120, DialogModes.NO );
// =======================================================
var idtoolModalStateChanged = stringIDToTypeID( "toolModalStateChanged" );
    var desc122 = new ActionDescriptor();
    var idLvl = charIDToTypeID( "Lvl " );
    desc122.putInteger( idLvl, 0 );
    var idStte = charIDToTypeID( "Stte" );
    var idStte = charIDToTypeID( "Stte" );
    var idexit = stringIDToTypeID( "exit" );
    desc122.putEnumerated( idStte, idStte, idexit );
    var idTool = charIDToTypeID( "Tool" );
        var desc123 = new ActionDescriptor();
        var idIdnt = charIDToTypeID( "Idnt" );
        desc123.putString( idIdnt, """meaT""" );
        var idTtl = charIDToTypeID( "Ttl " );
        desc123.putString( idTtl, """Ruler Tool""" );
    var idTool = charIDToTypeID( "Tool" );
    desc122.putObject( idTool, idTool, desc123 );
    var idKnd = charIDToTypeID( "Knd " );
    var idKnd = charIDToTypeID( "Knd " );
    var idmouse = stringIDToTypeID( "mouse" );
    desc122.putEnumerated( idKnd, idKnd, idmouse );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc122.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idtoolModalStateChanged, desc122, DialogModes.NO );
// =======================================================
var idmodalStateChanged = stringIDToTypeID( "modalStateChanged" );
    var desc124 = new ActionDescriptor();
    var idLvl = charIDToTypeID( "Lvl " );
    desc124.putInteger( idLvl, 0 );
    var idStte = charIDToTypeID( "Stte" );
    var idStte = charIDToTypeID( "Stte" );
    var idexit = stringIDToTypeID( "exit" );
    desc124.putEnumerated( idStte, idStte, idexit );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc124.putBoolean( idkcanDispatchWhileModal, true );
    var idTtl = charIDToTypeID( "Ttl " );
    desc124.putString( idTtl, """Measurement Scale""" );
executeAction( idmodalStateChanged, desc124, DialogModes.NO );
// =======================================================
var idsetd = charIDToTypeID( "setd" );
    var desc125 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref10 = new ActionReference();
        var idPrpr = charIDToTypeID( "Prpr" );
        var idmeasurementScale = stringIDToTypeID( "measurementScale" );
        ref10.putProperty( idPrpr, idmeasurementScale );
        var idDcmn = charIDToTypeID( "Dcmn" );
        var idOrdn = charIDToTypeID( "Ordn" );
        var idTrgt = charIDToTypeID( "Trgt" );
        ref10.putEnumerated( idDcmn, idOrdn, idTrgt );
    desc125.putReference( idnull, ref10 );
    var idT = charIDToTypeID( "T   " );
        var desc126 = new ActionDescriptor();
        var idpixelLength = stringIDToTypeID( "pixelLength" );
        desc126.putInteger( idpixelLength, 2912 );
        var idlogicalLength = stringIDToTypeID( "logicalLength" );
        desc126.putDouble( idlogicalLength, 1.000000 );
        var idlogicalUnits = stringIDToTypeID( "logicalUnits" );
        desc126.putString( idlogicalUnits, """Foot""" );
    var idmeasurementScale = stringIDToTypeID( "measurementScale" );
    desc125.putObject( idT, idmeasurementScale, desc126 );
executeAction( idsetd, desc125, DialogModes.NO );
// =======================================================
var idinvokeCommand = stringIDToTypeID( "invokeCommand" );
    var desc127 = new ActionDescriptor();
    var idcommandID = stringIDToTypeID( "commandID" );
    desc127.putInteger( idcommandID, 1152 );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc127.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idinvokeCommand, desc127, DialogModes.NO );
// =======================================================
var idmodalStateChanged = stringIDToTypeID( "modalStateChanged" );
    var desc128 = new ActionDescriptor();
    var idLvl = charIDToTypeID( "Lvl " );
    desc128.putInteger( idLvl, 1 );
    var idStte = charIDToTypeID( "Stte" );
    var idStte = charIDToTypeID( "Stte" );
    var identer = stringIDToTypeID( "enter" );
    desc128.putEnumerated( idStte, idStte, identer );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc128.putBoolean( idkcanDispatchWhileModal, true );
    var idTtl = charIDToTypeID( "Ttl " );
    desc128.putString( idTtl, """Color Range""" );
executeAction( idmodalStateChanged, desc128, DialogModes.NO );
// =======================================================
var idslct = charIDToTypeID( "slct" );
    var desc129 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref11 = new ActionReference();
        var ideyedropperMinusTool = stringIDToTypeID( "eyedropperMinusTool" );
        ref11.putClass( ideyedropperMinusTool );
    desc129.putReference( idnull, ref11 );
    var iddontRecord = stringIDToTypeID( "dontRecord" );
    desc129.putBoolean( iddontRecord, true );
    var idforceNotify = stringIDToTypeID( "forceNotify" );
    desc129.putBoolean( idforceNotify, true );
executeAction( idslct, desc129, DialogModes.NO );
// =======================================================
var idmodalStateChanged = stringIDToTypeID( "modalStateChanged" );
    var desc130 = new ActionDescriptor();
    var idLvl = charIDToTypeID( "Lvl " );
    desc130.putInteger( idLvl, 0 );
    var idStte = charIDToTypeID( "Stte" );
    var idStte = charIDToTypeID( "Stte" );
    var idexit = stringIDToTypeID( "exit" );
    desc130.putEnumerated( idStte, idStte, idexit );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc130.putBoolean( idkcanDispatchWhileModal, true );
    var idTtl = charIDToTypeID( "Ttl " );
    desc130.putString( idTtl, """Color Range""" );
executeAction( idmodalStateChanged, desc130, DialogModes.NO );
// =======================================================
var idClrR = charIDToTypeID( "ClrR" );
    var desc131 = new ActionDescriptor();
    var idFzns = charIDToTypeID( "Fzns" );
    desc131.putInteger( idFzns, 130 );
    var idMnm = charIDToTypeID( "Mnm " );
        var desc132 = new ActionDescriptor();
        var idLmnc = charIDToTypeID( "Lmnc" );
        desc132.putDouble( idLmnc, 37.350000 );
        var idA = charIDToTypeID( "A   " );
        desc132.putDouble( idA, -47.050000 );
        var idB = charIDToTypeID( "B   " );
        desc132.putDouble( idB, 12.700000 );
    var idLbCl = charIDToTypeID( "LbCl" );
    desc131.putObject( idMnm, idLbCl, desc132 );
    var idMxm = charIDToTypeID( "Mxm " );
        var desc133 = new ActionDescriptor();
        var idLmnc = charIDToTypeID( "Lmnc" );
        desc133.putDouble( idLmnc, 68.730000 );
        var idA = charIDToTypeID( "A   " );
        desc133.putDouble( idA, -42.120000 );
        var idB = charIDToTypeID( "B   " );
        desc133.putDouble( idB, 27.590000 );
    var idLbCl = charIDToTypeID( "LbCl" );
    desc131.putObject( idMxm, idLbCl, desc133 );
    var idInvr = charIDToTypeID( "Invr" );
    desc131.putBoolean( idInvr, true );
    var idcolorModel = stringIDToTypeID( "colorModel" );
    desc131.putInteger( idcolorModel, 0 );
executeAction( idClrR, desc131, DialogModes.NO );
// =======================================================
var idrecordMeasurements = stringIDToTypeID( "recordMeasurements" );
    var desc134 = new ActionDescriptor();
    var idSrce = charIDToTypeID( "Srce" );
    var idmeasurementSource = stringIDToTypeID( "measurementSource" );
    var idfsel = charIDToTypeID( "fsel" );
    desc134.putEnumerated( idSrce, idmeasurementSource, idfsel );
    var iddataPoints = stringIDToTypeID( "dataPoints" );
        var list4 = new ActionList();
        var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
        var idArea = stringIDToTypeID( "Area" );
        list4.putEnumerated( idmeasurementDataPoint, idArea );
        var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
        var idDocument = stringIDToTypeID( "Document" );
        list4.putEnumerated( idmeasurementDataPoint, idDocument );
        var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
        var idScaleUnits = stringIDToTypeID( "ScaleUnits" );
        list4.putEnumerated( idmeasurementDataPoint, idScaleUnits );
    desc134.putList( iddataPoints, list4 );
executeAction( idrecordMeasurements, desc134, DialogModes.NO );
// =======================================================
var idinvokeCommand = stringIDToTypeID( "invokeCommand" );
    var desc135 = new ActionDescriptor();
    var idcommandID = stringIDToTypeID( "commandID" );
    desc135.putInteger( idcommandID, 2885 );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc135.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idinvokeCommand, desc135, DialogModes.NO );
// =======================================================
var idexportMeasurements = stringIDToTypeID( "exportMeasurements" );
    var desc136 = new ActionDescriptor();
    var idFile = charIDToTypeID( "File" );
    desc136.putPath( idFile, new File( "C:\\Users\\Bstathis\\Desktop\\MOOP_OUT_091719\\LETSGOOOO.txt)" ) );
executeAction( idexportMeasurements, desc136, DialogModes.NO );
// =======================================================
var iddeleteMeasurements = stringIDToTypeID( "deleteMeasurements" );
    var desc137 = new ActionDescriptor();
executeAction( iddeleteMeasurements, desc137, DialogModes.NO );
// =======================================================
var idinvokeCommand = stringIDToTypeID( "invokeCommand" );
    var desc138 = new ActionDescriptor();
    var idcommandID = stringIDToTypeID( "commandID" );
    desc138.putInteger( idcommandID, 1016 );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc138.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idinvokeCommand, desc138, DialogModes.NO );
// =======================================================
var idsetd = charIDToTypeID( "setd" );
    var desc139 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
        var ref12 = new ActionReference();
        var idChnl = charIDToTypeID( "Chnl" );
        var idfsel = charIDToTypeID( "fsel" );
        ref12.putProperty( idChnl, idfsel );
    desc139.putReference( idnull, ref12 );
    var idT = charIDToTypeID( "T   " );
    var idOrdn = charIDToTypeID( "Ordn" );
    var idNone = charIDToTypeID( "None" );
    desc139.putEnumerated( idT, idOrdn, idNone );
executeAction( idsetd, desc139, DialogModes.NO );
Chuck Uebele
Community Expert
Community Expert
September 24, 2019

It all depends on your workflow. How are you saving the logs currently? Are you making a bunch of measurements then saving all the recodings, or are you making them at separate times then saving them. It doesn't look like you can loop through an existing log, and select each recording. So I'm assuming that you will need to run the script, save the file, then later run the script again, but not have it overwrite then second or other times you run the script.

bstathisAuthor
Participating Frequently
September 24, 2019

Hello,

Thanks for your interest in helping!

 

The action I created works as follows;

 

1. Select subject

2. Image>Crop

3. Set Measurement scale

4. Select> Color Range

5. Record Measurements 

6. Export Measurements (this is the step that is giving me a hard time)

7. Delete Measurement log

 

From this action I want to run a batch of photos to record the area of selected objects per inputted image, but I keep having to type in the exported measurement file name for each images processed (if I set the 'export measurements' step as a Menu Item). If I record the action without setting 'export measurements' as a menu item the same exported measurement file is being overwritten by the processed images.

 

I want to change the end of the code to save exported measurement with the same name as the inputted image but it would be a text file. 

 

This is the full script so far - I think I just need to change the orange text section.. 

 

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idinvokeCommand
idinvokeCommand = objApp.StringIDToTypeID( "invokeCommand" )
DIM desc38
SET desc38 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idcommandID
idcommandID = objApp.StringIDToTypeID( "commandID" )
Call desc38.PutInteger( idcommandID, 1461 )
DIM idkcanDispatchWhileModal
idkcanDispatchWhileModal = objApp.StringIDToTypeID( "kcanDispatchWhileModal" )
Call desc38.PutBoolean( idkcanDispatchWhileModal, True )
Call objApp.ExecuteAction( idinvokeCommand, desc38, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idautoCutout
idautoCutout = objApp.StringIDToTypeID( "autoCutout" )
DIM desc39
SET desc39 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idsampleAllLayers
idsampleAllLayers = objApp.StringIDToTypeID( "sampleAllLayers" )
Call desc39.PutBoolean( idsampleAllLayers, False )
Call objApp.ExecuteAction( idautoCutout, desc39, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idinvokeCommand
idinvokeCommand = objApp.StringIDToTypeID( "invokeCommand" )
DIM desc40
SET desc40 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idcommandID
idcommandID = objApp.StringIDToTypeID( "commandID" )
Call desc40.PutInteger( idcommandID, 1044 )
DIM idkcanDispatchWhileModal
idkcanDispatchWhileModal = objApp.StringIDToTypeID( "kcanDispatchWhileModal" )
Call desc40.PutBoolean( idkcanDispatchWhileModal, True )
Call objApp.ExecuteAction( idinvokeCommand, desc40, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idCrop
idCrop = objApp.CharIDToTypeID( "Crop" )
DIM desc41
SET desc41 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idDlt
idDlt = objApp.CharIDToTypeID( "Dlt " )
Call desc41.PutBoolean( idDlt, True )
Call objApp.ExecuteAction( idCrop, desc41, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idinvokeCommand
idinvokeCommand = objApp.StringIDToTypeID( "invokeCommand" )
DIM desc42
SET desc42 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idcommandID
idcommandID = objApp.StringIDToTypeID( "commandID" )
Call desc42.PutInteger( idcommandID, 2842 )
DIM idkcanDispatchWhileModal
idkcanDispatchWhileModal = objApp.StringIDToTypeID( "kcanDispatchWhileModal" )
Call desc42.PutBoolean( idkcanDispatchWhileModal, True )
Call objApp.ExecuteAction( idinvokeCommand, desc42, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idmodalStateChanged
idmodalStateChanged = objApp.StringIDToTypeID( "modalStateChanged" )
DIM desc43
SET desc43 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idLvl
idLvl = objApp.CharIDToTypeID( "Lvl " )
Call desc43.PutInteger( idLvl, 1 )
DIM idStte
idStte = objApp.CharIDToTypeID( "Stte" )
DIM idStte
idStte = objApp.CharIDToTypeID( "Stte" )
DIM identer
identer = objApp.StringIDToTypeID( "enter" )
Call desc43.PutEnumerated( idStte, idStte, identer )
DIM idkcanDispatchWhileModal
idkcanDispatchWhileModal = objApp.StringIDToTypeID( "kcanDispatchWhileModal" )
Call desc43.PutBoolean( idkcanDispatchWhileModal, True )
DIM idTtl
idTtl = objApp.CharIDToTypeID( "Ttl " )
Call desc43.PutString( idTtl, "Measurement Scale" )
Call objApp.ExecuteAction( idmodalStateChanged, desc43, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idmodalStateChanged
idmodalStateChanged = objApp.StringIDToTypeID( "modalStateChanged" )
DIM desc44
SET desc44 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idLvl
idLvl = objApp.CharIDToTypeID( "Lvl " )
Call desc44.PutInteger( idLvl, 0 )
DIM idStte
idStte = objApp.CharIDToTypeID( "Stte" )
DIM idStte
idStte = objApp.CharIDToTypeID( "Stte" )
DIM idexit
idexit = objApp.StringIDToTypeID( "exit" )
Call desc44.PutEnumerated( idStte, idStte, idexit )
DIM idkcanDispatchWhileModal
idkcanDispatchWhileModal = objApp.StringIDToTypeID( "kcanDispatchWhileModal" )
Call desc44.PutBoolean( idkcanDispatchWhileModal, True )
DIM idTtl
idTtl = objApp.CharIDToTypeID( "Ttl " )
Call desc44.PutString( idTtl, "Measurement Scale" )
Call objApp.ExecuteAction( idmodalStateChanged, desc44, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idinvokeCommand
idinvokeCommand = objApp.StringIDToTypeID( "invokeCommand" )
DIM desc45
SET desc45 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idcommandID
idcommandID = objApp.StringIDToTypeID( "commandID" )
Call desc45.PutInteger( idcommandID, 1152 )
DIM idkcanDispatchWhileModal
idkcanDispatchWhileModal = objApp.StringIDToTypeID( "kcanDispatchWhileModal" )
Call desc45.PutBoolean( idkcanDispatchWhileModal, True )
Call objApp.ExecuteAction( idinvokeCommand, desc45, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idmodalStateChanged
idmodalStateChanged = objApp.StringIDToTypeID( "modalStateChanged" )
DIM desc46
SET desc46 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idLvl
idLvl = objApp.CharIDToTypeID( "Lvl " )
Call desc46.PutInteger( idLvl, 1 )
DIM idStte
idStte = objApp.CharIDToTypeID( "Stte" )
DIM idStte
idStte = objApp.CharIDToTypeID( "Stte" )
DIM identer
identer = objApp.StringIDToTypeID( "enter" )
Call desc46.PutEnumerated( idStte, idStte, identer )
DIM idkcanDispatchWhileModal
idkcanDispatchWhileModal = objApp.StringIDToTypeID( "kcanDispatchWhileModal" )
Call desc46.PutBoolean( idkcanDispatchWhileModal, True )
DIM idTtl
idTtl = objApp.CharIDToTypeID( "Ttl " )
Call desc46.PutString( idTtl, "Color Range" )
Call objApp.ExecuteAction( idmodalStateChanged, desc46, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idmodalStateChanged
idmodalStateChanged = objApp.StringIDToTypeID( "modalStateChanged" )
DIM desc47
SET desc47 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idLvl
idLvl = objApp.CharIDToTypeID( "Lvl " )
Call desc47.PutInteger( idLvl, 0 )
DIM idStte
idStte = objApp.CharIDToTypeID( "Stte" )
DIM idStte
idStte = objApp.CharIDToTypeID( "Stte" )
DIM idexit
idexit = objApp.StringIDToTypeID( "exit" )
Call desc47.PutEnumerated( idStte, idStte, idexit )
DIM idkcanDispatchWhileModal
idkcanDispatchWhileModal = objApp.StringIDToTypeID( "kcanDispatchWhileModal" )
Call desc47.PutBoolean( idkcanDispatchWhileModal, True )
DIM idTtl
idTtl = objApp.CharIDToTypeID( "Ttl " )
Call desc47.PutString( idTtl, "Color Range" )
Call objApp.ExecuteAction( idmodalStateChanged, desc47, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idClrR
idClrR = objApp.CharIDToTypeID( "ClrR" )
DIM desc48
SET desc48 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idFzns
idFzns = objApp.CharIDToTypeID( "Fzns" )
Call desc48.PutInteger( idFzns, 130 )
DIM idMnm
idMnm = objApp.CharIDToTypeID( "Mnm " )
DIM desc49
SET desc49 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idLmnc
idLmnc = objApp.CharIDToTypeID( "Lmnc" )
Call desc49.PutDouble( idLmnc, 37.350000 )
DIM idA
idA = objApp.CharIDToTypeID( "A " )
Call desc49.PutDouble( idA, -47.050000 )
DIM idB
idB = objApp.CharIDToTypeID( "B " )
Call desc49.PutDouble( idB, 12.410000 )
DIM idLbCl
idLbCl = objApp.CharIDToTypeID( "LbCl" )
Call desc48.PutObject( idMnm, idLbCl, desc49 )
DIM idMxm
idMxm = objApp.CharIDToTypeID( "Mxm " )
DIM desc50
SET desc50 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idLmnc
idLmnc = objApp.CharIDToTypeID( "Lmnc" )
Call desc50.PutDouble( idLmnc, 78.760000 )
DIM idA
idA = objApp.CharIDToTypeID( "A " )
Call desc50.PutDouble( idA, -36.310000 )
DIM idB
idB = objApp.CharIDToTypeID( "B " )
Call desc50.PutDouble( idB, 27.590000 )
DIM idLbCl
idLbCl = objApp.CharIDToTypeID( "LbCl" )
Call desc48.PutObject( idMxm, idLbCl, desc50 )
DIM idInvr
idInvr = objApp.CharIDToTypeID( "Invr" )
Call desc48.PutBoolean( idInvr, True )
DIM idcolorModel
idcolorModel = objApp.StringIDToTypeID( "colorModel" )
Call desc48.PutInteger( idcolorModel, 0 )
Call objApp.ExecuteAction( idClrR, desc48, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idrecordMeasurements
idrecordMeasurements = objApp.StringIDToTypeID( "recordMeasurements" )
DIM desc51
SET desc51 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idSrce
idSrce = objApp.CharIDToTypeID( "Srce" )
DIM idmeasurementSource
idmeasurementSource = objApp.StringIDToTypeID( "measurementSource" )
DIM idfsel
idfsel = objApp.CharIDToTypeID( "fsel" )
Call desc51.PutEnumerated( idSrce, idmeasurementSource, idfsel )
DIM iddataPoints
iddataPoints = objApp.StringIDToTypeID( "dataPoints" )
DIM list2
SET list2 = CreateObject( "Photoshop.ActionList" )
DIM idmeasurementDataPoint
idmeasurementDataPoint = objApp.StringIDToTypeID( "measurementDataPoint" )
DIM idArea
idArea = objApp.StringIDToTypeID( "Area" )
Call list2.PutEnumerated( idmeasurementDataPoint, idArea )
DIM idmeasurementDataPoint
idmeasurementDataPoint = objApp.StringIDToTypeID( "measurementDataPoint" )
DIM idDocument
idDocument = objApp.StringIDToTypeID( "Document" )
Call list2.PutEnumerated( idmeasurementDataPoint, idDocument )
DIM idmeasurementDataPoint
idmeasurementDataPoint = objApp.StringIDToTypeID( "measurementDataPoint" )
DIM idScaleUnits
idScaleUnits = objApp.StringIDToTypeID( "ScaleUnits" )
Call list2.PutEnumerated( idmeasurementDataPoint, idScaleUnits )
Call desc51.PutList( iddataPoints, list2 )
Call objApp.ExecuteAction( idrecordMeasurements, desc51, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idinvokeCommand
idinvokeCommand = objApp.StringIDToTypeID( "invokeCommand" )
DIM desc52
SET desc52 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idcommandID
idcommandID = objApp.StringIDToTypeID( "commandID" )
Call desc52.PutInteger( idcommandID, 2885 )
DIM idkcanDispatchWhileModal
idkcanDispatchWhileModal = objApp.StringIDToTypeID( "kcanDispatchWhileModal" )
Call desc52.PutBoolean( idkcanDispatchWhileModal, True )
Call objApp.ExecuteAction( idinvokeCommand, desc52, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idexportMeasurements
idexportMeasurements = objApp.StringIDToTypeID( "exportMeasurements" )
DIM desc53
SET desc53 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idFile
idFile = objApp.CharIDToTypeID( "File" )
Call desc53.PutPath( idFile, "C:\\Users\\Bstathis\\Desktop\\Batch_out\\IMG_0743.txt)" )
Call objApp.ExecuteAction( idexportMeasurements, desc53, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idinvokeCommand
idinvokeCommand = objApp.StringIDToTypeID( "invokeCommand" )
DIM desc54
SET desc54 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idcommandID
idcommandID = objApp.StringIDToTypeID( "commandID" )
Call desc54.PutInteger( idcommandID, 1016 )
DIM idkcanDispatchWhileModal
idkcanDispatchWhileModal = objApp.StringIDToTypeID( "kcanDispatchWhileModal" )
Call desc54.PutBoolean( idkcanDispatchWhileModal, True )
Call objApp.ExecuteAction( idinvokeCommand, desc54, dialogMode )

REM =======================================================
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
REM Use dialog mode 3 for show no dialogs
DIM dialogMode
dialogMode = 3
DIM idsetd
idsetd = objApp.CharIDToTypeID( "setd" )
DIM desc55
SET desc55 = CreateObject( "Photoshop.ActionDescriptor" )
DIM idnull
idnull = objApp.CharIDToTypeID( "null" )
DIM ref6
SET ref6 = CreateObject( "Photoshop.ActionReference" )
DIM idChnl
idChnl = objApp.CharIDToTypeID( "Chnl" )
DIM idfsel
idfsel = objApp.CharIDToTypeID( "fsel" )
Call ref6.PutProperty( idChnl, idfsel )
Call desc55.PutReference( idnull, ref6 )
DIM idT
idT = objApp.CharIDToTypeID( "T " )
DIM idOrdn
idOrdn = objApp.CharIDToTypeID( "Ordn" )
DIM idNone
idNone = objApp.CharIDToTypeID( "None" )
Call desc55.PutEnumerated( idT, idOrdn, idNone )
Call objApp.ExecuteAction( idsetd, desc55, dialogMode )

Chuck Uebele
Community Expert
Community Expert
September 24, 2019

You most likely will have to do this with scripting. The scriptListener plugin should be able to record what you have in the action, then you just have to create some code to save the text file. 

bstathisAuthor
Participating Frequently
September 24, 2019
Thank you! I went ahead and used the ScriptListener plugin. Any advice for the code that could be used for saving text under the same name as input name? REM ======================================================= DIM objApp SET objApp = CreateObject("Photoshop.Application") REM Use dialog mode 3 for show no dialogs DIM dialogMode dialogMode = 3 DIM idexportMeasurements idexportMeasurements = objApp.StringIDToTypeID( "exportMeasurements" ) DIM desc53 SET desc53 = CreateObject( "Photoshop.ActionDescriptor" ) DIM idFile idFile = objApp.CharIDToTypeID( "File" ) Call desc53.PutPath( idFile, "C:\\Users\\Bstathis\\Desktop\\Batch_out\\IMG_0743.txt)" ) Call objApp.ExecuteAction( idexportMeasurements, desc53, dialogMode )