Flanders42 Posted August 28, 2013 Share Posted August 28, 2013 (edited) So I have two scripts that when ran independently work fine, however when I combine them in one script, the second one does not run. The scripts are being used to automate an application installation. One of the scripts is actually a modified example script from the help files, the other is one I found on the forum while searching for an issue I was having. The first script creates a small GUI asking for the type of installation, while the second one adds the "standard options" to that installation. Here's the first one: expandcollapse popup#include <GUIConstantsEx.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $mainwindow = GUICreate("Please select the type of installation", 325, 125) GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") GUICtrlCreateLabel("Available installations", 115, 10) $Button_1 = GUICtrlCreateButton("Option1", 105, 30, 120) $Button_2 = GUICtrlCreateButton("Option2", 105, 60, 120) GUICtrlSetOnEvent($Button_1, "Option1") GUICtrlSetOnEvent($Button_2, "Option2") GUISetState(@SW_SHOW) While 1 Sleep(1000) ; Idle around WEnd Func Option1() ;Note: at this point @GUI_CTRLID would equal $Button_1, ;and @GUI_WINHANDLE would equal $mainwindow WinActivate("Setup - XXXX XXX") ControlFocus("[TITLE:Setup - XXXX XXX; CLASS:TWizardForm]", "", "TNewComboBox1") Send("{Home}") Send("{Down}") WinClose("Please select the type of installation") EndFunc Func Option2() ;Note: at this point @GUI_CTRLID would equal $Button_1, ;and @GUI_WINHANDLE would equal $mainwindow WinActivate("Setup - XXXX XXX") ControlFocus("[TITLE:Setup - XXXX XXX; CLASS:TWizardForm]", "", "TNewComboBox1") Send("{Home}") Send("{Down 2}") WinClose("Please select the type of installation") EndFunc Func CLOSEClicked() ;Note: at this point @GUI_CTRLID would equal $GUI_EVENT_CLOSE, ;@GUI_WINHANDLE will be either $mainwindow or $dummywindow If @GUI_WINHANDLE = $mainwindow Then WinClose("Please select the type of installation") Exit EndIf EndFunc Then here's the second: #include <GuiListBox.au3> Dim $ttlWindow Dim $hdlWindow Dim $cidList Dim $hdlList $ttlWindow = "Setup - XXXX XXX" $cidList = "[CLASS:TNewCheckListBox; INSTANCE:1]" $hdlWindow = WinGetHandle($ttlWindow) $hdlList = ControlGetHandle($hdlWindow, "", $cidList) _GUICtrlListBox_ClickItem($hdlList, 0, "left") _GUICtrlListBox_ClickItem($hdlList, 1, "left") _GUICtrlListBox_ClickItem($hdlList, 2, "left") _GUICtrlListBox_ClickItem($hdlList, 3, "left") Send("{PGDN}") _GUICtrlListBox_ClickItem($hdlList, 8, "left") _GUICtrlListBox_ClickItem($hdlList, 9, "left") Send("{PGDN}") _GUICtrlListBox_ClickItem($hdlList, 13, "left") Send("{PGDN 2}") _GUICtrlListBox_ClickItem($hdlList, 22, "left") _GUICtrlListBox_ClickItem($hdlList, 23, "left") Here are some screen shots of the scripts doing what they do (independently). The first one is showing the GUI made by the first script. The second shows the checklist box that the second script fills out. Edited August 28, 2013 by Flanders42 Link to comment Share on other sites More sharing options...
BrewManNH Posted August 28, 2013 Share Posted August 28, 2013 Use ControlSend or ControlClick if you can get the information for the checkboxes you need. Or see if there's a way to do a silent install with the options you want. BTW, I find it humorous that you blacked out the name of the program in the screen shots but left it in your script. Flanders42 1 If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
Flanders42 Posted August 28, 2013 Author Share Posted August 28, 2013 I had tried using ControlSend and ControlClick initially, the problem was that AutoIt couldn't see the individual checkboxes in the list, I was pounding my head until I did a search here in the forums and found a couple of gents with the exact same issue. Also, thanks for pointing that out about the blackouts, so much for some company anonymity. Link to comment Share on other sites More sharing options...
MHz Posted August 28, 2013 Share Posted August 28, 2013 Looks like a Inno Setup installer. On the upper left of the window, click the icon and in the menu it may have an item "About Setup..." which you can click on and it may show Inno Setup version etc.Have a look here and browse to node "Other Information" and then view the page titled "Setup Command Line Parameters" to get available parameters to use.Perhaps the easiest way to get the settings needed is to save an inf file with recorded settings.Example code to run and save settings:ShellExecute('"' & @ScriptDir & '\setup.exe"', '/SAVEINF="' & @ScriptDir & '\setup_info.inf"')This will save the settings to file.You can load the inf file on the next installation or use the information in it to create command line parameters to pass to setup.exe.Example code to run and load settings:ShellExecute('"' & @ScriptDir & '\setup.exe"', '/SP- /VERYSILENT /NORESTART /LOADINF="' & @ScriptDir & '\setup_info.inf"') Then hopefully it will nice and silent. Link to comment Share on other sites More sharing options...
Flanders42 Posted August 28, 2013 Author Share Posted August 28, 2013 Fantastic, it is an Inno Setup installer. I'll be giving your suggestion a try this afternoon and post back some results once I get them. 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