walle Posted February 17, 2008 Share Posted February 17, 2008 Been wondering for a long time if it is possible to have multiply functions operative at the same time, instead of a queue. Example, while func1 monitoring a program, button2 will respond and start func2. Any idea? #include <GUIConstants.au3> GUICreate("Test") GUISetState (@SW_SHOW) $Button1 = GUICtrlCreateButton("Endless loop",5,20) $Button2 = GUICtrlCreateButton("Show msg",5,50) GUISetState (@SW_SHOW) While 1 $msg = GUIGetMsg() Switch $msg Case $Button1 Endless_loop() Case $Button2 Showmsg() Case $GUI_EVENT_CLOSE Exit EndSwitch Wend Func Endless_loop() WinWaitActive("Appthatdon't exist") EndFunc Func Showmsg() msgbox(0,"","hey") EndFunc Link to comment Share on other sites More sharing options...
Xand3r Posted February 17, 2008 Share Posted February 17, 2008 (edited) well you could do an onevent but... it still pauses the current function so... it's not what you want... what you want is multithreading and well... it's not really possible in autoit (not in it's true sense anyway) Edited February 17, 2008 by alexmadman Only two things are infinite, the universe and human stupidity, and i'm not sure about the former -Alber EinsteinPractice makes perfect! but nobody's perfect so why practice at all?http://forum.ambrozie.ro Link to comment Share on other sites More sharing options...
Linux Posted February 18, 2008 Share Posted February 18, 2008 Create a timer, that fires a function every X seconds to check your program. then do the rest of the code as normal.http://www.autoitscript.com/forum/index.ph...8&hl=timers You can help! Donate to AutoIt! or, visit ClimatePREDICTION.netMy posts:Travian Bot Example (100+ servers) BETAHow to Host you code/app for free! (unlimited team number) (Public or Private)"Sir, we're surrounded!" "Excellent. We can attack in any direction!" Link to comment Share on other sites More sharing options...
MHz Posted February 18, 2008 Share Posted February 18, 2008 Don't use blocking functions comes to mind at 1st. For the "Endless_loop" UDF, you can use WinExists() to allow the function to return if no window exists by that title. It is common practice to disable a gui/controls while it is busy processing an event. Link to comment Share on other sites More sharing options...
walle Posted February 21, 2008 Author Share Posted February 21, 2008 If I put $MSG = GUIGetMsg() beneath the do until loop the gui will respond with a delay of 10-20 sec if I spam the close button. How do I work with timers? expandcollapse popup$MSG = GUIGetMsg() Select Case $MSG = $GUI_EVENT_CLOSE msgbox(0,"","lalalal") EndSelectoÝ÷ Ù8^~éܶ*'¶nZËaz¢jëh×6Func START() WinWait("[REGEXPTITLE:Torrent.\d+.*$]") WinSetState("[REGEXPTITLE:Torrent.\d+.*$]","",@SW_SHOWNORMAL) Do ; ------------------------<Putting $MSG = GUIGetMsg() $GetWST = WinGetState("[REGEXPTITLE:Torrent.\d+.*$]") If $GetWST = BitAND(21,23) Then WinSetState("[REGEXPTITLE:Torrent.\d+.*$]","",@SW_SHOWNORMAL) WinSetState("[REGEXPTITLE:Torrent.\d+.*$]","",@SW_HIDE) EndIf $title = "[REGEXPTITLE:Torrent.\d+.*$]" $listcontrol = "[CLASSNN:SysListView321]" $hWnd = ControlGetHandle( $title, "", $listcontrol ) $header_hWnd = _GUICtrlListView_GetHeader($hWnd) $FindTN = _GUICtrlListView_FindInText($HWND, $READRSS) $TEST = _GUICtrlListView_GetItemText($HWND, $FindTN) $ccount = ControlListView("[REGEXPTITLE:Torrent.\d+.*$]", "", "SysListView321", "GetSubItemCount") $icount = ControlListView("[REGEXPTITLE:Torrent.\d+.*$]", "", "SysListView321", "GetItemCount") Dim $listarray[$ccount][$icount+1] For $c = 0 To $ccount-1 $listarray[$c][0] = _GUICtrlListView_GetItemText($header_hWnd, $c) $Countmore = $icount - $FindTN For $i = $FindTN To $icount-$Countmore $itemtext = _GUICtrlListView_GetItemText($hWnd, $i, $c) $listarray[$c][$i+1] = $itemtext Next Next For $c = 0 To $ccount-1 ;ConsoleWrite($listarray[$c][0]) For $i = 0 To $icount-1 ;ConsoleWrite($listarray[$c][$i+1]) Next ;ConsoleWrite("|") Next For $c = 0 To $ccount-1 $tmp = '' For $i = 0 To $icount-1 $tmp &= $listarray[$c][$i+1] Next Switch $c Case 4 GUICtrlSetData($TORRENT,"Status:" & ' ' & $listarray[$c][0] & $tmp) Case 3 GUICtrlSetData($LABEL4,"Klart:" & ' ' & $listarray[$c][0] & $tmp) Case 5 GUICtrlSetData($LABEL1,"Källor:" & ' ' & $listarray[$c][0] & $tmp) Case 6 GUICtrlSetData($LABEL5,"Klienter:" & ' ' & $listarray[$c][0] & $tmp) Case 7 GUICtrlSetData($LABEL11,"Nedl-Hastighet:" & ' ' & $listarray[$c][0] & $tmp) EndSwitch Next $ReadSS = GUICtrlRead($LABEL4) $MSG = StringTrimLeft($ReadSS,7) sleep(1000) Until $MSG = "100.0 %" Link to comment Share on other sites More sharing options...
walle Posted February 21, 2008 Author Share Posted February 21, 2008 Can anyone post timers.au3? Thanks 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