5 Replies Latest reply on Feb 20, 2012 12:31 AM by Muppet Mark

    Who uses ciceros anyway?

    TᴀW Adobe Community Professional & MVP

      I never have. But a script I've been debugging has highlighted the

      following. Is this a bug, or is it me not understanding something?

       

      If you try this:

       

      UnitValue("10c").type

       

      you get:

       

      Result: ?

       

      meaning that it is not a recognised UnitValue type.

       

      But, if you do this:

       

      UnitValue("10ci").type

       

      you get

       

      ci

       

      In other words, UnitValue recognises ci as the correct abbrev. for ciceros.

       

      However, if you try

       

      myTextFrame.textFramePreferences.insetSpacing = "10ci"

       

      you get an error, whereas if you go for

       

      myTextFrame.textFramePreferences.insetSpacing = "10c"

       

      the textFrame inset is set correctly -- 10 ciceros, meaning that the

      InDesign abbreviation for ciceros is "c" not "ci".

       

      If the above is all correct, it does mean that you cannot naively rely

      on UnitValue to confirm that the user inputted a valid measurement in a

      text field in a ScriptUI dialog as follows, which is what I've been doing:

       

      if (UnitValue(theText).type == "?")...

       

      Is this a bug, or is this a CS vs. ID thing, or what?

       

      I reiterate that I've never used ciceros for anything -- but I'm sure

      there are some good folk out there who'd swear by them, so in the

      interests of plurality etc. etc.

       

      Ariel

       

        • 1. Re: Who uses ciceros anyway?
          John Hawkinson Level 5

          In other words, UnitValue recognises ci as the correct abbrev. for ciceros.

          ...

          the textFrame inset is set correctly -- 10 ciceros, meaning that the

          InDesign abbreviation for ciceros is "c" not "ci".

          ...
          Is this a bug, or is this a CS vs. ID thing, or what?

          UnitValue is an ExtendScript thing, it's not part of the InDesign DOM.

          So, basically, two different teams work on it, and have apparently done them differently.

          I guess you'd call it a "CS vs. ID thing."

           

          I woudn't use UnitValue in InDesign at all, if I could get away with it.

          [ Curiously, I used it for the first time last week in a script that sent a BridgeTalk message to Photoshop... ]

           

          Ideally both implementations could be enhanced to support both abbreviations. Perhaps for CSnext.

           

          As for who uses them, I imagine only French and Italians who don't use the metric system?

          • 2. Re: Who uses ciceros anyway?
            Muppet Mark Level 5

            You have not actually used the unit value in your example… You've just used its recognised abbreviation in a string… Like John I find no need to these in Indesign but of some use in Photoshop & Illustrator. As it happens the property you are wanting only accepts points or an array of points… In you Script UI case I would ask and check for a number value only and have unit values deal with the rest.

             

            var doc =app.activeDocument;

             

            doc.textFrames[0].textFramePreferences.insetSpacing = UnitValue( 1, 'ci' ).as( 'pt' )+'pt';

            • 3. Re: Who uses ciceros anyway?
              TᴀW Adobe Community Professional & MVP

              Thanks the pointers. I'll have to look into this more carefully.

               

              Really I'm just looking for a simple way to add an arbitrary number in

              an arbitrary unit to another measurement without having to change the

              ruler settings. E.g.:

               

              var myInset = myTextFramePrefs.insetSpacing; // could be anything

              myInset -= "10mm";

               

              I thought that UnitValue was the way to go:

               

              myInset -= UnitValue("10mm");

               

              but now I'm not so sure.

               

              I am pretty sure that the French invented the metric system though! But

              then abandoning ciceros for points isn't a metric conversion in any case

              -- neither of those measurement are metric.

               

              Thanks,

              Ariel

              • 4. Re: Who uses ciceros anyway?
                John Hawkinson Level 5

                Really I'm just looking for a simple way to add an arbitrary number in

                an arbitrary unit to another measurement without having to change the

                ruler settings.

                I don't think there's a good way to do that.

                If you happen to know what the current units are, you can use UnitValue to add your arbitrary measurement/type to the current measurement and type. But unless you've set the units, they're likely to be AUTO, and then that's no good.

                 

                So I would save the measurement units and set them to Points in a try/finally block, and then reset them back at the end.

                 

                I would probably just assume no one is going to use Ciceros...(just use Mark Antony instead)...

                • 5. Re: Who uses ciceros anyway?
                  Muppet Mark Level 5

                  I tend to store/restore ruler units over using unit values thoughout. Your chosen pref only takes points ( there are a serveral like that )… So you can change rulers, do the math or use unit values…