[Date Prev][Date Next] [Thread Prev][Thread Next]
[Date Index] [Thread Index] [New search]

Re: FrameScript (Find and Apply Character Formatting)



The following is a simple FrameScript script to do what you describe in your
problem. Lines beginning with a double slash (//) are comment lines and are
not part of the script.  This script looks in each paragraph of the currently
active document for text between XXX and ZZZ and applies the Emphasis
character format to that text.  BTW, a real production script would do more
error checking and probably prompt the user for the beginning and ending
strings.

    // Get the 'Emphasis' character format
GET Object Type(CharFmt) Name('Emphasis') NewVar(chfmt);

     // Check each paragraph in the document
LOOP ForEach (Pgf) In(ActiveDoc) LoopVar(pgfvar)
        // Find the beginning text
   FIND 'XXX' InObject(pgfvar) ScrollTo ReturnStatus(stat)
          ReturnRange(rangevar);
   IF stat
             // Find the ending text
      FIND 'ZZZ' InObject(pgfvar) ScrollTo ReturnStatus(stat2)
             ReturnRange(rangevar2);
      IF stat2
                // Make sure the beginning is before the end
         IF rangevar2.begin.offset > rangevar.end.offset
                    //   Make text range variable
            NEW TextRange NewVar(trange) Object(pgfvar)
                Offset(rangevar.end.offset+1)
                                         Object(pgfvar)
                Offset(rangevar2.begin.offset-1);
                   // Apply the character format
            APPLY TextProperties TextRange(trange)
                  Properties(chfmt.properties);
         ENDIF
      ENDIF
   ENDIF

ENDLOOP


Frank Elmore
Project leader for FrameScript


Jay Smith wrote:

> I am looking at an eval copy of FrameScript.  I think that this thing
> can do lots of great stuff; they seem to have done a great job putting
> it together. However, I may not be experienced enough to understand
> what I am supposed to be doing, right out of the box.
>
> 1) What do folks who have used the product a bit think of it?
>
> 2) Can anybody help with a sample script that they have developed that
> includes or addresses the following:
>
>   FIND a range of text, spaces, and punctuation between two known
> points (XXX and ZZZ):
>
>        XXXtext, and more text, until it endsZZZ
>
>   APPLY a character tag to the stuff between XXX and ZZZ.
>
> This is probably really simple stuff, but because of my lack of
> experience, I am having trouble recognizing how I should be
> approaching the problem, from their scripting point of view.
>
> (BTW, and listen up Adobe, the task above apparently cannot be done at
> all directly in FM itself if you do not know the exact content between
> XXX and ZZZ because FM has no wildcard ability to span spaces and/or
> punctuation!!!)


** To unsubscribe, send a message to majordomo@omsys.com **
** with "unsubscribe framers" (no quotes) in the body.   **