4 Replies Latest reply on Mar 17, 2009 3:20 AM by sstanleyau

    Intermittent problem

    sstanleyau Level 4
      I hate intermittent problems.<br /><br />I have a script that does stuff to documents. Unfortunately, artistes also<br />do things to the documents. So one of the things the script does when it<br />opens the docs is to do some, um, repairs, including setting the default<br />object styles. <br /><br />Because the script has to run in both CS3 and CS4, and the names of the<br />default styles changed between versions, I use this:<br /><br />  tell document 1<br /> try<br />  set graphicsObjStyle to object style "[Basic Graphics Frame]"<br /> on error<br />  set graphicsObjStyle to object style "[Normal Graphics Frame]"<br /> end try<br /> try<br />  set textObjStyle to object style "[Basic Text Frame]"<br /> on error<br />  set textObjStyle to object style "[Normal Text Frame]"<br /> end try<br />  set properties of page item defaults to {applied graphic object<br />style:object style 2, applied text object style:object style 3}<br /> ...<br /><br />This mostly runs fine, but sometimes I'll get an error: "Can¹t get object<br />style "[Normal Graphics Frame]" of document 1." This may be in CS3 or CS4,<br />and if I run it again, it usually works fine. It only seems to fail in the<br />middle of a large batch. Not much to go on, I know.<br /><br />Anyway, I'm wondering if I could just skip all that and assume the relevant<br />object styles are always in a fixed order, and so use:<br /><br /> tell document 1<br /> set properties of page item defaults to {applied graphic object<br />style:object style 2, applied text object style:object style 3}<br />...<br /><br />Can the index of the default object styles change?<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Sessions <a href=http://scriptingmatters.com/aspro>
        • 1. Re: Intermittent problem
          Level 1
          Why not use the app.version to guide your choice, but I rather suspect that you are right that you can rely on those being at the top of the list in the right order.

          Dave
          • 2. Re: Intermittent problem
            sstanleyau Level 4
            On 17/3/09 12:10 PM, "Dave Saunders" <member@adobeforums.com> wrote:<br /><br />> Why not use the app.version to guide your choice<br /><br />Good thought, although I'm not sure it will make a difference. My first try<br />was a filter, as in "object style 1 whose name is x or name is y", and I<br />still got the problem. I guess I'll just try by the numbers and see what<br />happens.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Sessions <a href=http://scriptingmatters.com/aspro>
            • 3. Re: Intermittent problem
              Harbs. Level 6
              I rely on the fact that the first is No Style and the second is Basic in
              a lot of my stuff. Nothing has broken yet... ;)

              --
              Harbs
              http://www.in-tools.com
              • 4. Re: Intermittent problem
                sstanleyau Level 4
                On 17/3/09 10:04 PM, "Harbs" <member@adobeforums.com> wrote:<br /><br />> I rely on the fact that the first is No Style and the second is Basic in<br />> a lot of my stuff. Nothing has broken yet...<br /><br />Exactly what I hoped to hear -- thanks!<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Sessions <a href=http://scriptingmatters.com/aspro>