Copy link to clipboard
Copied
I have this dialog box where I am told the width of the document
I would like this width to be automatically multiplied x 2
therefore instead of the value 3095
the value 6190 must come out
// script
var AD = activeDocument;
var originalUnits = app.preferences.rulerUnits;
app.preferences.rulerUnits = Units.PIXELS;
var dlg = new Window('dialog','document size');
dlg.gp1 = dlg.add('group');
dlg.gp1.orientation = 'row';
dlg.gp1.sTxt = dlg.gp1.add('statictext', undefined, ' ' + new UnitValue(AD.width.as('px'),'px') );
dlg.btnGp = dlg.add('group');
dlg.btnGp.ok = dlg.btnGp.add('button',undefined,'ok');
dlg.btnGp.cancel = dlg.btnGp.add('button',undefined,'cancel');
dlg.btnGp.ok.onClick = function() {
app.preferences.rulerUnits = originalUnits;
dlg.close();
}
dlg.btnGp.cancel.onClick = function() {
dlg.close();
}
dlg.show();
UnitValue(AD.width.as('px'),'px') * 2
Copy link to clipboard
Copied
UnitValue(AD.width.as('px'),'px') * 2
Copy link to clipboard
Copied
Always kind
thank you
Copy link to clipboard
Copied
Line 3 sets the units as pixels, therefore I would have thought that:
new UnitValue(AD.width.as('px'),'px')
Is redundant and could be simplified to:
new UnitValue(AD.width)
Why make it px twice?
Copy link to clipboard
Copied
Kukurykus he answered correctly to what I asked but your note I find it right thank you