marko001 Posted April 5, 2008 Posted April 5, 2008 (edited) I have a structure like while 1 Case $msg[0] = ... run program A Case $msg[0] = ... run program B Case $msg[0] = ... do another thing Case $msg[0] = ... do another thing Case $msg[0] = ... do another thing wend i created a routine to check every 30 secs if "program A" is active (if not relaunch it) and if "program B" is active (if not relaunch it): func _checkA sleep (30000) $valueA = processexists (programA) if $value = 0 then _launchA endfunc func _checkB same as func A and i put the 2 _func inside the while BUT outsie the select ... ... endselect _checkA _checkB wend But now i have a loop i can't interrupt since once i launch the .au3 he goes to _check, polls every (sleep 30000) and i'm not able to click any button on my form. What i think is i need a parallel procedure that checks if programs are active while i still have full control on my au3 and can run/manage other "case" Please help! Thanks, Marco Edited April 5, 2008 by marko001
Achilles Posted April 5, 2008 Posted April 5, 2008 Try AdLibEnable in the helpfile.. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
marko001 Posted April 6, 2008 Author Posted April 6, 2008 Try AdLibEnable in the helpfile.. well, i used it, AdlibEnable("_checkgameA",20000) AdlibEnable("_checkgameB",20000) While 1 $msg = GUIGetMsg(1) Select ... ... wend and func _checkgameA() if $controlforchecking1 = true Then _tcpsend(1,"/status") sleep(1000) $msg = TCPRecv($oSocket1, 1500) If StringInStr($msg, "True") Then _status(1,"Game is still up!") Else _status(1,"Game closed! Relogging...") GUICtrlSetData($g1start, "Game1") _Launch(1) _Start(1) EndIf return 1 Else return 0 EndIf EndFunc But (i checked with msgbox to test it) the func is never called.... either if controlforchecking1 is true or false. Any suggestions?
martin Posted April 6, 2008 Posted April 6, 2008 well, i used it, AdlibEnable("_checkgameA",20000) AdlibEnable("_checkgameB",20000) While 1 $msg = GUIGetMsg(1) Select ... ... wend and func _checkgameA() if $controlforchecking1 = true Then _tcpsend(1,"/status") sleep(1000) $msg = TCPRecv($oSocket1, 1500) If StringInStr($msg, "True") Then _status(1,"Game is still up!") Else _status(1,"Game closed! Relogging...") GUICtrlSetData($g1start, "Game1") _Launch(1) _Start(1) EndIf return 1 Else return 0 EndIf EndFunc But (i checked with msgbox to test it) the func is never called.... either if controlforchecking1 is true or false. Any suggestions?You cab have 1 function only for AdLibEnable. Since you want both to run every 20 seconds you could could do something like this Global $gameA = true AdlibEnable("AorB",10000) Func AorB() if $gameA then _checkgameA() else _checkgameB() endif $gameA = not $gameA endfunc Or Adlibenable("AandB",20000) Func AandB() _checkgameA() _checkgameB() endfunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Developers Jos Posted April 6, 2008 Developers Posted April 6, 2008 You can only have one adlib active at a time. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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