2 Replies Latest reply on Aug 5, 2008 2:23 PM by myDwayneSmith

    [AS] [CS2] Adding text to frame changes character style

    myDwayneSmith Level 1
      Can someone please help me get around this problem...

      I am adding a caption direction ("Front cover: ") before an existing caption in a labelled text frame.
      The script works fine except in cases where the last word or two of the caption has an italic character style applied (for a scientific name). After the script runs, the resulting caption has more italicised characters than the original. It seems to depend on the number of characters originally styled (eg. if the last 12 characters of the original are italic, then the last 24 of the revised caption will have the character style applied).

      snippet of concern is:

      tell dsFlyer
      set dsCoverCap to contents of text frame "CoverCap"
      set dsCoverCap to "Front cover: " & dsCoverCap
      set contents of text frame "CoverCap" to dsCoverCap
      end tell

      I guess my approach to adding the caption direction is wrong. But I can't work out another way to do it.

      Any assistance greatly appreciated

      Dwayne Smith