2 Replies Latest reply on Mar 14, 2008 2:12 PM by sstanleyau

    test to see if paragraph style name exists

      I am sorry if this topic has been addressed. It is a very simple one, I believe.

      I need to create two paragraph styles: "front" and "pagenum." If these paragraph styles already exist in the active document, I need to do nothing and move on creating text frames and applying the paragraph styles to page numbers.

      Here is style creation part of my appleScript. At this point in the script, no text or page elements are addressed:

      set NumStyle to make paragraph style
      tell NumStyle
      set name to "pagenum"
      set space after to 0.0
      set space before to 0.0
      set left indent to 0.0
      set right indent to 0.0
      end tell

      If the style already exists, the scripts complains and stops. So I would like to test for the existence of the two paragraph styles as in this pseudo code:

      if paragraph style "pagenum" does not exist then
      set NumStyle to make paragraph style
      ... etc ...
      end if

      It is the if statement I am having trouble getting right.