Skip to main content
Inspiring
November 30, 2012
Question

Where are withProperties arguments outlined?

  • November 30, 2012
  • 2 replies
  • 3079 views

One of the biggest problems I have with the Adobe scripting API and ESTK is that the documentation is either poor and incomplete or that it assumes a level of knowledge that I just don't have.

There are many methods that use an argument <code>withProperties</code>

For example:

<pre>app.documents.add(showingWindow, documentPreset, withProperties)</pre>

I assume this argument can be passed object or associtative array with a series arguments to be used when the method is run. However I cannot find any information in the documentation or online that outlines the syntax to use for these arguments and what properties can be applied.

Can somebody please explain how I would find this information?

This topic has been closed for replies.

2 replies

Jongware
Community Expert
Community Expert
November 30, 2012

McShaman179 wrote:

One of the biggest problems I have with the Adobe scripting API and ESTK is that the documentation is either poor and incomplete or that it assumes a level of knowledge that I just don't have.

There are many methods that use an argument <code>withProperties</code>

If you're just starting out, don't break your head over the 'withProperties' stuff. You can safely ignore it, and use the regular way to set the properties. To copy bgfrhlp's example:

Here is an example of not using "with Properties":

var myDoc = app.documents.add();

myDoc.zeroPoint = [100,344];

myDoc.label = "NEW";

bfgrhlp wrote:

Most of the document properties are readonly ..

Not entirely a problem, as you can work around that for properties that are objects and thus have properties of their own. This works:

app.documents.add({documentPreferences:{pageHeight:"10cm", pageWidth:"20cm"}});

.. but don't get too greedy, because at some point it stops working:

app.documents.add({marginPreferences:{left:"0.5in", right:"0.5in", top:"24pt", bottom:"36pt"}, documentPreferences:{pageHeight:"10cm", pageWidth:"20cm"}});

McShamanAuthor
Inspiring
November 30, 2012

Thanks for your example

It does not appear to be that putting too much in causes it to fail in your example... It just appears that the marginPreferences property is not accepted as a withProperty argument. Even the following does not work:

app.documents.add({marginPreferences:{top:"10cm"}});

From your example only the documentPreferences property works.

Is this the only property that works? This is exactly my issue with the Adobe Scripting API. How am I meant to know without testing each one?

Harbs.
Legend
December 4, 2012

Thank you for clearing up marginPreferences Trevor. It was quite clear, however this dose not answer my original post. You have demonstrated that I can configure both the marginPreferences and documentPreferences through the withProperties argument... But what else? Where is the list of properties that can be configured through this argument at run time?

I have looked at the document object  in the object model viewer and there are hundreds of properties. Am I assume they are all able to be configured with the withProperties argument?


If you check myObject.properties, that will return the available properties which can be set when the object is created using withProperties.

Is that clear enough?

Inspiring
November 30, 2012

Most of the document properties are readonly as you can find out at http://jongware.mit.edu/idcs5js/pc_Document.html.

Here is an example of properties in use.

app.documents.add({zeroPoint:[100,344], label:"NEW"}); 

Grant Gamble's Indesign CS5 JavaScript is a good source.