Kurtferro Posted October 19, 2007 Share Posted October 19, 2007 (edited) I wish that my program has a menu (in the tray) while it doing other things, I find it locked when the main function is started, the menu remains cut off from the previous function. When the program is launched by pressing the start button it go in the tray and should do two things together: The main function: Func KeystrokesAttSkill() $AttSkillstop = 0 if GUICtrlRead($turbo) = "ON" Then $turbo = 100 else $turbo = 200 EndIf $skattArray = _ArrayCreate("null", GUICtrlRead($imbue) , GUICtrlRead($skill1), GUICtrlRead($skill2), GUICtrlRead($skill3), GUICtrlRead($skill4)) For $i = 5 To 1 step -1 if $skattArray[$i] = "OFF" then _ArrayDelete($skattArray, $i) Next $confirmArray = UBound($skattArray) -1 if $confirmArray <> 0 Then Do ;Sleep(100) ;if PixelGetColor($intResPuntoCorrente, 45) = 16762566 Then For $i = 1 to $confirmArray Sleep($turbo) Send($skattArray[$i]) Next ;EndIf Until $AttSkillstop = 1 EndIf EndFunc And in the meantime must give the possibility to use its menu: expandcollapse popupFunc GoToTray() WinSetState("SroAutoMa by Kurtferro", "", @SW_HIDE) TraySetState() TraySetToolTip("Click for the menu") if $TrayItemCreated = 0 then Global $hotlist = TrayCreateItem("HotKey list") TrayCreateItem("") Global $returncp = TrayCreateItem("Return to control pannel") TrayCreateItem("") Global $exititem = TrayCreateItem("Exit") TrayCreateItem("") $TrayItemCreated = 1 TraySetState() Else TraySetState (1) EndIf KeystrokesAttSkill() <<< cant be here or succesive while cant run, but how? While 1 sleep(40) $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $hotlist Msgbox(64,"HotKey list"," ''Ctrl+s'' for pause/restart auto skill" & @CRLF & " ''Ctrl+b'' for start buffing" & @CRLF & " ''Ctrl+z'' for iconize/restore sro" & @CRLF & " ''Ctrl+\'' for terminate SroAutoMate") Case $msg = $returncp $AttSkillstop = 1 WinSetState("SroAutoMa by Kurtferro", "", @SW_SHOW) sleep(50) TraySetState (2) return Case $msg = $exititem ExitLoop EndSelect WEnd tnx for ur patience^^ Edited October 19, 2007 by Kurtferro Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 19, 2007 Share Posted October 19, 2007 You want to run your menu in Event Mode. That will free your script from the TrayGetMsg() loop. The example script in the help file under TraySetOnEvent() will give you the basics. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
Kurtferro Posted October 19, 2007 Author Share Posted October 19, 2007 ok tnx i look now Link to comment Share on other sites More sharing options...
Valuater Posted October 19, 2007 Share Posted October 19, 2007 This is "one" approach, however it appears you have more than 1 loop ( not here ) I always, and strongly suggest for you to use the tray as "on event mode" expandcollapse popupWinSetState("SroAutoMa by Kurtferro", "", @SW_HIDE) TraySetState() TraySetToolTip("Click for the menu") $TrayItemCreated = 0 If $TrayItemCreated = 0 Then Global $hotlist = TrayCreateItem("HotKey list") TrayCreateItem("") Global $returncp = TrayCreateItem("Return to control pannel") TrayCreateItem("") Global $exititem = TrayCreateItem("Exit") TrayCreateItem("") $TrayItemCreated = 1 TraySetState() Else TraySetState(1) EndIf While 1 Sleep(40) $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $hotlist MsgBox(64, "HotKey list", " ''Ctrl+s'' for pause/restart auto skill" & @CRLF & " ''Ctrl+b'' for start buffing" & @CRLF & " ''Ctrl+z'' for iconize/restore sro" & @CRLF & " ''Ctrl+\'' for terminate SroAutoMate") Case $msg = $returncp $AttSkillstop = 1 WinSetState("SroAutoMa by Kurtferro", "", @SW_SHOW) Sleep(50) TraySetState(2) ;return Case $msg = $exititem ExitLoop EndSelect If GUICtrlRead($turbo) = "ON" Then $turbo = 100 Else $turbo = 200 EndIf $AttSkillstop = 0 $skattArray = _ArrayCreate("null", GUICtrlRead($imbue), GUICtrlRead($skill1), GUICtrlRead($skill2), GUICtrlRead($skill3), GUICtrlRead($skill4)) For $i = 5 To 1 Step - 1 If $skattArray[$i] = "OFF" Then _ArrayDelete($skattArray, $i) Next $confirmArray = UBound($skattArray) - 1 If $confirmArray <> 0 Then Do ;Sleep(100) ;if PixelGetColor($intResPuntoCorrente, 45) = 16762566 Then For $i = 1 To $confirmArray Sleep($turbo) Send($skattArray[$i]) Next ;EndIf Until $AttSkillstop = 1 EndIf WEnd 8) Link to comment Share on other sites More sharing options...
Kurtferro Posted October 19, 2007 Author Share Posted October 19, 2007 (edited) Yes now work, Fortunately when we make a mistake or do not know something just ask here, as I learn easier than studying book, in fact I am a self-taught, first I learned a language that concerned NeverWinter nights, a game online, i was wonderful and requested with 5 years of experience. Now the code is as follows: expandcollapse popupOpt("TrayOnEventMode",1) Opt("TrayMenuMode",1) Func KeystrokesAttSkill() $AttSkillstop = 0 if GUICtrlRead($turbo) = "ON" Then $turbo = 300 else $turbo = 400 EndIf $skattArray = _ArrayCreate("null", GUICtrlRead($imbue) , GUICtrlRead($skill1), GUICtrlRead($skill2), GUICtrlRead($skill3), GUICtrlRead($skill4)) For $i = 5 To 1 step -1 if $skattArray[$i] = "OFF" then _ArrayDelete($skattArray, $i) Next $confirmArray = UBound($skattArray) -1 if $confirmArray <> 0 Then Do Sleep(500) if PixelGetColor($intResPuntoCorrente, 45) = 16762566 Then For $i = 1 to $confirmArray Sleep($turbo) Send($skattArray[$i]) Next EndIf Until $AttSkillstop = 1 EndIf EndFunc Func GoToTray() WinSetState("SroAutoMa by Kurtferro", "", @SW_HIDE) TraySetState() TraySetToolTip("Click for the menu") if $TrayItemCreated = 0 then $hotlist = TrayCreateItem("HotKey list") TrayItemSetOnEvent(-1,"hotlist") TrayCreateItem("") $returncp = TrayCreateItem("Return to control pannel") TrayItemSetOnEvent(-1,"Returntocp") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TrayItemSetOnEvent(-1,"Terminate") TrayCreateItem("") $TrayItemCreated = 1 TraySetState() Else TraySetState (1) EndIf KeystrokesAttSkill() EndFunc Func hotlist() Msgbox(64,"HotKey list"," ''Ctrl+s'' for stop/restart auto skills" & @CRLF & " ''Ctrl+b'' for start buffing" & @CRLF & " ''Ctrl+z'' for iconize/restore sro" & @CRLF & " ''Ctrl+\'' for terminate SroAutoMate") EndFunc Func Returntocp() $AttSkillstop = 1 WinSetState("SroAutoMa by Kurtferro", "", @SW_SHOW) Sleep(50) TraySetState (2) return EndFunc Func Terminate() Exit 0 EndFunc etc.... Edited October 19, 2007 by Kurtferro 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