9 Replies Latest reply on Sep 5, 2008 3:35 PM by pauly814

    How do you script preferances?

    Level 1
      Hello,
      Reading Adobe docs. they say not to copy/paste the pref. files from one computer to another. They say preferences are fully scriptable. How do I go about scripting preferences?

      Is there a script out there that has all prefs in it that I could just add values to depending on what I need?

      thanks
        • 1. Re: How do you script preferances?
          Peter Kahrel Adobe Community Professional & MVP
          Which InDesign version?
          • 3. Re: How do you script preferances?
            Peter Kahrel Adobe Community Professional & MVP
            I use this script to set some preferences. As you see, preferences live in different places in the object model.

            #target indesign
            app.paragraphStyles.item('[Basic Paragraph]').appliedFont = 'Minion Pro';
            app.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
            app.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
            app.viewPreferences.cursorKeyIncrement = 0.1;
            app.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
            app.viewPreferences.showRulers = false;

            app.textPreferences.typographersQuotes = true;
            app.textPreferences.baselineShiftKeyIncrement = 0.1;
            app.textPreferences.kerningKeyIncrement = 20;
            app.textPreferences.leadingKeyIncrement = 1;
            app.textPreferences.superscriptPosition = 40;
            app.textPreferences.superscriptSize = 70;
            app.textPreferences.subscriptPosition = 40;
            app.textPreferences.subscriptSize = 70;
            app.textPreferences.useParagraphLeading = false;

            app.dictionaryPreferences.composition = ComposeUsing.useUserDictionary;
            app.dictionaryPreferences.mergeUserDictionary = false;
            app.dictionaryPreferences.recomposeWhenChanged = true;

            app.generalPreferences.temporaryFolder = Folder('/j/id5/');
            app.generalPreferences.includePreview = false;
            //app.generalPreferences.previewSize = PreviewSizeOptions.large;

            There are more preferences, you can find them in the object model. By the way, I don't think that all preferences are scriptable -- I forget which ones aren't.

            Peter
            • 4. Re: How do you script preferances?
              Level 1
              sorry I am very new to this....where do i find / look at the object model?
              • 5. Re: How do you script preferances?
                Peter Kahrel Adobe Community Professional & MVP
                In the ESTK, menu item Help, then "Adobe InDesign CS3 Object Model". You can also try http://www.jongware.com/binaries/indesigncs3jshelp.zip, and at http://www.kahrel.plus.com/indesign/id5-dict.html is a simple list with methods and properties.

                Peter
                • 6. Re: How do you script preferances?
                  Level 1
                  Is there a way for me to get a list / xml file of all of these prefs as they are currently set so I could build a script off of it?
                  • 7. Re: How do you script preferances?
                    [Jongware] Most Valuable Participant
                    Oh sure -- if you check your InDesign folder, you will find a huge XML file named "omv$indesign-5.0-en_us.xml". This contains every item in the ESTK Help file. One of the 'topics' is "Preferences Suite", and every item in there contains preferences data (all 116 of em). You will have to weed them out manually, though :-) (or do as I did and write a dedicated XSLT template). Perhaps it's slightly easier to take a more rational approach.

                    If you download my HTML version from the zip Peter pointed to, you can see all of these preferences by simply clicking "Preferences Suite" on the main page. Select a preference you'd prefer to save -- if there seem to be two, select the plural version, not the single --, for example "DisplaySettings". You can see at the bottom of that page its parent is "Application", so it's an application-wide setting which can be accessed through "app.displaySettings". Now, for the specifics of these settings, go back one page and select "DisplaySetting". This page contains stuff you can read and write using, for example, "app.displaySettings[0].antialiasing". The "[0]" is because this is an array, and you know that because of the plural naming.[*]

                    This way you can plug in everything you want into Peter's script.

                    [*] Post-edit: oh well, "app.generalPreferences" sounds like a plural, but its
                    i type
                    is "GeneralPreference" -- singular. Errr... right?
                    • 8. Re: How do you script preferances?
                      Level 1
                      That's the model. Paul is looking for an xml file that shows the current settings. You'd have to make that yourself with a script, so the answer is yes, but to do it you'd have to learn what you wanted to learn from the file.

                      Dave
                      • 9. Re: How do you script preferances?
                        Level 1
                        So....quoting this:

                        >#target indesign
                        app.paragraphStyles.item('[Basic Paragraph]').appliedFont = 'Minion Pro';
                        app.viewPreferences.horizontalMeasurementUnits = MeasurementUnits.points;
                        app.viewPreferences.verticalMeasurementUnits = MeasurementUnits.points;
                        app.viewPreferences.cursorKeyIncrement = 0.1;
                        app.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
                        app.viewPreferences.showRulers = false;

                        >app.textPreferences.typographersQuotes = true;
                        app.textPreferences.baselineShiftKeyIncrement = 0.1;
                        app.textPreferences.kerningKeyIncrement = 20;
                        app.textPreferences.leadingKeyIncrement = 1;
                        app.textPreferences.superscriptPosition = 40;
                        app.textPreferences.superscriptSize = 70;
                        app.textPreferences.subscriptPosition = 40;
                        app.textPreferences.subscriptSize = 70;
                        app.textPreferences.useParagraphLeading = false;

                        >app.dictionaryPreferences.composition = ComposeUsing.useUserDictionary;
                        app.dictionaryPreferences.mergeUserDictionary = false;
                        app.dictionaryPreferences.recomposeWhenChanged = true;

                        >app.generalPreferences.temporaryFolder = Folder('/j/id5/');
                        app.generalPreferences.includePreview = false;
                        //app.generalPreferences.previewSize = PreviewSizeOptions.large;

                        So I could just put this into a .js file and it would run and set these prefs?

                        How about pre and post adobe scripts. How do I run these?..