Kurtferro Posted October 16, 2007 Share Posted October 16, 2007 I list sequences of the script: 1) The program starts with a gui (without tray icon) 2) The user sets the data and when it is done configure press "START" 3) When you press "START" the script hide the gui and creates a trayicon, at this time the program is running (it should be the next part of the script), in the meantime you can access the menu of trayicon find where three commands , Exit (work), hotkey list (work), returns to the main screen (not working) When restoring the main GUI (eliminating the trayicon): WinSetState("SroAutoMa by Kurtferro", "", @SW_SHOW) sleep(100) TraySetState (2) The GUI remains frozen (the while cicle that controls the gui dont start again) I think there is a passage that escape me, I would like to avoid if possible to restart the program (I want to learn by experience) I hope I have been clear, Tnx Link to comment Share on other sites More sharing options...
Valuater Posted October 16, 2007 Share Posted October 16, 2007 The portion of code you posted looks fine. But, its not enough to find the problem 8) Link to comment Share on other sites More sharing options...
PsaltyDS Posted October 16, 2007 Share Posted October 16, 2007 When restoring the main GUI (eliminating the trayicon): WinSetState("SroAutoMa by Kurtferro", "", @SW_SHOW) sleep(100) TraySetState (2) The GUI remains frozen (the while cicle that controls the gui dont start again) I think there is a passage that escape me, I would like to avoid if possible to restart the program (I want to learn by experience) This implies you expected WinSetState() to cause your script to branch to a While loop automatically? You'll have to explain or show what your script does after the WinSetState(). Perhaps you need to put your message loop in a function that you can call at any point, or switch to GuiOnEventMode. 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...
ashley Posted October 16, 2007 Share Posted October 16, 2007 (edited) I agree Post the whole code Edited October 16, 2007 by ashley Free icons for your programs Link to comment Share on other sites More sharing options...
Kurtferro Posted October 16, 2007 Author Share Posted October 16, 2007 (edited) ok^^ expandcollapse popup#cs ---------------------------------------------------------------------------- AutoIt Version: 3.2.9.2 (beta) Author: Kurtferro aka Akira Name: SROAutoMa Version: 1.0a #ce ---------------------------------------------------------------------------- #NoTrayIcon #include <GuiConstants.au3> #include <Color.au3> #include <File.au3> #include <string.au3> Opt("TrayMenuMode",1) HotKeySet("^\", "Terminate") HotKeySet("^z", "Iconizza") $exeDir = @ScriptDir & "\sroau.ini" $ecrypass = "ecrypass" ; GUI CheckPID() Opt("TrayMenuMode",1) GuiCreate("SroAutoMa by Kurtferro", 351, 280) WinSetOnTop("SroAutoMa by Kurtferro", "", 1) WinSetTrans("SroAutoMa by Kurtferro", "", 245) GuiCtrlCreateLabel("Version 1.0", 265, 4) GUICtrlSetColor (-1, 0x3740EA) GUISetFont (9, 400, 1, "Cambria Bold") ; TABs GuiCtrlCreateTab(1, 4, 348, 273) $TaB1 = GuiCtrlCreateTabItem(" AutoLogin ");---------------------------------TAB LOGIN GUISetFont (10, 400, 1, "Cambria Bold Italic") GUICtrlCreateGroup("silkroad.exe location", 5, 42, 320, 45, $WS_EX_ACCEPTFILES) $hFileSel = GUICtrlCreateButton("...", 295, 60, 26, 18) $hSilk = GUICtrlCreateInput("", 10, 60, 280, 16, -1, $WS_EX_STATICEDGE) GUICtrlCreateGroup("ID", 5, 92, 155, 45) $hID = GUICtrlCreateInput("", 10, 110, 140, 16, -1, $WS_EX_STATICEDGE) GUICtrlCreateGroup("Password", 170, 92, 155, 45) $hPass = GUICtrlCreateInput("",175, 110, 140, 16, 0x21, $WS_EX_STATICEDGE) $enable = GuiCtrlCreateCheckbox("Enable autologin (beta)", 7, 145, 160, 20) GUISetFont (9, 400, 1, "Cambria Bold") $StartBut1 = GuiCtrlCreateButton("START", 4, 257, 340, 17) $TaB2 = GuiCtrlCreateTabItem(" Skills setting ");---------------------------TAB SKILLS GUISetFont (8, 400, 1, "Cambria Bold Italic") GUICtrlCreateGroup("Attack Skills", 5, 30, 110, 225) GUISetFont (7, 400, 2) ;ATTACK $slotatt = GuiCtrlCreatecombo("F1", 55, 50, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"F2|F3|F4","") $imbue = GuiCtrlCreatecombo("OFF", 55, 80, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $skill1 = GuiCtrlCreatecombo("OFF", 55, 110, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $skill2 = GuiCtrlCreatecombo("OFF", 55, 140, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $skill3 = GuiCtrlCreatecombo("OFF", 55, 170, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $skill4 = GuiCtrlCreatecombo("OFF", 55, 200, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $turbo = GuiCtrlCreatecombo("OFF", 55, 230, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"ON","") GuiCtrlCreateLabel("SLOT:", 12, 54) GuiCtrlCreateLabel("IMBUE:", 12, 84) GuiCtrlCreateLabel("SKILL 1:", 12, 114) GuiCtrlCreateLabel("SKILL 2:", 12, 144) GuiCtrlCreateLabel("SKILL 3:", 12, 174) GuiCtrlCreateLabel("SKILL 4:", 12, 204) GuiCtrlCreateLabel("TURBO:", 12, 234) GUISetFont (8, 400, 1, "Cambria Bold Italic") GUICtrlCreateGroup("Buff Skills", 120, 30, 221, 225) ;BUFFS GUISetFont (7, 400, 2) $slotbuff = GuiCtrlCreatecombo("F1", 170, 50, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"F2|F3|F4","") $buff1 = GuiCtrlCreatecombo("OFF", 170, 80, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $buff2 = GuiCtrlCreatecombo("OFF", 170, 110, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $buff3 = GuiCtrlCreatecombo("OFF", 170, 140, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $buff4 = GuiCtrlCreatecombo("OFF", 170, 170, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $buff5 = GuiCtrlCreatecombo("OFF", 170, 200, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $buff6 = GuiCtrlCreatecombo("OFF", 273, 80, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $buff7 = GuiCtrlCreatecombo("OFF", 273, 110, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $buff8 = GuiCtrlCreatecombo("OFF", 273, 140, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $buff9 = GuiCtrlCreatecombo("OFF", 273, 170, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") $buff10 = GuiCtrlCreatecombo("OFF", 273, 200, 45, 50, $CBS_DROPDOWNLIST) GUICtrlSetData(-1,"1|2|3|4|5|6|7|8|9|0","") GuiCtrlCreateLabel("SLOT:", 127, 54) GuiCtrlCreateLabel("BUFF 1:", 127, 84) GuiCtrlCreateLabel("BUFF 2:", 127, 114) GuiCtrlCreateLabel("BUFF 3:", 127, 144) GuiCtrlCreateLabel("BUFF 4:", 127, 174) GuiCtrlCreateLabel("BUFF 5:", 127, 204) GuiCtrlCreateLabel("BUFF 6:", 230, 84) GuiCtrlCreateLabel("BUFF 7:", 230, 114) GuiCtrlCreateLabel("BUFF 8:", 230, 144) GuiCtrlCreateLabel("BUFF 9:", 230, 174) GuiCtrlCreateLabel("BUFF 10:", 230, 204) GUISetFont (9, 400, 1, "Cambria Bold Italic") GuiCtrlCreateLabel("HotKey ctrl+b for activate", 130, 234) GUISetFont (9, 400, 1, "Cambria Bold") $StartBut2 = GuiCtrlCreateButton("START", 4, 257, 340, 17) $TaB3 = GuiCtrlCreateTabItem(" Help/info ");-------------------------------------TAB HELP GUISetFont (9, 400, 1, "Cambria Bold") GuiCtrlCreateButton("DONATE", 3, 257, 340, 17) GuiSetState() RestoreSetting() $intResPuntoCorrente = CalcolaPunto() ;CICLO MAIN While 1 sleep(50) $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit 0 Case $msg = $hFileSel $sTmpFile = FileOpenDialog("Select file:", GUICtrlRead($hSilk), "(silkroad.exe)") If @error Then ContinueLoop $glFileName = $sTmpFile GUICtrlSetData($hSilk, $glFileName) Case $msg = $StartBut1 Or $msg = $StartBut2 SaveSetting() GoToTray() EndSelect WEnd ;FUNZIONI Func CheckPID() $list = ProcessList("SroAutoMa.exe") for $i = 1 to $list[0][0] if $list[$i][1] <> @AutoItPID then msgbox(0, $list[$i][0], "SroAutoMate is already executed!!") Sleep(5000) exit 0 EndIf next EndFunc Func SaveSetting() If FileExists($exeDir) Then IniWrite($exeDir, "autologin", "srolocation", GUICtrlRead($hSilk)) IniWrite($exeDir, "autologin", "id", _StringEncrypt(1, GUICtrlRead($hID), $ecrypass,2)) IniWrite($exeDir, "autologin", "pass", _StringEncrypt(1, GUICtrlRead($hPass), $ecrypass,2)) IniWrite($exeDir, "autologin", "autlenable", GUICtrlRead($enable)) IniWrite($exeDir, "skillsetting", "slotatt", GUICtrlRead($slotatt)) IniWrite($exeDir, "skillsetting", "imbue", GUICtrlRead($imbue)) IniWrite($exeDir, "skillsetting", "skill1", GUICtrlRead($skill1)) IniWrite($exeDir, "skillsetting", "skill2", GUICtrlRead($skill2)) IniWrite($exeDir, "skillsetting", "skill3", GUICtrlRead($skill3)) IniWrite($exeDir, "skillsetting", "skill4", GUICtrlRead($skill4)) IniWrite($exeDir, "skillsetting", "turbo", GUICtrlRead($turbo)) IniWrite($exeDir, "skillsetting", "slotbuff", GUICtrlRead($slotbuff)) IniWrite($exeDir, "skillsetting", "buff1", GUICtrlRead($buff1)) IniWrite($exeDir, "skillsetting", "buff2", GUICtrlRead($buff2)) IniWrite($exeDir, "skillsetting", "buff3", GUICtrlRead($buff3)) IniWrite($exeDir, "skillsetting", "buff4", GUICtrlRead($buff4)) IniWrite($exeDir, "skillsetting", "buff5", GUICtrlRead($buff5)) IniWrite($exeDir, "skillsetting", "buff6", GUICtrlRead($buff6)) IniWrite($exeDir, "skillsetting", "buff7", GUICtrlRead($buff7)) IniWrite($exeDir, "skillsetting", "buff8", GUICtrlRead($buff8)) IniWrite($exeDir, "skillsetting", "buff9", GUICtrlRead($buff9)) IniWrite($exeDir, "skillsetting", "buff10", GUICtrlRead($buff10)) Else _FileCreate ($exeDir) sleep(500) SaveSetting() EndIf EndFunc Func RestoreSetting() If FileExists($exeDir) Then GUICtrlSetData($hSilk, IniRead($exeDir, "autologin", "srolocation", "")) GUICtrlSetData($hID, _StringEncrypt(0, IniRead($exeDir, "autologin", "id", ""), $ecrypass, 2)) GUICtrlSetData($hPass, _StringEncrypt(0, IniRead($exeDir, "autologin", "pass", ""), $ecrypass, 2)) GUICtrlSetState($enable, IniRead($exeDir, "autologin", "autlenable", "")) GUICtrlSetData($slotatt, IniRead($exeDir, "skillsetting", "slotatt", "")) GUICtrlSetData($imbue, IniRead($exeDir, "skillsetting", "imbue", "")) GUICtrlSetData($skill1, IniRead($exeDir, "skillsetting", "skill1", "")) GUICtrlSetData($skill2, IniRead($exeDir, "skillsetting", "skill2", "")) GUICtrlSetData($skill3, IniRead($exeDir, "skillsetting", "skill3", "")) GUICtrlSetData($skill4, IniRead($exeDir, "skillsetting", "skill4", "")) GUICtrlSetData($turbo, IniRead($exeDir, "skillsetting", "turbo", "")) GUICtrlSetData($slotbuff, IniRead($exeDir, "skillsetting", "slotbuff", "")) GUICtrlSetData($buff1, IniRead($exeDir, "skillsetting", "buff1", "")) GUICtrlSetData($buff2, IniRead($exeDir, "skillsetting", "buff2", "")) GUICtrlSetData($buff3, IniRead($exeDir, "skillsetting", "buff3", "")) GUICtrlSetData($buff4, IniRead($exeDir, "skillsetting", "buff4", "")) GUICtrlSetData($buff5, IniRead($exeDir, "skillsetting", "buff5", "")) GUICtrlSetData($buff6, IniRead($exeDir, "skillsetting", "buff6", "")) GUICtrlSetData($buff7, IniRead($exeDir, "skillsetting", "buff7", "")) GUICtrlSetData($buff8, IniRead($exeDir, "skillsetting", "buff8", "")) GUICtrlSetData($buff9, IniRead($exeDir, "skillsetting", "buff9", "")) GUICtrlSetData($buff10, IniRead($exeDir, "skillsetting", "buff10", "")) EndIf EndFunc Func CalcolaPunto() $ResConstant = (1920 - @DesktopWidth)/2 Return (878 - $ResConstant) EndFunc Func Iconizza() If BitAnd(WinGetState("SRO_Client", ""), 16) Then WinSetState ("SRO_Client", "", @SW_RESTORE) Else WinSetState ("SRO_Client", "", @SW_MINIMIZE) EndIf EndFunc Func Terminate() Exit 0 EndFunc Func GoToTray() ;WinSetState("SroAutoMa by Kurtferro", "", @SW_DISABLE) WinSetState("SroAutoMa by Kurtferro", "", @SW_HIDE) TraySetState() TraySetToolTip("Click for the menu") $hotlist = TrayCreateItem("HotKey list") TrayCreateItem("") $returncp = TrayCreateItem("Return to controll pannel") TrayCreateItem("") $exititem = TrayCreateItem("Exit") TrayCreateItem("") TraySetState() While 1 sleep(30) $msg = TrayGetMsg() Select Case $msg = 0 ContinueLoop Case $msg = $hotlist Msgbox(64,"HotKey list","'Ctrl+z' for iconize/restore sro" & @CRLF & "'Ctrl+\' for terminate SroAutoMate") Case $msg = $returncp WinSetState("SroAutoMa by Kurtferro", "", @SW_SHOW) sleep(100) ;WinSetState("SroAutoMa by Kurtferro", "", @SW_ENABLE) TraySetState (2) Case $msg = $exititem ExitLoop EndSelect WEnd Exit EndFunc You can also try it, even if the main function does not yet exist, use the settings to play at your place in a game online, is not a bot but an advanced macro system, it allow you to select the mobs only without crush buttons for hours ^ ^, is a script that I had already done a basical level and now wanted to arrange a more complete GUI and beautiful. When it will work i will try to use your skyn system, certainly you will appear in thanks section ^ ^ Edited October 16, 2007 by Kurtferro Link to comment Share on other sites More sharing options...
Valuater Posted October 16, 2007 Share Posted October 16, 2007 (edited) use this While 1 ;sleep(30); ************* not needed $msg = TrayGetMsg() Select ;Case $msg = 0 *********************** not needed ;ContinueLoop ************************* not needed Case $msg = $hotlist Msgbox(64,"HotKey list","'Ctrl+z' for iconize/restore sro" & @CRLF & "'Ctrl+\' for terminate SroAutoMate") Case $msg = $returncp WinSetState("SroAutoMa by Kurtferro", "", @SW_SHOW) sleep(100) TraySetState (2) ExitLoop ; ********************************* added this!!!! Case $msg = $exititem Exit ; changed this EndSelect WEnd ; Exit ******* not needed EndFunc or just add a "return" where i put the ExitLoop 8) Edited October 16, 2007 by Valuater Link to comment Share on other sites More sharing options...
Kurtferro Posted October 16, 2007 Author Share Posted October 16, 2007 (edited) ehehe tnx, it was simple^^ i have tryed exitloop but it close all program but return work correctly, i must to fix only TrayCreateItem("HotKey list") etc for add it evertime i press start.. but no problem tnx again! Edited October 16, 2007 by Kurtferro Link to comment Share on other sites More sharing options...
Valuater Posted October 16, 2007 Share Posted October 16, 2007 Welcome!!! 8) 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