Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Searching for anchored/inline position

Return to Member Forum

  • Author
    Posts
    • #55498
      jmiranda
      Member

      Hi all,

      I have a test manual full of inline .5-point lines that act as fill-in-the-blanks lines. I'm trying to convert these lines to underscore characters. I can find them by searching for anchored objects, but I can't see a way to add more detail to distinguish one type of rule from another. The rules aren't styles with any character styles (which would be one way to do it), so I need to find another way. There are basically three different lengths of rules for short answers, word answers, and phrase answers. The length of each type is consistent. If there's no way to do this through Search/Replace, would any one be able to point me to some scripting resources that could orient me in creating one myself?

      Thanks!

      Jason

    • #55503

      Anchored objects as in “Insert anchored object” and pasting a graphic line in there? (Which I couldn't make ID do, for some reason.)

      Or do you mean the graphic lines are pasted in-line?

      The problem with the first approach is the lines are inside another object (the anchored object), so you'd have to dig “one level” deeper. I didn't investigate that any further.

      The other approach is no problem at all. A search for “^a” (Anchored Object, yessir) will return an array of all lines — and probably other inline stuff as well, but that's no problem. Each found item will have a property “graphicLines”, and if its length equals “1”, you have found an object consisting of one line. You could even check a bit further to assure the y coordinates of its start and end point are equal — if not, it's a slanted line instead ;-)

      When you have a handle to the coordinates of the line, you can calculate the length of the line. It'll be in your local measurement units but that's not a problem. Remove the line, get the cursor position and add the length to it; then insert underscores until you have reached this target position (or about — it'll not be exact!).

      You can also add underscores with an alternative method: clear all tabs between the start and end point, set a right aligned tab stop at the end and set the underscore as its dot leader. Then insert 1 tab. It'll also not be exact — ID rounds the number of underscores down, in whole underscore widths.

      A final (and exact!) method is to add the tab stop and tab as above but not use a leader — underline the tab, and you're done.

    • #55506
      jmiranda
      Member

      Thanks, Jongware. They are graphic lines pasted in-line. Thank you for the insight — I'm going to take a stab at translating that into code. I'll post whatever I come up with. Many thanks for outlining the procedure!

      For write on lines that don't come in the middle of sentences and span the entire line or lines that are in consistent places I am setting tabs with an underscore leader. Those are easy to find with GREP S/R b/c I can use the location markers and ~a to find them.

      Best,

      Jason

Viewing 2 reply threads
  • The forum ‘General InDesign Topics (CLOSED)’ is closed to new topics and replies.
Forum Ads