Sign in to follow this  
Followers 0
Nologic

increment Variables

6 posts in this topic

Hi guys I'm pulling hair out and its probably some thing simple that I"m missing.

Any ways here is what I'm looking at...I got some vars set at the top of my script like so:

$0P_1 = "dog"

$0P_2 = "cat"

$0P_3 = "bird"

...

Further down the script I look to make use of those vars, doing some thing like so:

For $i1 = 1 To 10 Step 1

ControlSetText ( $Title_1 , "" , "Edit" & $i1 , $OP_ & $i1 )

Next

This part "$OP_ & $i1" of it breaks...I've tried using Chr( ) and such...but thus far no luck...any one have any suggestions? :)

Share this post


Link to post
Share on other sites



Hi Nologic

Wouldn't it be better using arrays instead of variables for this. I do not believe you can join and create variables like you are displaying?

Share this post


Link to post
Share on other sites

Hey hows it going? :)

Well I know jack about programming hence the hair pulling. ;)

Tho if you can toss up an example based loosely off what I posted I can probably run with it. :)

Share this post


Link to post
Share on other sites

I'm fine

$OP = StringSplit('dog cat bird', ' ')

For $i = 1 To $OP[0]
MsgBox(0,'Arrays are ' , $OP[$i])
Next
Try this.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

hmm might be able to make that work for what I'm needing.

What I"m looking at doing is customizing the File Extension Classifications in VuePrint durning install with out a mess of code. :)

Send me a PM with your email addy and I'll send you what I got.

*Update*

Okay did a combo of what was suggested by Mhz along with my own code that I posted above. The end result is a easy to read and use bit of code that removed the need for a large amount of coding...since I was looking at setting values for 96 edit boxes.

Actual code used:

$EX_1  = ".gif|||||||"                              ; GIF File Extension Classification
$EX_2  = ".bmp|.dib|.rle|||||"                      ; BMP File Extension Classification
$EX_3  = ".pcx|||||||"                              ; PCX File Extension Classification
$EX_4  = ".tga|||||||"                              ; TGA File Extension Classification
$EX_5  = ".jpg|.jpe|.cam|.sfw|.pmp|.pwp|.j6i|.jpeg" ; JPG File Extension Classification
$EX_6  = ".tif|.kdc|.k25|.crw||||"                  ; TIF File Extension Classification
$EX_7  = ".wmf||||||.png|"                          ; WMF File Extension Classification
$EX_8  = ".wav|.mid|.rmi|.au|.aif|.snd|.mpa|.mp3"   ; WAV File Extension Classification
$EX_9  = ".avi|.mov|.mpg|.mpe|.fli|.flc|.qt|.mpe"   ; AVI File Extension Classification
$EX_10 = ".sli|||||||"                              ; SLI File Extension Classification
$EX_11 = ".uue|.mim|.mm|.msg|.hqx|.uu1|.01|.ntx"    ; UUE File Extension Classification
$EX_12 = ".zip|||||||"                              ; ZIP File Extension Classification


$Title_1 = "Configure Extensions and File Associations"

$i = 1

For $i1 = 1 To 12 Step 1
     $i2 = Eval( "EX_" & $i1 )
     $EX = StringSplit( $i2 , '|')

     For $i3 = 1 To $EX[0]
           ControlSetText ( $Title_1 , "" , "Edit" & $i  , $EX[$i3] )
           $i = $i + 1
     Next
Next
Edited by Nologic

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Well I did manage to get the code that Mhz suggested to work, and it was a huge impovement over my original code. Heh by leaps and bounds. :)

How ever I did manage to get figured out the original question which worked out for my problem to be lesser code yet.

For $i1 = 1 To 10 Step 1
   $i2 = Eval( "OP_" & $i1 )
   ControlSetText ( $Title_1 , "" , "Edit" & $i1 , $i2 )
Next

Many thanks to Mhz for his time and effort...Plus showing me a new trick. :)

Edited by Nologic

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0