3 Replies Latest reply on Mar 25, 2011 3:54 PM by L. Guy O'Rojo

    [AS] Why does object reference of every text style range not work with Leopard/Snow Leopard

    allisonblake Level 1

      script snippet, in CS5 (but have same problem with version of the script for CS3):

       

      tell theDoc

      ...

      tell theStory

      ...
         set theList to (object reference of every text style range where font style is in boldStyles)

       

       

       

      In Tiger, this would generate a list of text ranges, such as "text from character 64 to character 110 of text flow id 55110 of document "thisdoc.indd""

       

      In Leopard and Snow Leopard, I get an error: Can’t get object reference

       

      I didn't write the original script and I can find a workaround by looping through the styles in the list but this one-liner seems better, if I can get it to work!

       

      Thoughts?

       

      Thanks!

        • 1. Re: [AS] Why does object reference of every text style range not work with Leopard/Snow Leopard
          L. Guy O'Rojo Level 2

          This works in CS4 on Mac OS 10.5.8 Intel:

           

          tell application "Adobe InDesign CS4"

          tell document 1

          tell page 1

          tell text frame 1

          tell parent story

          set theList to (object reference of every text style range) whose font style is in "Regular Medium"

          end tell

          end tell

          end tell

          end tell

          end tell

           

          That returns:

           

          {text from character 1 to character 22 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 23 to character 23 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 48 to character 48 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 49 to character 62 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 63 to character 64 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 65 to character 76 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 77 to character 77 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 78 to character 98 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 99 to character 129 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 130 to character 153 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 179 to character 228 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 229 to character 245 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 246 to character 275 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 276 to character 292 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4", text from character 293 to character 361 of story id 236 of document "Untitled-1" of application "Adobe InDesign CS4"}

          • 2. Re: [AS] Why does object reference of every text style range not work with Leopard/Snow Leopard
            allisonblake Level 1

            Yes, that works, but I need to get the object reference for a variety of font styles all at once, not just one.

             

            set theList to ((object reference of every text style range) whose font style is in boldStyles)

            where boldStyles is a list of font styles: {"Demi", "Bold", "65 Bold"}

             

            so it would find the reference to the text style range where the font style was either Demi, Bold, or 65 Bold.

            • 3. Re: [AS] Why does object reference of every text style range not work with Leopard/Snow Leopard
              L. Guy O'Rojo Level 2

              In my example, "Medium Italic" finds both "Medium" and "Italic". Notice that "Medium Italic" is not a list.

               

              egr

              1 person found this helpful