atomman Posted January 13, 2008 Share Posted January 13, 2008 i need to record the order in which buttons are pushed, then preform a function based on that order. i think i need to use $Array[]=$var, but i'm having trouble figuring out how. example... $Button1 does $1 $Button2 does $2 $Button3 does $3 so if buttons are clicked in the order: 2,1,3 then i need do something like this... $Button4 does $2 & $1 & $3 so i think i need to... $Array[1]=$1 $Array[2]=$2 $Array[3]=$3 but how do i get from there to '$Button4 = $2 & $1 & $3' ? Link to comment Share on other sites More sharing options...
erezlevi Posted January 13, 2008 Share Posted January 13, 2008 i need to record the order in which buttons are pushed, then preform a function based on that order. i think i need to use $Array[]=$var, but i'm having trouble figuring out how. example... $Button1 does $1 $Button2 does $2 $Button3 does $3 so if buttons are clicked in the order: 2,1,3 then i need do something like this... $Button4 does $2 & $1 & $3 so i think i need to... $Array[1]=$1 $Array[2]=$2 $Array[3]=$3 but how do i get from there to '$Button4 = $2 & $1 & $3' ? hi, try using Select and the Case within it. what ever you do, do not exit ( exit the loop ). use a while before it while $i=0 and Wend at the and. Link to comment Share on other sites More sharing options...
atomman Posted January 13, 2008 Author Share Posted January 13, 2008 thanks, but i think i found a much simpler way. i'll post back with example if it works. i appreciate the your response though! Link to comment Share on other sites More sharing options...
erezlevi Posted January 13, 2008 Share Posted January 13, 2008 thanks, but i think i found a much simpler way. i'll post back with example if it works. i appreciate the your response though! ok, i wrote this hope it can help you: expandcollapse popup#include <Array.au3> #include <GUIConstants.au3> #AutoIt3Wrapper_run_debug_mode=Y Local $m1,$m2,$m3 $i=1 $Array=_ArrayCreate ($m1,$m2,$m3) GUICreate ("erez") $button1=GUICtrlCreateButton ("1",0,10) $button2=GUICtrlCreateButton ("2",0,30) $button3=guictrlcreatebutton ("3",0,50) guisetstate() While 1 $msg = GUIGetMsg () Select case $msg = $button1 _ArrayInsert ($Array,$i,"1") $i=$i+1 case $msg = $button2 _ArrayInsert ($Array,$i,"2") $i=$i+1 case $msg = $button3 _ArrayInsert ($Array,$i,"3") $i=$i+1 EndSelect If $i=4 Then ExitLoop If $msg = $GUI_EVENT_CLOSE then Exit WEnd $array2=_ArrayDisplay ($Array,"erez") $m5=$Array[1] $m6=$Array[2] $m7=$Array[3] MsgBox (0,"pressed on",$m5&$m6&$m7) Link to comment Share on other sites More sharing options...
atomman Posted January 13, 2008 Author Share Posted January 13, 2008 (edited) that's a little different than what i did EDIT: silly me - should've been this... Case Button1 $Order = ($Order & $Do1) Case Button2 $Order = ($Order & $Do2) Case Button3 $Order = ($Order & $Do3) Case Button4 MsgBox(0,"",$Order) Edited January 13, 2008 by atomman Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now