Skip to main content
Participant
October 12, 2009
Question

Setting default preferences (CS3)

  • October 12, 2009
  • 2 replies
  • 2104 views

Hi, I seem to be losing my preferences a lot recently, when I have a crash, and it's becoming quite tedious fixing them manually.

I've managed to successfully java script a few things to work on startup. However there are a few things I don't know the code for:

1. Uncheck "Dimensions include stroke weight"

2. Uncheck "Adjust stroke weight when scaling"

3. Printer prefs > Graphics > images > send data "all" (Needs to be for the application default printer preferences, NOT the current document preferences)

Is there a list available that covers all these things? Can't seem to find them in the Adobe scripting reference or guide.

Cheers

This topic has been closed for replies.

2 replies

Harbs.
Legend
October 13, 2009

This is not going to help with CS3, but for CS4, here's a really cool way to save and load preferences: http://in-tools.com/wordpress/indesign/scripts/preference-manager-script

(The reason it's CS4-only is because the E4X implementation in CS3 was incomplete, and I wasn't going to break my head writing the code without E4X...)

Participant
October 14, 2009

Yep, I found that one when searching Harbs. Phenomenal work there. Should be upgrading to CS4 soon, so It'll be nice to try out.

In the meantime, can anyone shed any light on scripting the default application printer presets? Is it possible?

Harbs.
Legend
October 14, 2009

PrinterPresets are a collection.

You will need to use app.printerPresets.add() for each preset you want

and add it with whatever properties you need.

Harbs

Jongware
Community Expert
Community Expert
October 12, 2009

The built-in Help of the ESTK ought to be the definitive reference -- it uses an XML file that gets generated by the application itself. But browsing or searching it is ... cumbersome ... (mildly stated). I used a free text search on my version of this help

  • and immediately found these:

    Application -> TransformPreference -> adjustStrokeWeightWhenScaling ("Whether strokes are scaled when objects are scaled.") and dimensionsIncludeStrokeWeight ("If true, includes the stroke weight when displaying object dimensions. If false, measures objects from the path or frame.").

    Under Document/Book -> PrintPreferences, I found this: sendImageData; ImageDataTypes.ALL_IMAGE_DATA ("Sends full-resolution data.")

  • I took the XML file and ran an XSLT transform on it to convert to easy-to-read HTML (and added lots of internal links as well). This huge set of HTML files, and a single Windows compatible CHM file, can be found on http://www.jongware.com/idjshelp.html. "Free text search" is not really an option in the HTML files; perhaps your browser allows it. The CHM file is very user friendly, though -- for Windows users. The CS4 version is even a bit better. If you don't mind me tootin' own horns and all

  • Participant
    October 12, 2009

    Cool, I did a search on the InDesign Scripting reference and and found them too.

    It's pretty much just trial and error for me, as this is my first shot at java script (I have no idea what I'm doing )

    This is what I've got below, everything works perfectly, except for the last two parts:

    with(app.documentPreferences){

    pageHeight = "297mm";

    pageWidth = "210mm";

    pageOrientation = PageOrientation.portrait;

    pagesPerDocument = 1;

    facingPages = false;

    documentBleedBottomOffset = "0mm";

    documentBleedTopOffset = "0mm";

    documentBleedInsideOrLeftOffset = "0mm";

    documentBleedOutsideOrRightOffset = "0mm";

    }

    with (app.marginPreferences){

    bottom = "0mm"

    left = "0mm"

    right = "0mm"

    top = "0mm"

    }

    with(app.viewPreferences){

    horizontalMeasurementUnits = MeasurementUnits.millimeters;

    verticalMeasurementUnits = MeasurementUnits.millimeters;

    }

    with(app.TransformPreference){

    DimensionsIncludeStrokeWeight = false;

    ScaleStrokes = false;

    }

    with(app.printPreferences){

    sendImageData = ImageDataTypes.allImageData;

    }

    Jongware
    Community Expert
    Community Expert
    October 13, 2009

    First thing to do is grasp the difference between name of an object and name of a property

    "TransformPreference" is the name of an object -- a 'type', just as "Number" is, and "String", and lots of Others. As sort of convention, these are written with an initial capital. You cannot assign a value to an object; you need a variable of that type instead. And an object, in turn, may contain new variables (its 'properties').

    So, if I say that an Application contains an object TransformPreference that has a property adjustStrokeWeightWhenScaling, you cannot literally copy-and-paste everything together. Besides, you really have to check case usage. Javascript is Case Sensitive!

    • "app" is the name of the Application object we are working with (you got that right)
    • the transform preference object is called 'transformPreferences'
    • and that, in turn, has a boolean 'dimensionsIncludeStrokeWeight' (note case)

    So a full assignment line would be

    app.transformPreferences.dimensionsIncludeStrokeWeight = false;

    or, in the alternative notation

    with(app.transformPreferences) {

    dimensionsIncludeStrokeWeight = false;

    adjustStrokeWeightWhenScaling = false;

    }

    (which reminds me, where did you ever get "ScaleStrokes" from?)

    The Print Preference thingy is something different. The "application" doesn't have any print preferences you can set! Only a Document or a Book (which is kind of a document, I suppose) can have these. The print preferences are what "get changed" if you take a print preset and change those before actually pressing the 'print' button.

    The short of it is that you cannot set default 'print preferences' for the program; however, that ought not to be a problem because that's what Print Presets are for. And you don't need a script to save/restore these.