wanderson Posted July 4, 2010 Share Posted July 4, 2010 I can not find why the program does not continue execution of the code, simply execute the first task and does not continue and I can not close it. I think is using the wrong form of the Checkbox Verica. Someone could help me or indicate another way of checking the checkbox? expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form=k:\prog\gui\main.kxf $main = GUICreate("Instalador de jogos.", 623, 442, -1, -1) GUISetBkColor(0xFFFFFF) Dim $Checkbox[15] $Checkbox[0] = GUICtrlCreateCheckbox("MuBr", 64, 96, 97, 17) $Checkbox[1] = GUICtrlCreateCheckbox("MuConnection", 64, 120, 97, 17) $Checkbox[2] = GUICtrlCreateCheckbox("MuAway", 64, 144, 97, 17) $Checkbox[3] = GUICtrlCreateCheckbox("MuHellFire", 64, 168, 97, 17) $Checkbox[4] = GUICtrlCreateCheckbox("GunBound", 64, 192, 97, 17) $Checkbox[5] = GUICtrlCreateCheckbox("Cabal Online", 64, 216, 97, 17) $Checkbox[6] = GUICtrlCreateCheckbox("Flyff", 64, 240, 97, 17) $Checkbox[7] = GUICtrlCreateCheckbox("GTA San Andreas", 64, 264, 105, 17) $Checkbox[8] = GUICtrlCreateCheckbox("Counter-striker 1.6", 248, 96, 105, 17) $Checkbox[9] = GUICtrlCreateCheckbox("Warcraft", 248, 120, 97, 17) $Checkbox[10] = GUICtrlCreateCheckbox("NFS Hot Pursuit 2", 248, 144, 105, 17) $Checkbox[11] = GUICtrlCreateCheckbox("NFS Most Wanted", 248, 168, 105, 17) $Checkbox[12] = GUICtrlCreateCheckbox("Lineage II - Interlude", 248, 192, 113, 17) $Checkbox[13] = GUICtrlCreateCheckbox("Lineage II - HellBound", 248, 216, 121, 17) $Checkbox[14] = GUICtrlCreateCheckbox("Lineage II - Gracia", 248, 240, 105, 17) $foot = GUICtrlCreateLabel("Mais uma facilidade LanHouse Casarão.", 118, 376, 378, 32) GUICtrlSetFont(-1, 15, 800, 0, "Segoe UI") GUICtrlSetColor(-1, 0x0000FF) $Logo = GUICtrlCreatePic("k:\prog\gui\dudu horizontal com fundo.jpg", 69, 0, 476, 68) $Button1 = GUICtrlCreateButton("Tudo", 504, 144, 75, 25) $Button2 = GUICtrlCreateButton("Instalar", 504, 280, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 Switch GUICtrlRead($Button1) Case "Tudo" For $i = 0 To UBound($checkbox) - 1 GUICtrlSetState($Checkbox[$i], $GUI_CHECKED) Next GUICtrlSetData($Button1, "Nada") Case "Nada" For $i = 0 To UBound($checkbox) - 1 GUICtrlSetState($Checkbox[$i], $GUI_UNCHECKED) Next GUICtrlSetData($Button1, "Tudo") EndSwitch Case $Button2 $fSelected = False If BitAND(GUICtrlRead($Checkbox[0]), $GUI_CHECKED) Then _inno("\BrMu\BrMu.exe") _WinWaitActivate("BrMu - Programa de instalação","Extraindo arquivos") WinSetOnTop("BrMu - Programa de instalação","Extraindo arquivos", 1) $fSelected = True EndIf If BitAND(GUICtrlRead($Checkbox[1]), $GUI_CHECKED) Then _inno("\muconection\muconection.exe") _WinWaitActivate("Mu Conection - Programa de instalação","") _WinWaitActivate("Mu Conection - Programa de instalação","Instalando") WinSetOnTop("Mu Conection - Programa de instalação","Instalando", 1) $fSelected = True EndIf If BitAND(GUICtrlRead($Checkbox[2]), $GUI_CHECKED) Then _inno("\muaway\muaway.exe") _WinWaitActivate("MuAway - Programa de instalação","") _WinWaitActivate("MuAway - Programa de instalação","Instalando") WinSetOnTop("MuAway - Programa de instalação","Instalando", 1) $fSelected = True EndIf If BitAND(GUICtrlRead($Checkbox[3]), $GUI_CHECKED) Then _inno("\muhellfire\muhellfire.exe") _WinWaitActivate("MuHeLLFire - Programa de instalação","") _WinWaitActivate("MuHeLLFire - Programa de instalação","Instalando") WinSetOnTop("MuHeLLFire - Programa de instalação","Instalando", 1) $fSelected = True EndIf If BitAND(GUICtrlRead($Checkbox[4]), $GUI_CHECKED) Then _inno("\gunbound\GunBoundWC.exe") _WinWaitActivate("GunBoundWC - Programa de instalação","") _WinWaitActivate("GunBoundWC - Programa de instalação","Instalando") WinSetOnTop("GunBoundWC - Programa de instalação","Instalando", 1) $fSelected = True EndIf If BitAND(GUICtrlRead($Checkbox[5]), $GUI_CHECKED) Then _inno("\cabal\CabalOnline.exe") _WinWaitActivate("Cabal Online - Programa de instalação","") _WinWaitActivate("Cabal Online - Programa de instalação","Instalando") WinSetOnTop("Cabal Online - Programa de instalação","Instalando", 1) $fSelected = True EndIf If BitAND(GUICtrlRead($Checkbox[6]), $GUI_CHECKED) Then _inno("\Flyff\Flyffv15.exe") _WinWaitActivate("Flyff - Programa de instalação","") _WinWaitActivate("Flyff - Programa de instalação","Instalando") WinSetOnTop("Flyff - Programa de instalação","Instalando", 1) $fSelected = True EndIf If BitAND(GUICtrlRead($Checkbox[7]), $GUI_CHECKED) Then RunWait(@ScriptDir & "\gta\setup.exe") _WinWaitActivate("GTA San Andreas - InstallShield Wizard","&Avançar") Send("!a") _WinWaitActivate("GTA San Andreas - InstallShield Wizard","Escolha o local de destino") Send("!a") _WinWaitActivate("GTA San Andreas - InstallShield Wizard","Pronto para instalar o programa") Send("!i") _WinWaitActivate("GTA San Andreas - InstallShield Wizard","Status da instalação") WinSetOnTop("GTA San Andreas - InstallShield Wizard","Status da instalação", 1) _WinWaitActivate("GTA San Andreas - InstallShield Wizard","InstallShield Wizard concluído") Send("{ENTER}") $fSelected = True EndIf If BitAND(GUICtrlRead($Checkbox[8]), $GUI_CHECKED) Then _inno("\counter-strike\cstrike.exe") _WinWaitActivate("Counter Strike - Programa de instalação","") _WinWaitActivate("Counter Strike - Programa de instalação","Instalando") WinSetOnTop("Counter Strike - Programa de instalação","Instalando", 1) $fSelected = True EndIf If BitAND(GUICtrlRead($Checkbox[9]), $GUI_CHECKED) Then _inno("\NFSMW\NFSMW.exe") _WinWaitActivate("NFS Most Wanted - Programa de instalação","") $fSelected = True EndIf If $fSelected = False Then MsgBox(0, "erro", "Nada selecionado!") ;### Tidy Error -> "endswitch" is closing previous "while" on line 41 EndSwitch WEnd Func _inno($App) RunWait(@ScriptDir & $App & " /silent") EndFunc Func _WinWaitActivate($title,$text,$timeout=0) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc Link to comment Share on other sites More sharing options...
chorao157 Posted July 4, 2010 Share Posted July 4, 2010 (edited) to closeCase $GUI_EVENT_CLOSE Exit$case checkbox1 ;seu codigo aki ( your code here) Edited July 4, 2010 by chorao157 Link to comment Share on other sites More sharing options...
wanderson Posted July 4, 2010 Author Share Posted July 4, 2010 to close Case $GUI_EVENT_CLOSE Exit $case checkbox1 ;seu codigo aki ( your code here) I did not understand, but my biggest problem is the checkbox that does not perform the tasks one after another. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 4, 2010 Moderators Share Posted July 4, 2010 wanderson,Try putting this line at the top of your script:Opt("TrayIconDebug", 1)Then when you put your mouse over the tray icon, the current line number is displayed. It might give you an idea of where the script is hanging - my bet would be in the _WinWaitActivate function. I cannot test your code much because I obviously do not get the required windows to open, but it looks OK and does recognise the various checkboxes - which is why I am going for the function. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 4, 2010 Moderators Share Posted July 4, 2010 wanderson,Please speak English. Just because I used Google Translate to warn off a stupid little boy in another thread does not mean I can speak Portuguese! And I am not going to use Google for every help request! To use ControlClick you need to be able to identify the control and the window in which it is situated. What does the Au3 Window Info tool ("C:\Program Files\AutoIt3\Au3Info.exe") tell you about it? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
wanderson Posted July 4, 2010 Author Share Posted July 4, 2010 Thanks M23. It was exactly the function _WinWaitActivate set a timeout and solved the problem of closing the program. This function I exited the AU3record. One of the programs I'm trying to automate the installation uses InstallShield and not use the function ControlClick () to wait so the window is active to send Send ("! A") "Next" and continue the installation. What is the correct way to use ControlClick () because when I used the button was not clicked. ControlClick("GTA San Andreas - InstallShield Wizard","&Avançar","Button1") Button name seen by Au3Info. Sorry. 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