• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

287

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

LEGEND , Mar 17, 2021 Mar 17, 2021
UnitValue(AD.width.as('px'),'px') * 2

Votes

Translate

Translate
Adobe
LEGEND ,
Mar 17, 2021 Mar 17, 2021

Copy link to clipboard

Copied

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

Votes

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

 

Votes

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
Community Expert ,
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?

Votes

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

LATEST

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

Votes

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