4 Replies Latest reply on Jun 21, 2014 1:17 AM by AdobeScripts

    vbscript cs2 characterstyle

    BCRandCo

      Hi,

      I am trying to update a script from 2.0 to CS2 and the script is stopping at the second of the following lines. I have had no luck trying to find out what the new command should be.

      Thanks.

      Michael

      Set myPoint = tempFrame.ParentStory.InsertionPoints

          myPoint.Item(myPoint.Count).CharacterStyle = myDocument.CharStyles.Item("Style 16")

        • 1. Re: vbscript cs2 characterstyle
          RobertKyle Level 2

          Have you tried myPoint.item(myPoint.Count-1)?

           

          It's been a long time since I've written any VB script, but I think it's like Javascript in that items in a list are numbered from 0 to whatever. So the last item in a 10-item list is item(9).

           

          I think I remember that VB provides an option to start numbering at 1, if that's more convenient. Your 2.0 script might have invoked that option.

          • 2. Re: vbscript cs2 characterstyle
            BCRandCo Level 1

            Thanks for your reply. Sorry, I never mentioned the error message:run-time Error 438: object doesn't support this property or method. I have two different text styles in this textframe. In textframes where there is only the default style and I don't have to set a character style, the text is added correctly. The -1 didn't change anything. :-(

            Michael

            • 3. Re: vbscript cs2 characterstyle
              BCRandCo Level 1

              Problem solved. from 2.0 to CS2, CharacterStyles became AppliedCharacterStyles and CharStyles became CharacterStyles

              • 4. Re: vbscript cs2 characterstyle
                AdobeScripts Level 3

                RobertKyle wrote:

                 

                It's been a long time since I've written any VB script, but I think it's like Javascript in that items in a list are numbered from 0 to whatever. So the last item in a 10-item list is item(9).

                In VB items are indexed from "1" - not from "0".