Skip navigation
Home/Support/

Forums

1702 Views 24 Replies Latest reply: Dec 19, 2008 1:52 AM by Harbs. RSS
Harbs. Contributor 4,940 posts since
Apr 19, 2004
Currently Being Moderated

Oct 19, 2008 11:42 AM

New CS4 features

At Dave's suggestion, I'm starting a thread for discussing new scripting
features is CS4. I'd divide new features into three categories: 1)
improvements/additions to the InDesign DOM, 2) improvements to the ESTK,
and 3) improvements/additions to ScriptUI.

I'll start off this thread with one improvement on each of these fronts.
(There are lots...)

Category 1:
There's a new isValid property for all InDesign objects. This is
something that's been in the SDK for ever, but only made its way into
the scripting DOM of CS4. This means that instead of try/catch every
time you're trying to figure out if an object is valid, you can just write:
if(myObject.isValid){DoMyStuff()}

or,
if(! myObject.isValid){return}

This is a small thing but in my book it's huge!

Category 2:
There's a new function panel in the ESTK which shows all the functions
in the current script and makes navigating to the functions very easy.

Category 3:
There are now keyboard and mouse events, so you can now create widgets
which do everything the built in dialog scripting widgets do (and a
whole lot more!!!)

--
Harbs
http://www.in-tools.com
  • (Simon_Paterson) User 97 posts since
    Aug 27, 2003
    Currently Being Moderated
    1. Nov 6, 2008 9:13 PM (in response to Harbs.)
    Re: New CS4 features
    Thanks, Habs. This is great. Has whet my appetite.

    Wondering if you could satisfy a few curiosities I have.

    Scripting DOM queries:

    1. width and height property on page items?
    2. shortcuts (ability to set through a script)?
    3. cap height and x-height properties of text objects?

    ESTK queries:

    1. Has the UnitValue object been expanded to use agates?
    2. When you have an object (or array) disclosed in the object viewer and you step through a script in debug mode, does the object still un-disclose? That is, if you are looking at the properties of an object each time you step over a line in the script that object would close up (at least on PPC Mac) ESTK2. Has this behaviour changed? (I find this particularly annoying: I often want to watch the value of object properties change as I step through a script and each step the object would close and I would have to re-open.)

    ScriptUI queries:

    1. Is there a tab view?
    2. Is there a table view?
    3. Is there an enabling group (as in InDesign UI)?

    None of these things are a huge deal, but my curiosity has the better of me so I feel compelled to ask.
  • (Simon_Paterson) User 97 posts since
    Aug 27, 2003
    Currently Being Moderated
    2. Nov 7, 2008 12:15 AM (in response to Harbs.)
    Re: New CS4 features
    Apologies for misspelling your name, Harbs. I always try to do better than this and feel terrible about the error.
  • [Jongware]-GfBROo Star 5,362 posts since
    Dec 17, 2006
    Currently Being Moderated
    3. Nov 7, 2008 2:47 AM (in response to Harbs.)
    Re: New CS4 features
    Cat. 1:

    >app.activeScriptUndoMode

    Four nice possibilities.

    >(any text object).characterDirection

    Finally, a working RTL option -- but not in the UI!? (I haven't tried it yet.)

    >(some print preferences).Screeening

    It's a screeeam. At least it's spelled consequently all throughout the help.
  • Peter Kahrel Participant 1,747 posts since
    Oct 18, 2006
    Currently Being Moderated
    4. Nov 7, 2008 3:37 AM (in response to Harbs.)
    Re: New CS4 features
    Hello Jongware,

    RTL is in fact fully functional in CS4. Though you can't see it in the interface, you can script it. First, there's a new composer, "Adobe World-Ready Paragraph Composer". Then there are a number of properties (and enumerations) to deal with RTL, such as paragraphDirection, characterDirection, and diacriticPosition. There are several more, they are highlighted in http://www.kahrel.plus.com/indesign/id6-dict.pdf (together with all other new CS4 script methods/properties/enumerations).

    CS4's RTL features are available *only* through scripting, which makes it a bit of an abstract affair (though the RTL features become visible in the UI's paragraph-style panel once you've created an RTL paragraph style and set some RTL features). None of it is documented, so we're on our own here -- but you'll get used to it! Anyway, it's great that in CS4 we can process Arabic, Hebrew, and other complex-script languages.

    By way of example, here's a script that creates an RTL paragraph and sets a few properties:

    create_RTL_paragraph (app.activeDocument, 'RTL');
    

    function create_RTL_paragraph (doc, stylename)
       {
       if (doc.paragraphStyles.item (stylename) == null)
          doc.paragraphStyles.add ({name: stylename});
       var ps = doc.paragraphStyles.item (stylename);
       ps.composer = "Adobe World-Ready Paragraph Composer";
       ps.paragraphDirection = ParagraphDirectionOptions.rightToLeftDirection;
       ps.characterDirection = CharacterDirectionOptions.rightToLeftDirection;
    //   ps.paragraphJustification = ParagraphJustificationOptions.arabicJustification;
    //   ps.diacriticPosition = DiacriticPositionOptions.opentypePosition;
       }


    Peter
  • Peter Kahrel Participant 1,747 posts since
    Oct 18, 2006
    Currently Being Moderated
    5. Nov 7, 2008 5:53 AM (in response to Harbs.)
    Re: New CS4 features
    Here's an overview of all properties and enumerations dealing with right-to-left scripting: http://www.kahrel.plus.com/indesign/cs4-right_to_left.pdf

    Peter
  • User 608 posts since
    Jun 1, 2004
    Currently Being Moderated
    6. Nov 7, 2008 10:06 AM (in response to (Simon_Paterson))
    Re: New CS4 features
    > Scripting DOM queries:
    >
    > 1. width and height property on page items?

    Don't know.


    > 2. shortcuts (ability to set through a script)?

    Yes.


    > 3. cap height and x-height properties of text objects?

    Don't know.


    > ESTK queries:
    >
    > 1. Has the UnitValue object been expanded to use agates?

    No.


    > 2. When you have an object (or array) disclosed in the object viewer and you step through a script in debug mode, does the object still un-disclose? That is, if you are looking at the properties of an object each time you step over a line in the script that object would close up (at least on PPC Mac) ESTK2. Has this behaviour changed? (I find this particularly annoying: I often want to watch the value of object properties change as I step through a script and each step the object would close and I would have to re-open.)

    Objects stay open now. Welcome to the 21st Century, ESTK!


    > ScriptUI queries:
    >
    > 1. Is there a tab view?

    Yes. Looks good. Haven't tried it yet.


    > 2. Is there a table view?
    Not yet.


    > 3. Is there an enabling group (as in InDesign UI)?

    Don't know.

    -X
  • Peter Kahrel Participant 1,747 posts since
    Oct 18, 2006
    Currently Being Moderated
    7. Nov 7, 2008 12:00 PM (in response to Harbs.)
    Re: New CS4 features
    Simon,

    >1. width and height property on page items?

    No.
    >2. shortcuts (ability to set through a script)?

    Unfortunately not.

    >3. cap height and x-height properties of text objects?

    No.

    >ScriptUI queries:
    >1. Is there a tab view?

    Yes, see this example. This is a useful addition.
    w = new Window ('dialog');
    
       tpanel = w.add ('tabbedpanel');
          t0 = tpanel.add ('tab', undefined, 'Tab 0');
             c00 = t0.add ('checkbox', undefined,'Checkbox 0 in tab 0');
             c01 = t0.add ('checkbox', undefined,'Checkbox 1 in tab 0');
             c01 = t0.add ('checkbox', undefined,'Checkbox 2 in tab 0');
          t1 = tpanel.add ('tab', undefined, 'Tab 1');
             c10 = t1.add ('checkbox', undefined,'Checkbox 0 in tab 0');
             c11 = t1.add ('checkbox', undefined,'Checkbox 1 in tab 1');
             c12 = t1.add ('checkbox', undefined,'Checkbox 2 in tab 2');

       buttons = w.add ('group');
          buttons.alignChildren = ['right', 'bottom']
          buttons.orientation = 'row';
          okButton = buttons.add ('button', undefined, 'OK');
          buttons.add ('button', undefined, 'Cancel');

       if (w.show () == 1)
          {
          $.writeln ("Selected panel on exit: " + tpanel.selection.text);
          }


    >2. Is there a table view?

    Not sure what you mean.

    >3. Is there an enabling group (as in InDesign UI)?
    Yes (has been there for a while): myGroup.enabled = true/false

    Peter
  • User 608 posts since
    Jun 1, 2004
    Currently Being Moderated
    8. Nov 7, 2008 1:05 PM (in response to Peter Kahrel)
    Re: New CS4 features
    Peter Kahrel wrote:

    > No.
    >
    > 2. shortcuts (ability to set through a script)?
    >
    >
    >
    >
    > Unfortunately not.


    From 'Control Object Properties'

    shortcutKey String The key sequence that invokes the onShortcutKey callback
    for this element (in Windows only).


    -X
  • Peter Kahrel Participant 1,747 posts since
    Oct 18, 2006
    Currently Being Moderated
    9. Nov 7, 2008 1:18 PM (in response to Harbs.)
    Re: New CS4 features
    > From 'Control Object Properties'
    >
    > shortcutKey String The key sequence that invokes the onShortcutKey callback for this element (in Windows only).

    Ah -- right. I thought Simon was after scripting the keyboard shortcuts, the ones you set in the UI at Edit > Keyboard Shortcuts.

    Peter
  • (Simon_Paterson) User 97 posts since
    Aug 27, 2003
    Currently Being Moderated
    10. Nov 7, 2008 5:10 PM (in response to Harbs.)
    Re: New CS4 features
    Peter, xbytor,

    Thank you for answering my questions.

    xbytor,

    I was actually talking about Edit > Keyboard Shortcuts. I was crossing my fingers for that one.

    Peter,

    Thanks so much for the tab view example code. Very cool.

    An 'Enabling Group' is not the same as 'enabling a group'. It is a specific type of grouping panel with a title and a tick box. Clicking the tick box enables or disables the group. A table view is a bit like a list view but with multiple columns.

    It's great that we are starting to get some details coming through. Thanks, guys.
  • Peter Kahrel Participant 1,747 posts since
    Oct 18, 2006
    Currently Being Moderated
    11. Nov 8, 2008 2:37 AM (in response to Harbs.)
    Re: New CS4 features
    >An 'Enabling Group' is not the same as 'enabling a group'.

    Ah, I see what you mean. No, scriptUI doesn't seem to have a JS-style enabling group. You could probably fake it in scriptUI. There's good documentation on scriptUI in (ESTK 3) Help > JavaScript Tools Guide CS4.

    Peter
  • (Simon_Paterson) User 97 posts since
    Aug 27, 2003
    Currently Being Moderated
    12. Nov 11, 2008 2:04 AM (in response to Harbs.)
    Re: New CS4 features
    In the Extend Script ScruitUI documentation for CS4 it says the list view now has columns, so that it is a kind of table view.
  • [Jongware]-GfBROo Star 5,362 posts since
    Dec 17, 2006
    Currently Being Moderated
    13. Dec 10, 2008 9:19 AM (in response to Harbs.)
    Re: New CS4 features
    Add to the list Of Things You Cannot Do Without Scripting:

    otfStylisticSets already was available as a text property in CS3; now, in CS4 you also have otfStylisticAlternate, which selects the 'salt' feature of your current font. The weird thing is, in the User Interface you
    i cannot
    select this! (Equally weird is it
    i is
    recognized in character and paragraph styles. That means that, as soon as you have used the feature in your document, you can use it in char & par definitions.)

    You can use Adobe Garamond Pro to test -- it has 'salt' variants for Q, a, e, n, r, t, and z. The 't' has 2 'salt' alternates, but I cannot figger out how to get the second.
  • Roy McCoy User 122 posts since
    Sep 19, 2008
    Currently Being Moderated
    14. Dec 10, 2008 4:20 PM (in response to Harbs.)
    Re: New CS4 features
    But how can you use the "salt" feature in char & par definitions if it isn't selectable in the UI? Does it somehow become selectable after you've scripted it into existence in your doc, or what? If you can (initially?) only use it by scripting, I would suppose you could immediately script it into char & par definitions. Sorry if I'm being dumb, but I've never used these alternates and would like to know how to. Thanks.


    On Dec 10, 2008, at 5:19 PM, jongware wrote:

    otfStylisticSets already was available as a text property in CS3; now, in CS4 you also have otfStylisticAlternate, which selects the 'salt' feature of your current font. The weird thing is, in the User Interface you   cannot  select this! (Equally weird is it   is  recognized in character and paragraph styles. That means that, as soon as you have used the feature in your document, you can use it in char & par definitions.)

  • [Jongware]-GfBROo Star 5,362 posts since
    Dec 17, 2006
    Currently Being Moderated
    15. Dec 10, 2008 5:04 PM (in response to Harbs.)
    Re: New CS4 features
    I used a script to insert it into live text (which enables it in "New Character Style"), but I think your second idea -- insert it with a script right into a paragraph or character style -- works just as well. You cannot switch it off or on without using a script -- it doesn't appear in the UI (Peter Kahrel's World Paragraph Composer option does).

    I'll try in the morning, shouldn't be too hard. Anyone in other time zones is invited to beat me to it.
  • Ildhund User 595 posts since
    Oct 19, 2008
    Currently Being Moderated
    16. Dec 11, 2008 2:03 AM (in response to Roy McCoy)
    Re: New CS4 features
    [OT] Roy, there's something funny with your posting settings. It
    looks like AppleMail or Gmail or something is trying to send HTML
    instead of plain text whenever you quote anything in your posts, so
    all this newsreader user sees is one long line of HTML tags
    interspersed with a bit of text now and again. This makes reading
    your posts very difficult - can you do something about it?
    --
    Noel
  • [Jongware]-GfBROo Star 5,362 posts since
    Dec 17, 2006
    Currently Being Moderated
    17. Dec 11, 2008 3:04 AM (in response to Harbs.)
    Re: New CS4 features
    Noel, nothing wrong with Roy's posts for me (using the default web interface). It may just be you :-)

    Talking about interfaces, please don't comment on this one. It does the job, innit? (I'm sure someone else could do better with ScriptUI. Go ahead.)

    var myStyleList = new Array;
    

    for(c = 1; c < app.activeDocument.paragraphStyles.length; c++)

    {

    if (app.activeDocument.paragraphStyles.item(c).otfStylisticAlternate == true)

      name = "[+] ";

    else

      name = "[-] ";

    name += app.activeDocument.paragraphStyles.item(c).name;

    myStyleList.push(name);

    }

    var myCharsList = new Array;

    for(c = 1; c < app.activeDocument.characterStyles.length; c++)

    {

    if (app.activeDocument.characterStyles.item(c).otfStylisticAlternate == true)

      name = "[+] ";

    else

      name = "[-] ";

    name += app.activeDocument.characterStyles.item(c).name;

    myCharsList.push (name);

    }

    var parDialog = app.dialogs.add({name:"Salt your Styles",canCancel:true});

    with(parDialog)

    {

    with(dialogColumns.add())

    {

      with(dialogRows.add())

      {

       parCheck = checkboxControls.add({staticLabel:"Paragraph style"});

       parDropdown = dropdowns.add({stringList:myStyleList, selectedIndex:0});

      }

      with(dialogRows.add())

      {

       charCheck = checkboxControls.add({staticLabel:"Character style"});

       charDropdown = dropdowns.add({stringList:myCharsList, selectedIndex:0});

      }

    }

    }

    var result = parDialog.show();

    if (result)

    {

      if (parCheck.checkedState)

       app.activeDocument.paragraphStyles.item(parDropdown.selectedIndex+1).otfStylisticAlternate =

        !app.activeDocument.paragraphStyles.item(parDropdown.selectedIndex+1).otfStylisticAlternate;

      if (charCheck.checkedState)

       app.activeDocument.characterStyles.item(charDropdown.selectedIndex+1).otfStylisticAlternate =
        !app.activeDocument.characterStyles.item(charDropdown.selectedIndex+1).otfStylisticAlternate;

    }

    parDialog.destroy();
  • User 504 posts since
    Mar 22, 2003
    Currently Being Moderated
    19. Dec 11, 2008 6:49 AM (in response to [Jongware]-GfBROo)
    Re: New CS4 features
    because we use NewsReader (I use ThunderBird) - not WebBrowser

    robin

    --
    www.adobescripts.com
  • Roy McCoy User 122 posts since
    Sep 19, 2008
    Currently Being Moderated
    20. Dec 11, 2008 10:07 AM (in response to Harbs.)
    Re: New CS4 features
    Noel Burgess wrote:

    > [OT] Roy, there's something funny with your posting settings. It
    > looks like AppleMail or Gmail or something is trying to send HTML
    > instead of plain text whenever you quote anything in your posts, so
    > all this newsreader user sees is one long line of HTML tags
    > interspersed with a bit of text now and again. This makes reading
    > your posts very difficult - can you do something about it?

    I now have my Apple Mail settings at Plain Text rather than Rich Text,
    with "Use the same message format as the original message" checked
    under "Responding". Hope that helps.


    Roy
  • User 504 posts since
    Mar 22, 2003
    Currently Being Moderated
    21. Dec 11, 2008 11:29 AM (in response to Roy McCoy)
    Re: New CS4 features
    yes :) now is fine :)

    robin

    --
    www.adobescripts.com
  • Ildhund User 595 posts since
    Oct 19, 2008
    Currently Being Moderated
    22. Dec 11, 2008 12:58 PM (in response to Roy McCoy)
    Re: New CS4 features
    Attaboy! Thank you very much.
    --
    Noel
  • Steven.. User 302 posts since
    Dec 31, 2008
    Currently Being Moderated
    23. Dec 18, 2008 10:30 PM (in response to Harbs.)
    Re: New CS4 features
    Now that Right To Left can be scripted, I created an Windows application with Indesign palette style UI which does the work for you check it out on my Web Site http://sites.google.com/site/adoberighttoleft/Home it's only $20.

    Steven F. Bryant
    http://sites.google.com/site/adoberighttoleft

More Like This

  • Retrieving data ...

Bookmarked By (0)