Sign in to follow this  
Followers 0
GameIDevelp

How to Change var with array when loop ..?

10 posts in this topic

How to Change "$change" results , with array "$pr[0]" and "$pr[1]" - - - $pr[5] every time when the loop ...?

I have this code .....

Dim $pr[5] 
$pr[0] = "cccc"
$pr[1] = "dddd"
$pr[2] = "eeee"
$pr[3] = "artt"
$pr[4] = "huge"


$loop = 1
$var1 = 0
While $loop = 1
    $var1 = $var1 + 1 
    $change = $pr[0]
    
    If $var1 = 1 Then 
        
        MsgBox(0, "ms", $change)
       
    Else
        MsgBox(0, "ms", "not1")
        
        If $var1 = 2 Then  
        MsgBox(0, "msg", "ok-2")
            Else
        MsgBox(0, "ms", "not2")
        EndIf
    EndIf


    $loop = 1
WEnd

Share this post


Link to post
Share on other sites



@GameIDevelp

I dont understand you :P

$change = $pr[0+$loop]oÝ÷ Ù«­¢+ØÀÌØí¡¹ôÀÌØíÁÈ()%ÀÌØíÙÈÄôÄQ¡¸(½ÈÀÌØí¤ôÄѼU ½Õ¹ ÀÌØíÁȤ´Ä(5Í   ½à À°ÅÕ½ÐíµÌÅÕ½Ðì°ÀÌØí¡¹¤(9áÐ)¹%

Hope that helps

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

the $change results is "ccc" from $pr[0] ,, I make this var "$change for me to understand the change value var to another value var . I hop you understand .. :P

The code not work ,, return just 1 ,2 ,3 ,4 , not value of $pr[0] , $pr[1] etc --- $pr[5] ...

Share this post


Link to post
Share on other sites

anybody know ..? :P ... please ...

Share this post


Link to post
Share on other sites

can you exaplain each line of your code ?

Local $pr[5] 
$pr[0] = "cccc"
$pr[1] = "dddd"
$pr[2] = "eeee"
$pr[3] = "artt"
$pr[4] = "huge"

$loop = 1
$var1 = 0
While $loop < 5; While $loop = 1
    $var1 += 1; $var1 = $var1 + 1 
    $change = $pr[0]; "cccc"
    
    If $var1 = 1 Then       
        MsgBox(0, "ms", $pr[$i]); $change)     
    Else
        MsgBox(0, "ms", "not1")     
        If $var1 = 2 Then  
        MsgBox(0, "msg", "ok-2")
            Else
        MsgBox(0, "ms", "not2")
        EndIf
    EndIf
$loop += 1
WEnd

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

can you exaplain each line of your code ?

Local $pr[5] 
$pr[0] = "cccc"
$pr[1] = "dddd"
$pr[2] = "eeee"
$pr[3] = "artt"
$pr[4] = "huge"

$loop = 1
$var1 = 0
While $loop < 5; While $loop = 1
    $var1 += 1; $var1 = $var1 + 1 
    $change = $pr[0]; "cccc"
    
    If $var1 = 1 Then       
        MsgBox(0, "ms", $pr[$i]); $change)     
    Else
        MsgBox(0, "ms", "not1")     
        If $var1 = 2 Then  
        MsgBox(0, "msg", "ok-2")
            Else
        MsgBox(0, "ms", "not2")
        EndIf
    EndIf
$loop += 1
WEnd

Cheers, FireFox.

Your code is not displayed corectly ..

I wont to make this variable "$change" to change every time when the loop code to change into the 1 value of variable $pr ,,

When Loop 1 the I wont to change value of variable "$change" into the value of variable "$pr[0] ,,,,, and for loop 2 change $change to $pr[1] and next next next and again ..

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Edit: You could change all the $i to $var1 if you wanted to..basically that one $i was messing you up.

Edit2: Meh code tags (use his version below (less to write and easier to use).

Local $pr[5]
$pr[0] = "cccc"
$pr[1] = "dddd"
$pr[2] = "eeee"
$pr[3] = "artt"
$pr[4] = "huge"

$i = 0
$loop = 1
While $loop < 5; While $loop = 1
    $i += 1; $var1 = $var1 + 1
    $change = $pr[0]; "cccc"
    
    If $i = 1 Then       
        MsgBox(0, "ms", $pr[$i]); $change)    
    Else
        MsgBox(0, "ms", "not1")     
        If $i = 2 Then  
        MsgBox(0, "msg", "ok-2")
            Else
        MsgBox(0, "ms", "not2")
        EndIf
    EndIf
$loop += 1
WEnd
Edited by Gondus

-----------Current Programming Language Status:Beginner: J#, Ruby Intermediate: Autoit, Java, C#, C++Advanced: Basic, Visual Basic, Fortran

Share this post


Link to post
Share on other sites

Your code is not displayed corectly ..

I wont to make this variable "$change" to change every time when the loop code to change into the 1 value of variable $pr ,,

When Loop 1 the I wont to change value of variable "$change" into the value of variable "$pr[0] ,,,,, and for loop 2 change $change to $pr[1] and next next next and again ..

You normally use For-loops for that kind of thing, like in Firefox first post. Here is another example:

Local $pr[5] 
$pr[0] = "cccc"
$pr[1] = "dddd"
$pr[2] = "eeee"
$pr[3] = "artt"
$pr[4] = "huge"

For $X = 0 To 4
    $change = $pr[$X]
    MsgBox(0, "", $change)
Next

Share this post


Link to post
Share on other sites

wooo ,,,, thanks guys . :P .

Sorry for my misunderstanding I dont know very good autoit ..

Share this post


Link to post
Share on other sites

wooo ,,,, thanks guys . :P .

Sorry for my misunderstanding I dont know very good autoit ..

Thats why this forums is here :unsure:


-----------Current Programming Language Status:Beginner: J#, Ruby Intermediate: Autoit, Java, C#, C++Advanced: Basic, Visual Basic, Fortran

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