Jump to content

Recommended Posts

Posted (edited)

This sounds simple stuff...but I am new to this scripting stuff..!!

This is what I am trying to do ..

$a1 = "a"

$a2 = "b"

$a3 = "c"

$a4 = "d"

For $a = 1 TO 4

MsgBox (0, "Test", $a)

Next

actually I am trying to get the value for a1,a2,a3,a4 in the message box but the above script gives the value 1,2,3,4... can you recorrect the above code to get the values!!

Awaiting your response!

Thanks!

Edited by Ram
Posted (edited)

For $a1 = 1 TO 4
  MsgBox (0, "Test", Chr($a1 + 96))
Next

Thanks.. but this is not the one that I am looking for..!!

I have different variables and values to it..

say

$a1 = "RAM"

$a2 = "2"

$a3 = "Kumar"

$a4 = "Singh"

I want to put a for loop that reads the variable a1,a2,a3,a4 and then put them in the message box one by one..!!

So how do i go about doing that?

Edited by Ram
Posted

So like

Msgbox 1 has $a1 = "RAM"

And Msg Box 2 has $a1 = "RAM" and $a2 = "2"

And Msg box 3 has......

Is that what you want???

similar like that but

if Msgbox 1 has $a1 = "RAM"

Msgbox 2 should have $a2 = "2"

Msgbox 3 should have $a3 = "Kumar"

and so on..

Posted

Jump right in to learning arrays. Arrays and loops are your best friend.

Dim $array[5] = [4, 'a', 'b', 'c', 'd']

For $i = 1 To $array[0]
    MsgBox(0, "Test", $array[$i])
Next
Ooops.. I missed your code.. Thanks for the eg. thisis what I was looking for... i will go ahead look at the array help file..!!

Thanks!

Posted

Did you even look at xcal's code?? Thats what his does.

Cange 'a' to Ram and so on....

:)

Just replied to him.. Thanks!

Posted

How about having a while loop?

EXAMPLE:

$num = 1
$a1 = "a"
$a2 = "b"
$a3 = "c"
$a4 = "d"

While 1
    MsgBox (0, "Test", $a & $num)
    $num = $num + 1
    If $num > 4
        ExitLoop
    EndIf
WEnd
[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...