Results 1 to 2 of 2

Thread: [RESOLVED] vbscript to trap counter

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Jul 2009
    Posts
    31

    Resolved [RESOLVED] vbscript to trap counter

    Just trying to extract a counter in a loop to assign as a variable in a script, for example-

    count=0

    Do Until Count > 1
    count=count+1

    Line(count) = "blah,blah, blah" <- I need this line to be translated as follows
    Line1 = "blah,blah, blah"

    Loop

    How do I insert the counter # (number1) in the variable name?

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: vbscript to trap counter

    You don't... the usual way to do that kind of thing is to create an Array (a variable with many elements), and refer to each item as you did on the first of those lines (eg: Line(count)= ... and ... = Line(count) , etc).

    There is a good article about arrays in the "Data types/variables" section of our Classic VB FAQs (in the FAQ forum). While VBScript and Classic VB have several differences, I'm fairly sure that this is one area where they are identical.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width