3 Replies Latest reply on Feb 27, 2009 3:43 PM by Len Swierski-m5Cbo1

    [JS, CS3] Creating a new boolean object. Is it possible?

    Level 1
      Hello,
      I am wondering if I can create a new boolean object in InDesign that I can use in a script I am working on. What I am doing is selecting some text and then manipulating other aspects of the selection's paragraph. I want to be able to determine if certain characters are selected, so the new boolean object would be, let's say "selected." If a character within the paragraph is selected, it's value would be "true," while other characters in the paragraph that are not selected would remain "false." Is this possible? I am also thinking that I could use an already existing boolean value, such as strikeThrough and then turn it off at the end of the script. But this is not elegant if the text were to REALLY need strikeThrough (not very likely, but just sayin'). Thanks for any advice.
      Regards,
      Len Swierski
        • 1. Re: [JS, CS3] Creating a new boolean object. Is it possible?
          Level 1
          Hi again,
          Please forgive my inexperience with terminology. New PROPERTY is what I meant, not OBJECT. The script works perfectly right now by setting the strikeThru property to "true" for the selected characters and then changing it back to "false" at the end of the script, but I would still love to have a custom boolean property to set that would not be affected by any slight chance of a property that might actually be desired.
          Regards,
          Len Swierski
          • 2. Re: [JS, CS3] Creating a new boolean object. Is it possible?
            Peter Kahrel Adobe Community Professional & MVP
            Len,

            Your current approach is the only feasible one. You can't create new properties for Indesign's objects. In some cases it's easy: text frames, for instance, can have their label set to a certain value, as can several other objects (cells, the application, etc.).

            But characters don't have the label property, so you have to use an existing property, as you did with overstrike. If you don't like using that particular one, have a look through the OMV under "Character" and see if there's a property that suits your needs better than overstrike.

            What you can use use this: in a script you can assign a character (text, word, etc.) an underline colour without setting underline. In the interface you'd have to enable underline, then set a colour, then disable underline. In a script enabling and disabling underline isn't necessary: just set myCharacter.underlineColor to some value ('Black' for "yes", 'White' for "no" or something like that).

            So though you can't add new properties to characters, they have so many already that you're sure to find one you can exploit.

            Peter
            • 3. Re: [JS, CS3] Creating a new boolean object. Is it possible?
              Level 1
              Hi Peter,
              This is what I expected, but your suggestion of using the strikeThru color is a very good one, because even if the text requires strikeThru, it can be changed back to black or the text color at the end of the script anyway. Thanks for that info.
              Regards,
              Len Swierski