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

Frame size changed when run script in other device, why?

Participant ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

Hey everyone,

 

I've developed a function. Anyhow, the function on my device (Mac - Catalina) works smothely and when i run it on the designer devoce (Mac - Mohave) It raise an issue. Actully it's simple one, only the fitting differs from mine to his. The items on the document on my device looks good but on his looks very large! 

 

How can i solve the issue? and what could cause the issue? cause we doubled check the setting and we have the same sittings. 

 

Thanks all.

TOPICS
Activation billing and install , Bug , EPUB , Feature request , How to , Import and export , InCopy workflow , Performance , Print , Publish online , Scripting , SDK , Sync and storage , Type

Views

222

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

Community Expert , Aug 17, 2020 Aug 17, 2020

The view preferences probably differ on the other computer. Try this at the start and end of your code: 

 

 

//Start of script, after you've created the document. This assumes that has a variable called "doc"
var currViewPrefs = doc.viewPreferences.properties;
//or use whatever measurement units you want
doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.INCHES;
doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.INCHES;

//end of script to reset preferences back to us
...

Votes

Translate

Translate
Community Expert ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

Does your code set the view preferences measurement units?

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
Participant ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

Nope, it only creates the document and start to set the frames.

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 ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

The view preferences probably differ on the other computer. Try this at the start and end of your code: 

 

 

//Start of script, after you've created the document. This assumes that has a variable called "doc"
var currViewPrefs = doc.viewPreferences.properties;
//or use whatever measurement units you want
doc.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.INCHES;
doc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.INCHES;

//end of script to reset preferences back to user settings
doc.viewPreferences.properties = currViewPrefs;

 

 

 

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
Participant ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

LATEST

Thanks!

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 ,
Aug 17, 2020 Aug 17, 2020

Copy link to clipboard

Copied

As Brian suggests, usually getting and setting the measurement units is the way to go. You can also set the bounds array as strings, and use a specific unit without setting the measurement units:

 

 

var mySelection = app.selection[0];
var gm = mySelection.geometricBounds

//bounds set to centimeters
mySelection.geometricBounds = ["1cm", "1cm", "5cm", "5cm"]

//or convert a number to string and then add the dimension unit in = inches
mySelection.geometricBounds = [gm[0], gm[1], (gm[0] + 2.125 ).toString() + " in", (gm[1] + 3.5).toString() + " in"];

 

 

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