double document size

Advocate ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

I have this dialog box where I am told the width of the document

Schermata 2021-03-17 alle 13.42.21.png

 

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();  

 

TOPICS
Actions and scripting

Views

70

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Mar 17, 2021 Mar 17, 2021
UnitValue(AD.width.as('px'),'px') * 2

Likes

translate

Translate

Translate
Adobe Community Professional ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

UnitValue(AD.width.as('px'),'px') * 2

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

Always kind
thank you

 

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 18, 2021 Mar 18, 2021

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?

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

Kukurykus he answered correctly to what I asked but your note I find it right thank you

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines