1 Reply Latest reply on Feb 10, 2012 8:11 AM by vze26m98

    Paragraph returns in editboxes?


      Hi all-


      On the Mac, in a ScriptUI editbox, I can type Control-Return or Control-M and insert a line break into my text. This, AFAICT, I interpreted as Unicode U+2028 by InDesign.


      If I go to the Story Editor for XML and hit the Return key inside an element, InDesign will produce a Unicode U+2029, I believe.


      Is there a way of entering U+2029 into my editbox on either Mac or Windows?


      Thanks, Charles

        • 1. Re: Paragraph returns in editboxes?
          vze26m98 Level 1

          OK, some more detail, on the Mac only, haven't tried any of this on Windows:


          In a ScriptUI editext box, you can type ^M (or maybe identically Option-return) to place a paragraph separator into the text of the box. The character code inserted is 0x0a or \n. It seems that you can type ^P into an edittext box and get carriage return behavior, but it's not preserved in the text string as 0x0d or \r. (IIRC, it's not preserved at all.)


          When ^M is written into the text of XML story element, the \n is written as a "forced line break" (or in Applescript, an 'SFlb' type). When the XML is exported, it's represented as U+2028, but if I was to examine it's value via ExtendScript using something like this:




          I'd get the unpleasant error:


          118:183: execution error:
          Adobe InDesign CS5 got an error:
          app.activeDocument.xmlElements[0].xmlElements[4].xmlElements[0].characters[36].contents.charCodeAt is not a function (24)


          ExtendScript is happy to represent what gets exported in XML as U+2029 as '\r' (this would be what is inserted with the Return key in the Story Editor), and the above sample code will work without problem.


          To conclude: I have my work-around, which is to convert \n in a ScriptUI edittext box to \r before writing the text to an XML element. (Providing this behavior works on Windows as well.) I'm still mystified by the ExtendScript error, and if anyone has a comment, I appreciate hearing it.


          Thanks, Charles