rakesh2804 Posted June 5, 2018 Posted June 5, 2018 Hi, I am new to AutoIT and coding Short version: a. I want to create a GUI such that there is a drop down list where I can choose one among many categories. b. After selecting a category, I should get a Pop up windows showing many applications, where I can check (tick mark) the applications and make it automatically install them. Long version: I want to create a pop up window with drop down list containing names of multiple department in my organization. After selecting a particular department (for example IT), I need to get another pop up window showing the list of application , for example (Office, Antivirus) etc. where I can select whichever applications I want and then let the applications install automatically. It would also be better if I can get another pop up prior to installing the applications to choose the variants, for example (Office 64-bit and 32-bit). Please help
KickStarter15 Posted June 5, 2018 Posted June 5, 2018 (edited) 4 hours ago, rakesh2804 said: a. I want to create a GUI such that there is a drop down list where I can choose one among many categories. Have tried looking at Help file? try checking with GUICtrlCreateCombo() and see if that's what you want. 4 hours ago, rakesh2804 said: b. After selecting a category, I should get a Pop up windows showing many applications, where I can check (tick mark) the applications and make it automatically install them. Is there any coding you've made for this? post it and will see how we can help you with the GUI pop-up you want. Edit: Create you own version of coding and post it here so we can start checking and help you more. Help file is a friendly stuff, so check on it and compose your code. Edited June 5, 2018 by KickStarter15 rakesh2804 1 Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.
rakesh2804 Posted June 5, 2018 Author Posted June 5, 2018 42 minutes ago, KickStarter15 said: Have tried looking at Help file? try checking with GUICtrlCreateCombo() and see if that's what you want. Is there any coding you've made for this? post it and will see how we can help you with the GUI pop-up you want. Edit: Create you own version of coding and post it here so we can start checking and help you more. Help file is a friendly stuff, so check on it and compose your code. Hi Kickstarter15, Thank you. The Help file is rather user friendly but still it is still difficult for a noob like my myself to understand. I was wondering if I could get a basic example (set of consecutive codes) on how I can achieve my task, that way I can implement and also learn with the process. So far, I have googled and found that I can implement GUICtrlCreateCombo() to create a drop down list, but still I wanted to know stuff like - how I can insert text on top of the drop down box? *(Attachment for reference) - how to increase the size of that text? etc. here is the code: #include <GUIConstantsEx.au3> Global $hGUI, $ctrlCombo $hGui = GUICreate("Department", 300, 150) $ctrlCombo = GUICtrlCreateCombo("All", 10, 10) GUICtrlSetData(-1, "IT|Finance|Operation|HR|Procurement|Projects", "All") $ctrlButton = GUICtrlCreateButton("SET Finance", 100, 250, 100, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $ctrlButton ControlCommand($hGui, "", $ctrlCombo, "SelectString", "Finance") EndSwitch WEnd
Zedna Posted June 5, 2018 Posted June 5, 2018 (edited) #include <GUIConstantsEx.au3> #include <ComboConstants.au3> Global $hGUI, $ctrlCombo $hGui = GUICreate("Department", 300, 150) GUICtrlCreateLabel("Choose a Department", 10, 10, 200, 25) GUICtrlSetFont(-1, 12) $ctrlCombo = GUICtrlCreateCombo("All", 10, 35, 200, 25, BitOr($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, "IT|Finance|Operation|HR|Procurement|Projects", "All") GUICtrlSetFont(-1, 12) $ctrlButton = GUICtrlCreateButton("SET Finance", 100, 75, 100, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $ctrlButton ControlCommand($hGui, "", $ctrlCombo, "SelectString", "Finance") EndSwitch WEnd For choosing of list of applications for cathegory use Listview (with checkboxes). EDIT: You can use Koda Form Designer - it's visual GUI editor which will generate apropriate AU3 code fo you Edited June 5, 2018 by Zedna rakesh2804 1 Resources UDF ResourcesEx UDF AutoIt Forum Search
KickStarter15 Posted June 5, 2018 Posted June 5, 2018 @rakesh2804, Here's a starting code for you. #include <GUIConstantsEx.au3> Global $hGUI, $ctrlCombo $hGui = GUICreate("Department", 250, 120) $ctrlCombo = GUICtrlCreateCombo("All", 10, 35) GUICtrlSetData(-1, "IT|Finance|Operation|HR|Procurement|Projects", "All") $ctrlButton = GUICtrlCreateButton("SET Finance", 10, 60, 110, 30) $Label = GUICtrlCreateLabel("Choose a Department", 10, 10, 200) GUICtrlSetFont(-1, 12, 800, 4) ; 12 is the font size, 800 is a bold font, 4 is the underline, GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $ctrlButton $sComboRead = GUICtrlRead($ctrlCombo) MsgBox(0, "", "The combobox is currently displaying: " & $sComboRead, 0, $hGUI) ; You can start your searching of whatever you want to do... those pop-up things. ; Just $sComboRead as your value to get what you want. EndSwitch WEnd If you want to have a it working then detailed all your needs and we'll try to compose one. rakesh2804 1 Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.
Subz Posted June 5, 2018 Posted June 5, 2018 Here is another method, sorry codes a bit of a mess, just threw it together. expandcollapse popup#cs ## Save Installs.ini to the same folder as your script ## [Department] All = Section All Finance = Section Finance HR = Section HR IT = Section IT Operation = Section Operation Procurement = Section Procurement Projects = Section Projects [Section All] Adobe Reader = Key - Adobe Reader Adobe Flash = Key - Adobe Flash Java Runtime = Key - Java Runtime [Section Finance] Adobe Flash = Key - Adobe Flash Java Runtime = Key - Java Runtime [Section HR] Adobe Flash = Key - Adobe Flash Java Runtime = Key - Java Runtime [Section IT] Adobe Flash = Key - Adobe Flash Java Runtime = Key - Java Runtime [Section Operation] Adobe Flash = Key - Adobe Flash Java Runtime = Key - Java Runtime [Section Procurement] Adobe Flash = Key - Adobe Flash Java Runtime = Key - Java Runtime [Section Projects] Adobe Flash = Key - Adobe Flash Java Runtime = Key - Java Runtime [Commands] Key - Adobe Reader = Msiexec.exe /i "@ScriptDir@\Adobe.msi" /QN /NORESTART Key - Adobe Flash = Msiexec.exe /i "@ScriptDir@\Flash.msi" /QN /NORESTART Key - Java Runtime = "@ScriptDir@\JavaRuntime.exe" /s #ce #include <Array.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <GuiListView.au3> Opt("ExpandVarStrings", 1) Global $sIniFile = @ScriptDir & "\Installs.ini" Global $aDeparments = IniReadSection($sIniFile, "Departments") If @error Then Exit Global $_sDepartment = "" Global $hGUI, $idDeparment, $idSubtitle, $idListView $hGui = GUICreate("Department", 500, 190) $idSubtitle = GUICtrlCreateLabel("Department", 10, 10, 130) GUICtrlSetFont(-1, 16, 400) $idDeparment = GUICtrlCreateCombo("Select Department", 10, 40, 200, 20, $CBS_DROPDOWNLIST) GUICtrlSetData(-1, _ArrayToString($aDeparments, "|", 1, -1, "|", 0, 0), "Select Department") $idListView = GUICtrlCreateListView("Product Name|Install Command", 10, 65, 480, 100) GUISetState() AdlibRegister("_SetDepartment") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd Func _SetDepartment() Local $aProducts, $sProducts Local $sDepartment = GUICtrlRead($idDeparment) If $_sDepartment = $sDepartment Then Return Switch $sDepartment Case "Select Department" _GUICtrlListView_DeleteAllItems($idListView) GUICtrlSetData($idSubtitle, $sDepartment) Case Else _GUICtrlListView_DeleteAllItems($idListView) GUICtrlSetData($idSubtitle, $sDepartment) $aProducts = IniReadSection($sIniFile, "Section - " & $sDepartment) If @error Then Return For $i = 1 To $aProducts[0][0] $sProducts = IniRead($sIniFile, "Commands", $aProducts[$i][1], "") GUICtrlCreateListViewItem($aProducts[$i][0] & "|" & $sProducts, $idListView) _GUICtrlListView_SetColumnWidth($idListView, 1, $LVSCW_AUTOSIZE_USEHEADER) Next EndSwitch $_sDepartment = $sDepartment EndFunc rakesh2804 1
rakesh2804 Posted June 5, 2018 Author Posted June 5, 2018 WOW!! Finally, a community full of people who are dedicated in helping each other. Thanks a lot guys!. I will look into your suggestions and revert back. Thanks again.
rakesh2804 Posted June 7, 2018 Author Posted June 7, 2018 On 6/5/2018 at 2:58 PM, Zedna said: #include <GUIConstantsEx.au3> #include <ComboConstants.au3> Global $hGUI, $ctrlCombo $hGui = GUICreate("Department", 300, 150) GUICtrlCreateLabel("Choose a Department", 10, 10, 200, 25) GUICtrlSetFont(-1, 12) $ctrlCombo = GUICtrlCreateCombo("All", 10, 35, 200, 25, BitOr($GUI_SS_DEFAULT_COMBO, $CBS_DROPDOWNLIST)) GUICtrlSetData(-1, "IT|Finance|Operation|HR|Procurement|Projects", "All") GUICtrlSetFont(-1, 12) $ctrlButton = GUICtrlCreateButton("SET Finance", 100, 75, 100, 30) GUISetState() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $ctrlButton ControlCommand($hGui, "", $ctrlCombo, "SelectString", "Finance") EndSwitch WEnd For choosing of list of applications for cathegory use Listview (with checkboxes). EDIT: You can use Koda Form Designer - it's visual GUI editor which will generate apropriate AU3 code fo you Hi @KickStarter15, I installed Koda and found that it is more user friendly when compared to creating a GUI in Autoit. Thanks for the suggestion. I do have a few questions though.. I created a GUI form to choose the department. Code generated form Koda is below #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Department = GUICreate("Software Installer", 559, 251, 321, 353) GUISetBkColor(0xFFFFFF) $Label1 = GUICtrlCreateLabel("Choose a Department", 24, 8, 176, 27) GUICtrlSetFont(-1, 14, 800, 0, "Calibri") $Department = GUICtrlCreateList("", 24, 56, 193, 152, -1, 0) GUICtrlSetData(-1, "Admin|All (Contains All the Softwares)|Finance|Health and Safety|Human Resource|Information Technology|Operations|Procurement|Projects|Warehouse") GUICtrlSetFont(-1, 10, 800, 0, "Calibri") $Proceed = GUICtrlCreateButton("Proceed", 272, 184, 65, 25) GUICtrlSetFont(-1, 10, 800, 0, "Calibri") GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd So, we get to choose a particular department and click on "Proceed" button to goto the next form. I have created another sample form "Admin" with a check box to install Adobe acrobat. So, inthe "select department form" , after selecting "admin" and clicking the proceed button, it should get directed to "admin" form where I can select applications and install them. So, the question is how to assign action to the buttons? Thanks.
Subz Posted June 7, 2018 Posted June 7, 2018 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Proceed $sDepartment = GuiCtrlRead($Deparment) ;~ Actions here example: _Proceed($sDepartment) EndSwitch WEnd Func _Proceed($_sDepartment) Switch $_sDepartment Case "IT" Run("xyz") Case "Finance" Run("zyx") EndSwitch EndFunc
KickStarter15 Posted June 7, 2018 Posted June 7, 2018 (edited) @rakesh2804, Slight modification from @Subz suggestion. Not sure if this is what you want. expandcollapse popupWhile 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Proceed If GuiCtrlRead($Department) = "Admin" Then ;~ Actions here example: Proceed() Else $sDepartment = GuiCtrlRead($Department) MsgBox(0,"Selected Item",$sDepartment) EndIf EndSwitch WEnd Func Proceed() Local $hGUI2 = GUICreate("Admin Form", 200, 100, 400, 350) Local $InstallBtn = GUICtrlCreateButton("Install", 10, 10, 80, 30) Local $Adobe = GUICtrlCreateLabel("Adobe Acrobat", 30, 53, 80, 20) Local $Ntpd = GUICtrlCreateLabel("Noptepad++", 30, 70, 90, 17) GUISetState() Global $Number = 2, $iCols = 2, $iSpacing = 15 Global $DprtItms[$Number] For $i = 0 To $Number - 1 $DprtItms[$i] = GUICtrlCreateCheckbox("", $iSpacing + (Int($i / $iCols)), ((18.7 * Mod($i, $iCols)) + 50), 15, 20) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($hGUI2) ExitLoop Case $InstallBtn If GUICtrlRead($DprtItms[0]) = $GUI_CHECKED Then MsgBox(0,"Selection Made", "You've seleceted: 'Adobe Acrobat' for installation.") ; You can replace the message box with Run() function to install or open the item selected ElseIf GUICtrlRead($DprtItms[1]) = $GUI_CHECKED Then MsgBox(0,"Selection Made", "You've seleceted: 'Notepad++' for installation.") ; You can replace the message box with Run() function to install or open the item selected EndIf Case $DprtItms[0] GUICtrlSetState($DprtItms[1], $GUI_UNCHECKED) Case $DprtItms[1] GUICtrlSetState($DprtItms[0], $GUI_UNCHECKED) EndSwitch WEnd EndFunc Edited June 7, 2018 by KickStarter15 Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare.
rakesh2804 Posted September 6, 2018 Author Posted September 6, 2018 Hi, I require a script that does automatic installation of software after selecting the department and softwares in the GUI. I apologize for creating a similar thread earlier since i didn't mention the complete requirement by not being precise. Below are the steps on how the process should be Section 1: Choosing the Department Step 1: A GUI box should appear containing the multiple-choice option (Radio Button) containing all the departments. Step 2: After clicking next, it has to move to next section Section 2: Selecting the softwares to be installed. Note: Each Department have their own list of softwares, so the softwares list varies depending on the department that is selected. Step 1: The second GUI box should contain the list of softwares with checkboxes that are meant to be installed. Step 2: The Softwares could include different versions. So if the software is check marked, only the version that is selected should be installed. (Screenshot for reference below) Section 3: Installation Step: The Softwares should install automatically as per the list. (Which will done by me using AU3info) If anyone could help me with, and if it works as expected, i will be buying him a beer. Thanks
Developers Jos Posted September 6, 2018 Developers Posted September 6, 2018 (edited) 24 minutes ago, rakesh2804 said: I apologize for creating a similar thread earlier since i didn't mention the complete requirement by not being precise. So, why not simply adding it to it there? 24 minutes ago, rakesh2804 said: If anyone could help me with, and if it works as expected, i will be buying him a beer. Sounds like you want it coded for you, since the previous thread already gave a lot of input? ... and all of this for a beer ? EDIT: Merged with the original thread Edited September 6, 2018 by Jos 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.
rakesh2804 Posted September 12, 2018 Author Posted September 12, 2018 On 9/6/2018 at 5:24 PM, Jos said: So, why not simply adding it to it there? Sounds like you want it coded for you, since the previous thread already gave a lot of input? ... and all of this for a beer ? EDIT: Merged with the original thread Hi Jos, Like I said, I apologize for creating a new thread. The reason why I am creating a new one is because the old one wasnt precise enough. To all the guys here who helped me, I thank you. I apologize I couldnt reply since I was completely held up with work and studies. I executed the codes, but none of them met the requirement. Jos, beer is the last thing I can do just to show my token of appreciation.
FrancescoDiMuro Posted September 12, 2018 Posted September 12, 2018 @rakesh2804 What is not working as expected? Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
rakesh2804 Posted September 13, 2018 Author Posted September 13, 2018 19 hours ago, FrancescoDiMuro said: @rakesh2804 What is not working as expected? Hi FrancescoDiMuro, I used Koda to generate the GUI form as suggested by @kickstarter15. Code: Select Department #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Department = GUICreate("Department", 201, 301, 192, 124) GUISetBkColor(0xFFFFFF) $Select_Department = GUICtrlCreateLabel("Select Department", 16, 16, 136, 18) GUICtrlSetFont(-1, 12, 800, 0, "Calibri") GUICtrlSetColor(-1, 0x000000) $IT = GUICtrlCreateRadio("IT", 16, 48, 113, 17) GUICtrlSetFont(-1, 10, 800, 0, "Calibri") GUICtrlSetColor(-1, 0xFF0000) $HR = GUICtrlCreateRadio("HR", 16, 70, 112, 37) GUICtrlSetFont(-1, 10, 800, 0, "Calibri") GUICtrlSetColor(-1, 0xFF0000) $Dept_Next = GUICtrlCreateButton("Next", 96, 264, 75, 25) GUICtrlSetBkColor(-1, 0xA6CAF0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Code : Choose Software #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Software = GUICreate("Software", 301, 437, 192, 124) GUISetBkColor(0xFFFFFF) $Select_Software = GUICtrlCreateLabel("Select Software", 24, 16, 129, 27) GUICtrlSetFont(-1, 14, 800, 0, "Calibri") $Office = GUICtrlCreateCheckbox("Office", 24, 64, 97, 17) GUICtrlSetFont(-1, 12, 800, 0, "Calibri") $sixteen = GUICtrlCreateRadio("2016", 24, 88, 113, 17) GUICtrlSetFont(-1, 11, 800, 0, "Calibri") GUICtrlSetColor(-1, 0x000000) $Thirteen = GUICtrlCreateRadio("2013", 145, 88, 114, 17) GUICtrlSetFont(-1, 11, 800, 0, "Calibri") GUICtrlSetColor(-1, 0x000000) $Chrome = GUICtrlCreateCheckbox("Google Chrome", 21, 129, 130, 17) GUICtrlSetFont(-1, 12, 800, 0, "Calibri") $Install = GUICtrlCreateButton("Install", 216, 400, 75, 25) GUICtrlSetFont(-1, 11, 800, 0, "Calibri") GUICtrlSetBkColor(-1, 0xA6CAF0) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd I dont know how I can configure the next button in "Select Department" form so that it pops up the "Choose software". Also, I am not sure how to get the softwares installed after selecting the softwares in the "Choose Software" form. I know how to use the AU3info though. But i just want to know how I can take it further with these forms. Thanks.
FrancescoDiMuro Posted September 16, 2018 Posted September 16, 2018 @rakesh2804 I think that everyone here gave you nice examples to start with your project. If you don't want to/are not able to dig more in the Help file ( where you can find everything you need to do what you're trying to do ), then I think you have to pay someone to do this for you, as @Jos "said" Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette
rakesh2804 Posted September 16, 2018 Author Posted September 16, 2018 4 hours ago, FrancescoDiMuro said: @rakesh2804 I think that everyone here gave you nice examples to start with your project. If you don't want to/are not able to dig more in the Help file ( where you can find everything you need to do what you're trying to do ), then I think you have to pay someone to do this for you, as @Jos "said" Hi FrancescoDiMuro , Like I told to Jos, I would buy the guy a beer. Which means to say, "I will Pay". Thanks
Developers Jos Posted September 16, 2018 Developers Posted September 16, 2018 1 hour ago, rakesh2804 said: Hi FrancescoDiMuro , Like I told to Jos, I would buy the guy a beer. Which means to say, "I will Pay". Thanks Something sounds wrong in that statement or the "a" would need to change to "many 6 packs" FrancescoDiMuro 1 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.
rakesh2804 Posted September 16, 2018 Author Posted September 16, 2018 12 minutes ago, Jos said: Something sounds wrong in that statement or the "a" would need to change to "many 6 packs" Haha . I would like to. Thing is, its been only a year since I started working. I live alone and find it difficult to make the ends meet. I understand that getting a complete code done is a bit expensive..so, I am good. Thanks but not thanks. Anyway, would definitely like the idea of meeting you guys in person and having 6 pack of beer.
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