revnart
Power User
- Messages
- 362
- Likes
- 327
Hi I have a question
Maybe some great minds of PSG will be able to help
On a daily basis I deal mainly with car wrapping, and part of it is calculating square meters of print vinyl needed.
I use measurement scale for that because I can select multiple parts of car with simple selection, change measurement scale and record measurements to show me each element square meters and sum of all elements.
Using Script Listener I created this script which change measurement scale to one I want and record measurements:
the part when it fails is when document is not in 72PPI.
Is there a way to add prompt on the beginning of script which will alert me if file is not in 72 PPI and eventually change it to 72PPI?
Maybe some great minds of PSG will be able to help
On a daily basis I deal mainly with car wrapping, and part of it is calculating square meters of print vinyl needed.
I use measurement scale for that because I can select multiple parts of car with simple selection, change measurement scale and record measurements to show me each element square meters and sum of all elements.
Using Script Listener I created this script which change measurement scale to one I want and record measurements:
Code:
// =======================================================var idsetd = charIDToTypeID( "setd" );
var desc8 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref4 = new ActionReference();
var idPrpr = charIDToTypeID( "Prpr" );
var idmeasurementScale = stringIDToTypeID( "measurementScale" );
ref4.putProperty( idPrpr, idmeasurementScale );
var idDcmn = charIDToTypeID( "Dcmn" );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref4.putEnumerated( idDcmn, idOrdn, idTrgt );
desc8.putReference( idnull, ref4 );
var idT = charIDToTypeID( "T " );
var desc9 = new ActionDescriptor();
var idNm = charIDToTypeID( "Nm " );
desc9.putString( idNm, "85px_to_3cm" );
var idpixelLength = stringIDToTypeID( "pixelLength" );
desc9.putInteger( idpixelLength, 85 );
var idlogicalLength = stringIDToTypeID( "logicalLength" );
desc9.putDouble( idlogicalLength, 3.000000 );
var idlogicalUnits = stringIDToTypeID( "logicalUnits" );
desc9.putString( idlogicalUnits, "cm" );
var idmeasurementScale = stringIDToTypeID( "measurementScale" );
desc8.putObject( idT, idmeasurementScale, desc9 );
executeAction( idsetd, desc8, DialogModes.NO );
// =======================================================
var idrecordMeasurements = stringIDToTypeID( "recordMeasurements" );
var desc10 = new ActionDescriptor();
var idSrce = charIDToTypeID( "Srce" );
var idmeasurementSource = stringIDToTypeID( "measurementSource" );
var idfsel = charIDToTypeID( "fsel" );
desc10.putEnumerated( idSrce, idmeasurementSource, idfsel );
var iddataPoints = stringIDToTypeID( "dataPoints" );
var list1 = new ActionList();
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idAngle = stringIDToTypeID( "Angle" );
list1.putEnumerated( idmeasurementDataPoint, idAngle );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idArea = stringIDToTypeID( "Area" );
list1.putEnumerated( idmeasurementDataPoint, idArea );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idCircularity = stringIDToTypeID( "Circularity" );
list1.putEnumerated( idmeasurementDataPoint, idCircularity );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idCount = stringIDToTypeID( "Count" );
list1.putEnumerated( idmeasurementDataPoint, idCount );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idDateTime = stringIDToTypeID( "DateTime" );
list1.putEnumerated( idmeasurementDataPoint, idDateTime );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idDocument = stringIDToTypeID( "Document" );
list1.putEnumerated( idmeasurementDataPoint, idDocument );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idGrayValueMaximum = stringIDToTypeID( "GrayValueMaximum" );
list1.putEnumerated( idmeasurementDataPoint, idGrayValueMaximum );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idGrayValueMean = stringIDToTypeID( "GrayValueMean" );
list1.putEnumerated( idmeasurementDataPoint, idGrayValueMean );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idGrayValueMedian = stringIDToTypeID( "GrayValueMedian" );
list1.putEnumerated( idmeasurementDataPoint, idGrayValueMedian );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idGrayValueMinimum = stringIDToTypeID( "GrayValueMinimum" );
list1.putEnumerated( idmeasurementDataPoint, idGrayValueMinimum );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idHeight = stringIDToTypeID( "Height" );
list1.putEnumerated( idmeasurementDataPoint, idHeight );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idHistogram = stringIDToTypeID( "Histogram" );
list1.putEnumerated( idmeasurementDataPoint, idHistogram );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idIntegratedDensity = stringIDToTypeID( "IntegratedDensity" );
list1.putEnumerated( idmeasurementDataPoint, idIntegratedDensity );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idLabel = stringIDToTypeID( "Label" );
list1.putEnumerated( idmeasurementDataPoint, idLabel );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idLength = stringIDToTypeID( "Length" );
list1.putEnumerated( idmeasurementDataPoint, idLength );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idPerimeter = stringIDToTypeID( "Perimeter" );
list1.putEnumerated( idmeasurementDataPoint, idPerimeter );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idScale = stringIDToTypeID( "Scale" );
list1.putEnumerated( idmeasurementDataPoint, idScale );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idScaleFactor = stringIDToTypeID( "ScaleFactor" );
list1.putEnumerated( idmeasurementDataPoint, idScaleFactor );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idScaleUnits = stringIDToTypeID( "ScaleUnits" );
list1.putEnumerated( idmeasurementDataPoint, idScaleUnits );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idSource = stringIDToTypeID( "Source" );
list1.putEnumerated( idmeasurementDataPoint, idSource );
var idmeasurementDataPoint = stringIDToTypeID( "measurementDataPoint" );
var idWidth = stringIDToTypeID( "Width" );
list1.putEnumerated( idmeasurementDataPoint, idWidth );
desc10.putList( iddataPoints, list1 );
executeAction( idrecordMeasurements, desc10, DialogModes.NO );
the part when it fails is when document is not in 72PPI.
Is there a way to add prompt on the beginning of script which will alert me if file is not in 72 PPI and eventually change it to 72PPI?