Sign in to follow this  
Followers 0
hardwarepower

switch around

3 posts in this topic

I am trying to write a script the switches moves text up and down like shown below

with just running the script and have it loop back after switch 4

==switch 1==

[button]

[button_1]

[button_2]

[button_3]

==switch 2==

[button_1]

[button]

[button_2]

[button_3]

==switch 3==

[button_1]

[button_2]

[button]

[button_3]

==switch 4==

[button_1]

[button_2]

[button_3]

[button]

Share this post


Link to post
Share on other sites



Something like this?

#include <Array.au3>

Global $aArr[4]=["button","button_1","button_2","button_3"]
_ArrayDisplay($aArr)
For $i=0 To 3
$sTest=_Array_Rotate($aArr,1)
_ArrayDisplay($sTest)
Next

Func _Array_Rotate(ByRef $aArray, $iRotate=0)
    ;0 - rotate right
    ;1 - rotate left
    Local $aTmp=$aArray
    Switch $iRotate
        Case 0
            Local $x=$aTmp[0]
            For $i=0 To UBound($aArray)-2
                $aTmp[$i]=$aArray[$i+1]
            Next
            $aTmp[UBound($aArray)-1]=$aArray[0]
            $x=""
            $aArray=$aTmp
        Case 1
            Local $x=$aTmp[UBound($aArray)-1]
            For $i=1 To UBound($aArray)-1
                $aTmp[$i]=$aArray[$i-1]
            Next
            $aTmp[0]=$x
            $x=""
            $aArray=$aTmp
    EndSwitch
    Return $aArray
EndFunc

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