Skip to main content
Inspiring
September 22, 2022
Question

app.open() details

  • September 22, 2022
  • 3 replies
  • 420 views

Hi,

 

is there any documentation on the "options" parameter. It is described as "anything"...

This topic has been closed for replies.

3 replies

femkeblanco
Brainiac
September 23, 2022

Here's a Windows-based implementation of @pixxxelschubser's suggestion, which can change an existing document's units between inches, millimeters and centimeters. 

var units = "i";  // inches
// var units = "m";  // millimeters
// var units = "c";  // centimeters
var temp;
{
    interactWithDialog();
    app.executeMenuCommand("unitundoPref");
}
function interactWithDialog() {
    var contents = 
        'Set WshShell = WScript.CreateObject("WScript.Shell")\n' + 
        'WshShell.SendKeys "' + units + '"\n' + 
        'WshShell.SendKeys "{ENTER}"\n';
    temp = new File("~/Desktop/temp.vbs");
    temp.open("w");
    temp.write(contents);
    temp.close();
    temp.execute();
}
temp.remove();
pixxxelschubser
Community Expert
September 22, 2022

IMHO (and unforturnately) the ruler units cannot be set for existing documents.

 

I have seen scripts that are supposed to make this possible, but they did not work for me. (For new documents, however, it is possible).

 

Existing open documents could be set (as a workaround) with a series of key combinations (preferences press [Ctrl]+[K] -> click on Units tab -> press [Tab] three times and then -> cursor up or down (several times). Maybe this will help you a little bit.

 

But maybe someone knows a script that works.

Inspiring
September 23, 2022

Hi,

thank you for the hint, but I really need script access.

I had a look at the SDK, but there setting ruler units is also described as "only while reading the file"

femkeblanco
Brainiac
September 22, 2022

It's an OpenOptions() object you can create. 

 

 

Inspiring
September 22, 2022

Many thanks - unfortunately the feature I was looking for is not among the options. I hoped to find a way to set the ruler units