Leaderboard
Popular Content
Showing content with the highest reputation on 04/14/2022 in all areas
-
ChooseFileFolder - Interim Version 11 Mar 21
SkysLastChance reacted to Melba23 for a topic
INTERIM VERSION 11 Mar 21 A bug in the x64 implementation of some the library TreeView functions meant that some replacement working functions were added to the UDF. Now the Beta TreeView library (from 15.3) has been modified, these functions are no longer required, but they will remain until the modified library is formally released. However, other changes in the Beta mean that the replacement functions will not work under it - don't you just love compatibility problems! So here is an interim release with a modified replacement function so that it will function with Release and Beta versions under both x32 and x64 - I hope! New UDF and examples in zip below. Previous version descriptions: ChangeLog.txt I was fed up with using the native FileOpenDialog and FileSelectFolder which appeared anywhere on the screen in seemingly random sizes and often allowed users to select files from other than the path desired. So I decided to write my own version of an Explorer-type treeview and here it is: ChooseFileFolder. What are the main advantages of this UDF over the normal dialogs? Common format for both file and folder selection. Ability to size and place the dialog where you want it rather than how Windows last left it. Ability to select (and delete) multiple items - even from different folders or drives. You can also select both files and folders from the same tree Ability to preselect items. And there is also a function to allow you to use an existing treeview in your own GUI to display the folder tree - no need to have a dialog at all. Here is a zip file with the UDF and several example scripts: ChooseFileFolder.zip As usual happy to take feedback and, preferably, plaudits. M231 point -
So if not allowed to install software why ask in autoit forum. You probably have to find solution with vba or powershell. https://www.codeproject.com/Tips/5307593/Automate-Chrome-Edge-using-VBA1 point
-
Sorry we are not here to provide code on demand but helping people when their code is not working as expected. Open help file under the functions I just listed, see the examples presented, put something together and then come back with the code you have trouble with. Good luck.1 point
-
Have you looked if the installation could be performed silently ? Otherwise : Use UIASpy.au3 to see if it can access the different controls1 point
-
Also please be a little patient and do not bump your post within 24 hours unless you have payed for your 1 hour SLA service contract.1 point
-
I would like to recomend you to use * ADO.au3 UDF * btw 2️⃣4️⃣um1 point
-
Software Installer
bundyal reacted to abberration for a topic
Hi, all. I just posted a new version 2.0 on the very first post. Go there to see it. Thoughts on the new version? I'd love to hear them!1 point -
Software Installer
asiajason reacted to abberration for a topic
I fixed the bug in version 1.2a, or at least it is working on my VM. Hopefully, I will get some time to implement some new features and I would really like a better way of configuring the software and I want to make the installer detection to be automatic instead of having to click the button every time. This isn't a major update, but it's the most up-to-date so far. #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=gnome_app_install.ico #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> #include <File.au3> #include <FileConstants.au3> #include <GDIPlus.au3> #include <GUIConstants.au3> #include <GuiTab.au3> #include <GuiListView.au3> #include <GuiMenu.au3> #include <ProgressConstants.au3> #include <String.au3> Global $fIniConfig = @ScriptDir & "\Config.ini" Global $sSWDir = @ScriptDir & "\Software\" Global $sVersion = "1.2a" Global $sAllSwitches = "-s|/silent|/verysilent|/sp- /silent /norestart|/verysilent /norestart|/S|/S /NCRC|/passive|/passive /norestart|/u|/u /z|/q|/q /r:n|/q:a|/qb|/qn|/q:a /r:n|/S|/s" Global $sAllInstallers = "Ghost Installer|Inno Setup|InstallShield|Microsoft Hotfix Package|MSI Package|Nullsoft|Wise Installer" Global $cDummy, $sSWDblClk ; Main GUI $Form1 = GUICreate("Software Installer", 633, 451) $cDummy = GUICtrlCreateDummy() $Tab1 = GUICtrlCreateTab(16, 8, 601, 377) $TabSheet1 = GUICtrlCreateTabItem("Audio/Video/Photo") $ListView1 = GUICtrlCreateListView("Software Name|Description", 24, 40, 582, 334) _GUICtrlListView_SetExtendedListViewStyle($ListView1, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES)) GUICtrlSendMsg(-1, 0x101E, 0, 200) GUICtrlSendMsg(-1, 0x101E, 1, 375) $TabSheet2 = GUICtrlCreateTabItem("System Tools") $ListView2 = GUICtrlCreateListView("Software Name|Description", 24, 40, 578, 334) _GUICtrlListView_SetExtendedListViewStyle($ListView2, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES)) GUICtrlSendMsg(-1, 0x101E, 0, 200) GUICtrlSendMsg(-1, 0x101E, 1, 375) $TabSheet3 = GUICtrlCreateTabItem("Internet") $ListView3 = GUICtrlCreateListView("Software Name|Description", 24, 40, 578, 334) _GUICtrlListView_SetExtendedListViewStyle($ListView3, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES)) GUICtrlSendMsg(-1, 0x101E, 0, 200) GUICtrlSendMsg(-1, 0x101E, 1, 375) $TabSheet4 = GUICtrlCreateTabItem("Games") $ListView4 = GUICtrlCreateListView("Software Name|Description", 24, 40, 578, 334) _GUICtrlListView_SetExtendedListViewStyle($ListView4, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES)) GUICtrlSendMsg(-1, 0x101E, 0, 200) GUICtrlSendMsg(-1, 0x101E, 1, 375) $TabSheet5 = GUICtrlCreateTabItem("Miscellaneous") $ListView5 = GUICtrlCreateListView("Software Name|Description", 24, 40, 578, 334) _GUICtrlListView_SetExtendedListViewStyle($ListView5, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES)) GUICtrlSendMsg(-1, 0x101E, 0, 200) GUICtrlSendMsg(-1, 0x101E, 1, 375) $TabSheet6 = GUICtrlCreateTabItem("Patches/Updates") $ListView6 = GUICtrlCreateListView("Software Name|Description", 24, 40, 578, 334) _GUICtrlListView_SetExtendedListViewStyle($ListView6, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES)) GUICtrlSendMsg(-1, 0x101E, 0, 200) GUICtrlSendMsg(-1, 0x101E, 1, 375) $TabSheet7 = GUICtrlCreateTabItem("Productivity") $ListView7 = GUICtrlCreateListView("Software Name|Description", 24, 40, 578, 334) _GUICtrlListView_SetExtendedListViewStyle($ListView7, BitOR($LVS_EX_FULLROWSELECT, $LVS_EX_CHECKBOXES, $LVS_EX_GRIDLINES)) GUICtrlSendMsg(-1, 0x101E, 0, 200) GUICtrlSendMsg(-1, 0x101E, 1, 375) GUICtrlCreateTabItem("") ; This ends the tab item creation $g1Checkbox1 = GUICtrlCreateCheckbox("Prompt to edit software installation order", 16, 400, 220, 17) ;~ GUICtrlSetState(-1, $GUI_CHECKED) ; Enable this if you want. $g1Button1 = GUICtrlCreateButton("Install Selected Software", 398, 395, 219, 25, 0) $MenuItem1 = GUICtrlCreateMenu("File") $MenuItem1a = GUICtrlCreateMenuItem("Select All", $MenuItem1) $MenuItem2 = GUICtrlCreateMenuItem("Unselect All", $MenuItem1) $MenuItem3 = GUICtrlCreateMenuItem("Exit", $MenuItem1) $MenuItem4 = GUICtrlCreateMenu("Settings") $MenuItem5 = GUICtrlCreateMenuItem("Edit Software Configuration", $MenuItem4) $MenuItem6 = GUICtrlCreateMenu("Help") $MenuItem7 = GUICtrlCreateMenuItem("Help Topics", $MenuItem6) $MenuItem8 = GUICtrlCreateMenuItem("About", $MenuItem6) GUIRegisterMsg($WM_NOTIFY, "_WM_NOTIFY") GUISetState(@SW_SHOW) $aSoftwareList = _FileListToArrayRec(@ScriptDir & "\Software", "*.exe;*.msi;*.msu", 1, 1) ; List all software in Software folder. If NOT IsArray ($aSoftwareList) Then ; Easy fix for program crashing if no software is in the Software folder. If NOT FileExists(@ScriptDir & "\Software") Then DirCreate (@ScriptDir & "\Software") EndIf MsgBox(262144, "Error", "No software installers found in the Software folder." & @CRLF & "This program cannot function without any software installers." & @CRLF & "Add some to the folder and restart the program.") Exit EndIf For $i = 1 To 5 ; Add columns for other data. _ArrayColInsert($aSoftwareList, 1) Next Global $aUnconfiguredSW[$aSoftwareList[0][0]+1][5] $aUnconfiguredSW[0][0] = 0 _CheckForNewSoftware($aSoftwareList) If $aUnconfiguredSW[0][0] > 0 Then ; Get a list of all software that has not been configured. $iQueryUser = _QueryUser() If $iQueryUser = 1 Then _SWConfiguration() EndIf EndIf _Populate() ; Loads the software in the Software folder into the various lists. While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE ; Button: Exit Exit Case $cDummy _SWConfiguration() Case $g1Button1 ; Button: Install Selected Software _InstallSelectedSoftware() Case $MenuItem1a ; Menu: File > Select All _SelectAll(True) Case $MenuItem2 ; Menu: File > Unselect All _SelectAll(False) Case $MenuItem3 ; Menu: Exit Exit Case $MenuItem5 ; Menu: Edit Software Configuration _SWConfiguration() Case $MenuItem7 ; Menu: Help _HelpTopics() Case $MenuItem8 ; Menu: About _About() EndSwitch WEnd Func _Populate() ; Find all files in the Software folder and populate the tabs with the installers. For $i = 1 To 7 ; Fill out the master array with data _GUICtrlListView_DeleteAllItems(Eval("ListView" & $i)) Next For $i = 1 To $aSoftwareList[0][0] $sDisplayName = IniRead($fIniConfig, $aSoftwareList[$i][0], "DisplayName", $aSoftwareList[$i][0]) If $sDisplayName = "" Then $sDisplayName = $aSoftwareList[$i][0] EndIf $sCategory = IniRead($fIniConfig, $aSoftwareList[$i][0], "Category", "") If $sCategory = "" Then $sCategory = 5 EndIf $sDescription = IniRead($fIniConfig, $aSoftwareList[$i][0], "Description", "") $checked = IniRead($fIniConfig,$aSoftwareList[$i][0],"IsDefault", "") $aSoftwareList[$i][1] = $sDisplayName $aSoftwareList[$i][2] = $sCategory $aSoftwareList[$i][3] = $sDescription $aSoftwareList[$i][4] = $checked Next For $i = 1 To $aSoftwareList[0][0] ; Populate the tabs with items $iCategory = IniRead($fIniConfig, $aSoftwareList[$i][0], "Category", 5) $sDoNotShow = IniRead($fIniConfig, $aSoftwareList[$i][0], "DoNotShow", 0) If $sDoNotShow <> 1 Then GUICtrlCreateListViewItem($aSoftwareList[$i][1] & "|" & $aSoftwareList[$i][3], (Eval("ListView" & $iCategory))) If $aSoftwareList[$i][4] = 1 Then $iI = _GUICtrlListView_FindText((Eval("ListView" & $iCategory)), $aSoftwareList[$i][1]) _GUICtrlListView_SetItemChecked((Eval("ListView" & $iCategory)), $iI, True) ;Set checked radiobox of last found control EndIf EndIf Next EndFunc ;==>_Populate Func _InstallSelectedSoftware() GUISetState(@SW_DISABLE, $Form1) Local $sExit = "" $Form4 = GUICreate("Installing Software", 600, 172) $g4Label1 = GUICtrlCreateLabel("Installing:", 16, 16, 148, 17) $g4Label2 = GUICtrlCreateLabel("", 16, 40, 570, 19) GUICtrlSetFont(-1, 10, 400, 0, "Arial Rounded MT Bold") GUICtrlSetColor(-1, 0x008080) $g4Label3 = GUICtrlCreateLabel("File Size:", 16, 64, 146, 17) $g4Label4 = GUICtrlCreateLabel("Total Progress:", 16, 112, 75, 17) $g4Progress1 = GUICtrlCreateProgress(16, 136, 570, 17) Local $aInstallList[$aSoftwareList[0][0] + 1][4] $iInstallListSize = 0 For $i = 1 To 7 ; Go through the 7 tabs on main GUI $iItemCount = _GUICtrlListView_GetItemCount(Eval("ListView" & $i)) For $j = 1 To $iItemCount $vItemChecked = _GUICtrlListView_GetItemChecked(Eval("ListView" & $i), $j - 1) If $vItemChecked = TRUE Then $iInstallListSize += 1 $aInstallList[0][0] = $iInstallListSize $sItemName = _GUICtrlListView_GetItemText(Eval("ListView" & $i), $j - 1) ; Problem is here - well maybe... Searches for text on screen. Need to search for installer name. $iArrayPos = _ArraySearch($aSoftwareList, $sItemName, Default, Default, Default, Default, Default, 1) $sSWInstaller = $aSoftwareList[$iArrayPos][0] $sSwitch = IniRead($fIniConfig, $sSWInstaller, "Switch", "") $aInstallList[$iInstallListSize][0] = $sSWDir & $sSWInstaller $aInstallList[$iInstallListSize][1] = $sSwitch $aInstallList[$iInstallListSize][2] = $sItemName $aInstallList[$iInstallListSize][3] = $sSWInstaller EndIf Next Next ReDim $aInstallList[$aInstallList[0][0] + 1][4] $iInstallOrder = GUICtrlRead($g1Checkbox1) If $iInstallOrder = 1 Then ; If the user wants to alter installation order, this pulls up the Gui. $aInstallList = _InstallOrder($aInstallList) EndIf GUISetState(@SW_SHOW, $Form4) ; The Installing Software screen has been hidden until now. For $i = 1 To $aInstallList[0][0] ; Set info into Gui and install the software. GUICtrlSetData($g4Label1, "Installing: " & $i & " of " & $aInstallList[0][0]) GUICtrlSetData($g4Label2, $aInstallList[$i][2]) ; Name of software $sSWName = $aInstallList[$i][3] ; This was the problem - fed the easy to read name to the installer instead of the actual installer name. ; Make a list of pre-install software, selected software and post-install software ; File locations $sSWLoc1 = IniRead($fIniConfig, $sSWName, "SWLoc1", "") $sSWLoc2 = IniRead($fIniConfig, $sSWName, "SWLoc2", "") $sSWLoc3 = $aInstallList[$i][0] ; The selected software from the main screen $sSWLoc4 = IniRead($fIniConfig, $sSWName, "SWLoc3", "") ; Because I'm inserting the main software at position 3, I am offsetting the $SWLoc number +1 - $sSWLoc4 is for ini reading of "SWLoc3". Same goes for other entries after 2/3. $sSWLoc5 = IniRead($fIniConfig, $sSWName, "SWLoc4", "") ; File switches $sSWSw1 = IniRead($fIniConfig, $sSWName, "SwSw1", "") $sSWSw2 = IniRead($fIniConfig, $sSWName, "SwSw2", "") $sSwsw3 = $aInstallList[$i][1] ; Switch for the selected software from the main screen $sSWSw4 = IniRead($fIniConfig, $sSWName, "SwSw3", "") $sSWSw5 = IniRead($fIniConfig, $sSWName, "SwSw4", "") ; File descriptions $sSWDs1 = "Pre-Installing Software #1" $aSWDs1 = StringSplit($sSWLoc1, "\") If IsArray($aSWDs1) Then $sSWDs1 = "Pre-Installing Software #1 [ " & $aSWDs1[$aSWDs1[0]] & " ]" EndIf $sSWDs2 = "Pre-Installing Software #2" $aSWDs2 = StringSplit($sSWLoc2, "\") If IsArray($aSWDs2) Then $sSWDs2 = "Pre-Installing Software #2 [ " & $aSWDs2[$aSWDs2[0]] & " ]" EndIf $sSWDs3 = $aInstallList[$i][2] ; Description of the selected software from the main screen $aSWDs3= StringSplit($sSWDs3, "\") If IsArray($aSWDs3) Then $sSWDs3 = $aSWDs3[$aSWDs3[0]] EndIf $sSWDs4 = "Post-Installing Software #1" $aSWDs4 = StringSplit($sSWLoc4, "\") If IsArray($aSWDs4) Then $sSWDs4 = "Post-Installing Software #1 [ " & $aSWDs4[$aSWDs4[0]] & "] " EndIf $sSWDs5 = "Post-Installing Software #2" $aSWDs5 = StringSplit($sSWLoc5, "\") If IsArray($aSWDs5) Then $sSWDs5 = "Post-Installing Software #2 [ " & $aSWDs5[$aSWDs5[0]] & " ]" EndIf ; Make a blank array to put in pre-install software, the selected software and post-install software to be installed Local $aSWQueue[5][3] $sArraySize = 0 For $j = 1 To 5 If Eval ("sSWLoc" & $j) <> "" Then $aSWQueue[$sArraySize][0] = Eval ("sSWLoc" & $j) ; Software location $aSWQueue[$sArraySize][1] = Eval ("sSWSw" & $j) ; Software switch $aSWQueue[$sArraySize][2] = Eval ("sSWDs" & $j) ; Software description / filename $sArraySize += 1 EndIf Next ; Install the pre-install software, selected software and post-install software. For $j = 0 To $sArraySize - 1 ; Zero-based to accomodate the arrays. GUICtrlSetData($g4Label2, $aSWQueue[$j][2]) ; Set name / description of software on progress window GUICtrlSetData($g4Label3, "File Size: " & Round(FileGetSize($aSWQueue[$j][0])/1024000, 1) & " MB") $sInstallString = '"' & $aSWQueue[$j][0] & '" ' & $aSWQueue[$j][1] If StringRight($aSWQueue[$j][0], 4) = ".msi" Then Run("msiexec /i " & $sInstallString) ElseIf StringRight($aSWQueue[$j][0], 4) = ".msu" Then ShellExecuteWait($aSWQueue[$j][0], $aSWQueue[$j][1]) Else If StringInStr($aSWQueue[$j][0], "7z") Then ; Special exception for installing 7-Zip RegDelete("HKEY_CURRENT_USER\Software\7-Zip", "Path") RegDelete("HKEY_CURRENT_USER\Software\7-Zip", "Path32") RegDelete("HKEY_CURRENT_USER\Software\7-Zip", "Path64") $sInstallSwitch = '/S /D="' & @HomeDrive & '\Program Files\7-Zip"' RunWait('"' & $aSWQueue[$j][0] & '" ' & $sInstallSwitch) Else ; Normally install software with the specified switch. RunWait('"' & $aSWQueue[$j][0] & '" ' & $aSWQueue[$j][1]) EndIf EndIf Next GUICtrlSetData($g4Progress1, $i/$aInstallList[0][0]*100) Next GUISetState(@SW_ENABLE, $Form1) GUIDelete($Form4) _SelectAll(False) EndFunc Func _SelectAll($TF) ; Sending TRUE or FALSE to select all or unselect all. For $i = 1 To 7 $iItemCount = _GUICtrlListView_GetItemCount(Eval("ListView" & $i)) For $j = 1 To $iItemCount _GUICtrlListView_SetItemChecked(Eval("ListView" & $i), $j - 1, $TF) Next Next EndFunc ;==>_SelectAll Func _CheckForNewSoftware($aSoftwareList) Local $aConfigFileSW = IniReadSectionNames($fIniConfig) $iArrayPos = 1 For $i = 1 To $aSoftwareList[0][0] If _ArraySearch($aConfigFileSW, $aSoftwareList[$i][0]) < 1 Then $aUnconfiguredSW[$iArrayPos][0] = $aSoftwareList[$i][0] $aUnconfiguredSW[0][0] = $iArrayPos $iArrayPos += 1 EndIf Next EndFunc Func _SWConfiguration() GUISetState(@SW_DISABLE, $Form1) $Form2 = GUICreate("Configure Software", 620, 520) Global $g2List = GUICtrlCreateList("", 8, 24, 602, 218) $g2Checkbox1 = GUICtrlCreateCheckbox("Show All Software", 8, 240, 121, 17) $g2Label1 = GUICtrlCreateLabel("Display Name For Software:", 8, 264, 250, 17) $g2Input1 = GUICtrlCreateInput("", 8, 280, 250, 21) GUICtrlSetState(-1, $GUI_DISABLE) $g2Label2 = GUICtrlCreateLabel("Installer Type (optional):", 8, 320, 116, 17) $g2Combo1 = GUICtrlCreateCombo("", 8, 336, 170, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetState(-1, $GUI_DISABLE) $g2Button4 = GUICtrlCreateButton("Detect", 185, 335, 75, 23) GUICtrlSetState(-1, $GUI_DISABLE) $g2Label3 = GUICtrlCreateLabel("Silent Switch To Be Used:", 8, 376, 128, 17) $g2Combo2 = GUICtrlCreateCombo("", 8, 392, 250, 25) GUICtrlSetState(-1, $GUI_DISABLE) $g2Label4 = GUICtrlCreateLabel("Software Description (optional):", 300, 264, 250, 17) $g2Input2 = GUICtrlCreateInput("", 300, 280, 250, 21) GUICtrlSetState(-1, $GUI_DISABLE) $g2Label5 = GUICtrlCreateLabel("Category:", 300, 320, 128, 17) $g2Combo3 = GUICtrlCreateCombo("", 300, 336, 250, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL)) GUICtrlSetState(-1, $GUI_DISABLE) $g2Label6 = GUICtrlCreateLabel("Double-Click Each Software To Configure. When Finished, Click The Save Button", 8, 6, 391, 17) $g2Label7 = GUICtrlCreateLabel("Editing: ", 8, 240, 602, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008000) GUICtrlSetBkColor(-1, 0xC0DCC0) GUICtrlSetState(-1, $GUI_HIDE) $g2Checkbox2 = GUICtrlCreateCheckbox("This Software Defaults To Selected On Main GUI", 8, 460, 280, 17) GUICtrlSetState(-1, $GUI_DISABLE) $g2Checkbox3 = GUICtrlCreateCheckbox("Hide This Item On Main GUI", 8, 490, 280, 17) GUICtrlSetState(-1, $GUI_DISABLE) $g2Checkbox4 = GUICtrlCreateCheckbox("Run Pre-Install/Post-Install Software", 300, 392) GUICtrlSetTip(-1, "(Optional) This option allows you to run software before your installer or software/registy entries afterwards.") GUICtrlSetState(-1, $GUI_DISABLE) $g2Button3 = GUICtrlCreateButton("Configure", 500, 392, 80, 25) GUICtrlSetState(-1, $GUI_HIDE) $g2Button1 = GUICtrlCreateButton("Edit A Different Software", 300, 460, 160, 27, $WS_GROUP) GUICtrlSetState(-1, $GUI_DISABLE) $g2Button2 = GUICtrlCreateButton("Save Data", 480, 460, 100, 27, $WS_GROUP) GUICtrlSetState(-1, $GUI_DISABLE) GUISetState(@SW_SHOW) _ClearAndSetInputs($g2List, $g2Button3, $g2Combo1, $g2Combo2, $g2Combo3, $g2Input1, $g2Input2, $g2Label7, $g2Checkbox1, $g2Checkbox2, $g2Checkbox3, $g2Checkbox4, $aUnconfiguredSW) Global $idDummy = GUICtrlCreateDummy() GUIRegisterMsg($WM_COMMAND, "WM_COMMAND") If $sSWDblClk <> "" Then GUICtrlSendToDummy($idDummy) EndIf While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE $sEditMode = GUICtrlGetState($g2Button2) ; If the save button is active, then assume user has not saved data. Prompt if they still want to exit. If $sEditMode = 80 Then $sExit = MsgBox(262148, "Attention", "You have unsaved data. Do you want to close this window without saving?") If $sExit = 6 Then ; If they want to exit without saving, do it. GUISetState(@SW_ENABLE, $Form1) GUIDelete($Form2) _Populate() ExitLoop EndIf Else ; If the save button is not active, there is nothing to save, so exit. GUISetState(@SW_ENABLE, $Form1) GUIDelete($Form2) _Populate() ExitLoop EndIf Case $idDummy ; Something on the list has been double-clicked or double-clicked on the main gui. Change to edit mode for the selected software. _ClearAndSetInputs($g2List, $g2Button3, $g2Combo1, $g2Combo2, $g2Combo3, $g2Input1, $g2Input2, $g2Label7, $g2Checkbox1, $g2Checkbox2, $g2Checkbox3, $g2Checkbox4, $aUnconfiguredSW) Local $sSWEditing If $sSWDblClk <> "" Then $sSWEditing = $sSWDblClk Else $sSWEditing = GUICtrlRead($idDummy) EndIf GUICtrlSetData($g2Label7, "Editing: " & $sSWEditing) $sDesc = IniRead($fIniConfig, $sSWEditing, "Description", "") $sFullSwitches = "-s|/silent|/verysilent|/sp- /silent /norestart|/verysilent /norestart|/S|/S /NCRC|/passive|/passive /norestart|/u|/u /z|/q|/q /r:n|/q:a|/qb|/qn|/q:a /r:n|/S|/s" $sSwitch = IniRead($fIniConfig, $sSWEditing, "Switch", $sFullSwitches) Local $aCategories[8] = ["7","Audio/Video/Photo", "System Tools", "Internet", "Games", "Miscellaneous", "Patches/Updates", "Productivity"] $iCategory = IniRead($fIniConfig, $sSWEditing, "Category", "5") $sCategory = $aCategories[$iCategory] $sDisplayName = IniRead($fIniConfig, $sSWEditing, "DisplayName", "") $sIsDefault = IniRead($fIniConfig, $sSWEditing, "IsDefault", "") If $sIsDefault = 1 Then GUICtrlSetState($g2Checkbox2, $GUI_CHECKED) EndIf $sDoNotShow = IniRead($fIniConfig, $sSWEditing, "DoNotShow", 0) If $sDoNotShow = 1 Then GUICtrlSetState($g2Checkbox3, $GUI_CHECKED) EndIf GUICtrlSetData($g2Input1, $sDisplayName) GUICtrlSetData($g2Combo2, $sSwitch, $sSwitch) GUICtrlSetData($g2Input2, $sDesc) GUICtrlSetData($g2Combo3, $sCategory) GUICtrlSetData($g2List, "") GUICtrlSetData($g2List, $sSWEditing) $sRunPostInstall = IniRead($fIniConfig, $sSWEditing, "CBPrePost", "Unchecked") If $sRunPostInstall = "Checked" Then GUICtrlSetState($g2Checkbox4, $GUI_CHECKED) GUICtrlSetState($g2Button3, $GUI_SHOW) EndIf $sSWDblClk = "" ; Resets the name of the software to prevent glitchs. _EnableDisableControls($g2Input1, $g2Combo1, $g2Combo2, $g2Combo3, $g2Input2, $g2Button1, $g2Button2, $g2Button3, $g2Button4, $g2Checkbox1, $g2Checkbox2, $g2Checkbox3, $g2Checkbox4, $g2Label7, $g2List, 1) ; enable Case $g2Button1 ; Discard any unsaved data that has been entered and switch back to software selection mode. GUICtrlSetData($g2Button4, "Detect") _ClearAndSetInputs($g2List, $g2Button3, $g2Combo1, $g2Combo2, $g2Combo3, $g2Input1, $g2Input2, $g2Label7, $g2Checkbox1, $g2Checkbox2, $g2Checkbox3, $g2Checkbox4, $aUnconfiguredSW) _EnableDisableControls($g2Input1, $g2Combo1, $g2Combo2, $g2Combo3, $g2Input2, $g2Button1, $g2Button2, $g2Button3, $g2Button4, $g2Checkbox1, $g2Checkbox2, $g2Checkbox3, $g2Checkbox4, $g2Label7, $g2List, 0) Case $g2Combo1 _SetSwitchData($g2Combo1, $g2Combo2, $g2Combo3) Case $g2Checkbox1 ; Toggles between unconfigured software to all software (configured & unconfigured). $iCBRead = GUICtrlRead($g2Checkbox1) If $iCBRead = 1 Then _ClearAndSetInputs($g2List, $g2Button3, $g2Combo1, $g2Combo2, $g2Combo3, $g2Input1, $g2Input2, $g2Label7, $g2Checkbox1, $g2Checkbox2, $g2Checkbox3, $g2Checkbox4, $aUnconfiguredSW) Else _ClearAndSetInputs($g2List, $g2Button3, $g2Combo1, $g2Combo2, $g2Combo3, $g2Input1, $g2Input2, $g2Label7, $g2Checkbox1, $g2Checkbox2, $g2Checkbox3, $g2Checkbox4, $aUnconfiguredSW) EndIf Case $g2Button2 ; Save data and switch back to software selection mode. GUICtrlSetData($g2Button4, "Detect") $sCurrentSW = StringTrimLeft(GUICtrlRead($g2Label7), 9) ; Trim off the left wing "Editing: " to get the current software name. $sDesc = IniWrite($fIniConfig, $sCurrentSW, "Description", GUICtrlRead($g2Input2)) $sSwitch = IniWrite($fIniConfig, $sCurrentSW, "Switch", GUICtrlRead($g2Combo2)) ; Having a problem with this line when saving switch data when in "all software" mode, or at least i think this is a problem. Local $aCategories[8] = ["7","Audio/Video/Photo", "System Tools", "Internet", "Games", "Miscellaneous", "Patches/Updates", "Productivity"] $sCategory = GUICtrlRead($g2Combo3) $iArrayPos = _ArraySearch($aCategories, $sCategory) IniWrite($fIniConfig, $sCurrentSW, "Category", $iArrayPos) $sDisplayName = IniWrite($fIniConfig, $sCurrentSW, "DisplayName", GUICtrlRead($g2Input1)) $sRunPostInstall = IniWrite($fIniConfig, $sCurrentSW, "PostInstall", GUICtrlRead($g2Combo3)) $sIsDefault = IniWrite($fIniConfig, $sCurrentSW, "IsDefault", GUICtrlRead($g2Checkbox2)) $iArrayPos = _ArraySearch($aUnconfiguredSW, $sCurrentSW) If $iArrayPos > 0 Then _ArrayDelete($aUnconfiguredSW, $iArrayPos) $aUnconfiguredSW[0][0] -= 1 EndIf $sDoNotShow = GUICtrlRead($g2Checkbox3) IniWrite($fIniConfig, $sCurrentSW, "DoNotShow", $sDoNotShow) $sCBRead = GUICtrlRead($g2Checkbox4) If $sCBRead = 1 Then IniWrite($fIniConfig, $sCurrentSW, "CBPrePost", "Checked") Else IniWrite($fIniConfig, $sCurrentSW, "CBPrePost", "Unchecked") EndIf GUICtrlSetData($g2Label7, "") _ClearAndSetInputs($g2List, $g2Button3, $g2Combo1, $g2Combo2, $g2Combo3, $g2Input1, $g2Input2, $g2Label7, $g2Checkbox1, $g2Checkbox2, $g2Checkbox3, $g2Checkbox4, $aUnconfiguredSW) _EnableDisableControls($g2Input1, $g2Combo1, $g2Combo2, $g2Combo3, $g2Input2, $g2Button1, $g2Button2, $g2Button3, $g2Button4, $g2Checkbox1, $g2Checkbox2, $g2Checkbox3, $g2Checkbox4, $g2Label7, $g2List, 0) Case $g2Checkbox4 $sCBRead = GUICtrlRead($g2Checkbox4) If $sCBRead = 1 Then GUICtrlSetState($g2Button3, $GUI_SHOW) Else GUICtrlSetState($g2Button3, $GUI_HIDE) EndIf Case $g2Button3 _PrePostInstallSoftware ($sSWEditing, $Form2) Case $g2Button4 ; Detect the installer type _GetInstallerType($sSWEditing, $g2Combo1, $g2Combo2, $g2Combo3, $g2Button4) EndSwitch WEnd EndFunc Func _GetInstallerType($sSWName, $Combo1, $Combo2, $Combo3, $Button) If StringRight($sSWName, 4) = ".msi" Then GUICtrlSetData($Combo1, "MSI Package") _SetSwitchData($Combo1, $Combo2, $Combo3) ElseIf StringRight($sSWName, 4) = ".msu" Then GUICtrlSetData($Combo1, "Microsoft Hotfix Package") _SetSwitchData($Combo1, $Combo2, $Combo3) Else $sFileName = @ScriptDir & "\Software\" & $sSWName $hFileOpen = FileOpen($sFileName) Local $sFileRead = FileRead($hFileOpen, 8000000) ; Only read the first 1 MB of the file for speed and prevent crashing. If installer type is in plain text, it will probably be in this section of the file. $sSearchStrings = "(496E6E6F205365747570|4E756C6C736F6674)" ;Inno Setup|Nullsoft $aMatch = StringRegExp($sFileRead, $sSearchStrings, 1) $sFileRead = "" FileClose($hFileOpen) $sTestMode = 0 $sSwitchFound = 0 If IsArray($aMatch) Then ; If a match is found, decode the hex to ascii and set that to the combo. $sDecoded = _HexToString($aMatch[0]) GUICtrlSetData($Combo1, $sDecoded) _SetSwitchData($Combo1, $Combo2, $Combo3) $sSwitchFound = 1 EndIf If $sSwitchFound = 0 Then $sProdName = FileGetVersion($sFileName, $FV_PRODUCTNAME) If $sTestMode = 1 Then FileRecycle($sFileName) FileWrite("Installers.db", $sProdName & "|" & @CRLF) EndIf If $sProdName <> "" Then $sSilentSwitches = IniRead(@ScriptDir & "\Installers.db", $sProdName, "Switches", "") $sSilentSwitch = IniRead(@ScriptDir & "\Installers.db", $sProdName, "DefaultSwitch", "") $sProdName = "[ " & $sProdName & " ]" GUICtrlSetData($Combo1, "") ; Clear drop-down data to replenish it. GUICtrlSetData($Combo1, $sProdName, $sProdName) GUICtrlSetData($Combo2, "") ; Clear drop-down data to replenish it. GUICtrlSetData($Combo2, $sSilentSwitches, $sSilentSwitch) EndIf Else GUICtrlSetData($Button, "Unknown") ; If no match if found, set the button to "unknown" and disable it. It will get re-enabled on the next software selected. GUICtrlSetState($Button, $GUI_DISABLE) EndIf EndIf EndFunc Func _SetSwitchData($Combo1, $Combo2, $Combo3) $sInstaller = GUICtrlRead($Combo1) GUICtrlSetData($Combo2, "") If $sInstaller = "Ghost Installer" Then GUICtrlSetData($Combo2, "-s", "-s") ElseIf $sInstaller = "Inno Setup" Then GUICtrlSetData($Combo2, "/silent|/verysilent|/sp- /silent /norestart|/verysilent /norestart", "/verysilent /norestart") ElseIf $sInstaller = "InstallShield" Then GUICtrlSetData($Combo2, "/S|/S /NCRC", "/S") ElseIf $sInstaller = "Microsoft Hotfix Package" Then GUICtrlSetData($Combo2, "/passive|/passive /norestart|/quiet|/quiet /norestart|/u|/u /z|/q|/q /r:n|/q:a|/qb|/qn|/q:a /r:n", "/quiet /norestart") GUICtrlSetData($Combo3, "Patches/Updates") ElseIf $sInstaller = "MSI Package" Then GUICtrlSetData($Combo2, "/qb|/qn", "/qn") ElseIf $sInstaller = "Nullsoft" Then GUICtrlSetData($Combo2, "/S", "/S") ElseIf $sInstaller = "Wise Installer" Then GUICtrlSetData($Combo2, "/s", "/s") Else GUICtrlSetData($Combo2, $sAllSwitches) EndIf EndFunc Func _EnableDisableControls($g2Input1, $g2Combo1, $g2Combo2, $g2Combo3, $g2Input2, $g2Button1, $g2Button2, $g2Button3, $g2Button4, $g2Checkbox1, $g2Checkbox2, $g2Checkbox3, $g2Checkbox4, $g2Label7, $g2List, $01) GUICtrlSetState($g2Input1, ($01 = 1) ? $GUI_ENABLE : $GUI_DISABLE) GUICtrlSetState($g2Combo1, ($01 = 1) ? $GUI_ENABLE : $GUI_DISABLE) GUICtrlSetState($g2Combo2, ($01 = 1) ? $GUI_ENABLE : $GUI_DISABLE) GUICtrlSetState($g2Combo3, ($01 = 1) ? $GUI_ENABLE : $GUI_DISABLE) GUICtrlSetState($g2Input2, ($01 = 1) ? $GUI_ENABLE : $GUI_DISABLE) GUICtrlSetState($g2Checkbox1, ($01 = 1) ? $GUI_HIDE : $GUI_SHOW) GUICtrlSetState($g2Checkbox2, ($01 = 1) ? $GUI_ENABLE : $GUI_DISABLE) GUICtrlSetState($g2Checkbox3, ($01 = 1) ? $GUI_ENABLE : $GUI_DISABLE) GUICtrlSetState($g2Checkbox4, ($01 = 1) ? $GUI_ENABLE : $GUI_DISABLE) GUICtrlSetState($g2Button1, ($01 = 1) ? $GUI_ENABLE : $GUI_DISABLE) GUICtrlSetState($g2Button2, ($01 = 1) ? $GUI_ENABLE : $GUI_DISABLE) GUICtrlSetState($g2Button3, ($01 = 1) ? $GUI_ENABLE : $GUI_DISABLE) GUICtrlSetState($g2Button4, ($01 = 1) ? $GUI_ENABLE : $GUI_DISABLE) GUICtrlSetState($g2Label7, ($01 = 1) ? $GUI_SHOW : $GUI_HIDE) GUICtrlSetState($g2List, ($01 = 1) ? $GUI_DISABLE : $GUI_ENABLE) EndFunc Func _ClearAndSetInputs($g2List, $g2Button3, $g2Combo1, $g2Combo2, $g2Combo3, $g2Input1, $g2Input2, $g2Label7, $g2Checkbox1, $g2Checkbox2, $g2Checkbox3, $g2Checkbox4, $aSW, $iSWList = 0) GUICtrlSetData($g2List, "") GUICtrlSetData($g2Input1, "") GUICtrlSetData($g2Input2, "") GUICtrlSetData($g2Combo1, "") GUICtrlSetData($g2Combo2, "") GUICtrlSetData($g2Combo3, "") GUICtrlSetData($g2Combo1, $sAllInstallers) _SetSwitchData($g2Combo1, $g2Combo2, $g2Combo3) GUICtrlSetData($g2Combo3, "Audio/Video/Photo|System Tools|Internet|Games|Miscellaneous|Patches/Updates|Productivity", "Miscellaneous") GUICtrlSetState ($g2Checkbox2, $GUI_UNCHECKED) $iCBRead = GUICtrlRead($g2Checkbox1) If $iCBRead = 1 Then If IsArray($aSoftwareList) Then For $i = 1 To $aSoftwareList[0][0] GUICtrlSetData($g2List, $aSoftwareList[$i][0]) Next EndIf Else If IsArray($aUnconfiguredSW) Then For $i = 1 To $aUnconfiguredSW[0][0] GUICtrlSetData($g2List, $aUnconfiguredSW[$i][0]) Next EndIf EndIf GUICtrlSetState($g2Checkbox4, $GUI_UNCHECKED) GUICtrlSetState($g2Button3, $GUI_HIDE) EndFunc Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) Local $hWndFrom, $iIDFrom, $iCode, $hWndEdit $hWndFrom = $lParam $iIDFrom = _WinAPI_LoWord($wParam) $iCode = _WinAPI_HiWord($wParam) If $iCode = $LBN_DBLCLK AND $iIDFrom = $g2List Then $sClicked = GUICtrlRead($g2List) GUICtrlSendToDummy($idDummy, $sClicked) EndIf EndFunc Func _InstallOrder($aInstallList) GUISetState(@SW_DISABLE, $Form1) $Form5 = GUICreate("Installation Order", 423, 292) $g5Label1 = GUICtrlCreateLabel("Highlight software and click the up and down arrows to change order of installation", 16, 3, 393, 17) $g5List1 = GUICtrlCreateList("", 16, 24, 321, 253, $LBS_NOTIFY) $g5Button1 = GUICtrlCreateButton(ChrW(8593), 344, 112, 35, 25, $WS_GROUP) $g5Button2 = GUICtrlCreateButton(ChrW(8595), 344, 144, 35, 25, $WS_GROUP) $g5Button3 = GUICtrlCreateButton("Done", 351, 251, 59, 25, $WS_GROUP) GUISetState(@SW_SHOW) For $i = 1 To $aInstallList[0][0] GUICtrlSetData($g5List1, $aInstallList[$i][3]) Next While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUISetState(@SW_ENABLE, $Form1) GUIDelete($Form5) Return $aInstallList ExitLoop Case $g5Button1 $sRead = GUICtrlRead($g5List1) If $sRead <> "" Then $iArrayPos = _ArraySearch($aInstallList, $sRead, Default, Default, Default,Default,Default, 3) If $iArrayPos > 1 Then _ArraySwap($aInstallList, $iArrayPos, $iArrayPos - 1) EndIf GUICtrlSetData($g5List1, "") For $i = 1 To $aInstallList[0][0] GUICtrlSetData($g5List1, $aInstallList[$i][3]) Next EndIf Case $g5Button2 $sRead = GUICtrlRead($g5List1) If $sRead <> "" Then $iArrayPos = _ArraySearch($aInstallList, $sRead, Default, Default, Default,Default,Default, 3) If $iArrayPos < $aInstallList[0][0] Then _ArraySwap($aInstallList, $iArrayPos, $iArrayPos + 1) EndIf GUICtrlSetData($g5List1, "") For $i = 1 To $aInstallList[0][0] GUICtrlSetData($g5List1, $aInstallList[$i][3]) Next EndIf Case $g5Button3 GUISetState(@SW_ENABLE, $Form1) GUIDelete($Form5) Return $aInstallList ExitLoop EndSwitch WEnd EndFunc Func _QueryUser() $iShowConfigSWDiag = IniRead($fIniConfig, "Settings", "ShowConfigSWDiag", 4) If $iShowConfigSWDiag = 4 Then GUISetState(@SW_DISABLE, $Form1) $iStyle2 = BitOr( $WS_CAPTION, $WS_POPUP, $WS_SYSMENU) $Form6 = GUICreate("Attention", 423, 119, Default, Default, $iStyle2) $g6Label1 = GUICtrlCreateLabel("You have unconfigured software. Do you want to configure them now?", 32, 32, 338, 17) $g6Button1 = GUICtrlCreateButton("Yes", 184, 72, 99, 25, $WS_GROUP) $g6Button2 = GUICtrlCreateButton("No", 296, 72, 99, 25, $WS_GROUP) $g6Checkbox1 = GUICtrlCreateCheckbox("Do not ask again", 32, 80, 121, 17) GUISetState() $g6ExitButton = _GUICtrlMenu_GetSystemMenu($Form6) _GUICtrlMenu_EnableMenuItem($g6ExitButton, $SC_CLOSE, 1, False) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $g6Button1 $iCBRead = GUICtrlRead($g6Checkbox1) If $iCBRead = 1 Then IniWrite($fIniConfig, "Settings", "ShowConfigSWDiag", $iCBRead) EndIf GUISetState(@SW_ENABLE, $Form1) GUIDelete($Form6) Return 1 ExitLoop Case $g6Button2 $iCBRead = GUICtrlRead($g6Checkbox1) If $iCBRead = 1 Then IniWrite($fIniConfig, "Settings", "ShowConfigSWDiag", $iCBRead) EndIf GUISetState(@SW_ENABLE, $Form1) GUIDelete($Form6) Return 0 ExitLoop EndSwitch WEnd EndIf EndFunc Func _About() GUISetState(@SW_DISABLE, $Form1) Local $Form3, $hGraphic Local Const $iWidth = 400, $iHeight = 150, $iBgColor = 0x303030 $Form3 = GUICreate("About Software Installer", 400, 300) GUISetBkColor($iBgColor, $Form3) GUISetState(@SW_SHOW) Local $hGraphics = _GDIPlus_GraphicsCreateFromHWND($Form3) _GDIPlus_GraphicsSetSmoothingMode($hGraphics, $GDIP_SMOOTHINGMODE_HIGHQUALITY) ;sets the graphics object rendering quality (antialiasing) Local $hBrush = _GDIPlus_BrushCreateSolid(0xFFEE88BB) _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($Form3) _GDIPlus_GraphicsFillRect($hGraphic, 0, 150, 400, 300, $hBrush) $g3Label1 = GUICtrlCreateLabel("Software Installer", 48, 16, 304, 44) GUICtrlSetFont(-1, 26, 400, 0, "Arial Rounded MT Bold") GUICtrlSetColor(-1, 0xC0C0C0) $g3Label2 = GUICtrlCreateLabel("Version " & $sVersion, 48, 56, 100, 22) GUICtrlSetFont(-1, 12, 400, 0, "Arial") GUICtrlSetColor(-1, 0xC0C0C0) $g3Label3 = GUICtrlCreateLabel("Click here to go to the home page for this software", 48, 240, 300, 21) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000080) GUICtrlSetBkColor(-1, 0x434E54) GUICtrlSetCursor (-1, 0) $g3Label4 = GUICtrlCreateLabel("Scripted with AutoIt", 48, 200, 115, 20) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x808080) $g3Label5 = GUICtrlCreateLabel("This software is designed to help automate unattended and/or silent software installation.", 56, 96, 282, 40) GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x00FFFF) While 1 $nmsg = GUIGetMsg() Switch $nMsg Case $g3Label3 ShellExecute ("https://www.autoitscript.com/forum/topic/143730-software-installer/") Case $GUI_EVENT_CLOSE _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() GUISetState(@SW_ENABLE, $Form1) GUIDelete($Form3) ExitLoop EndSwitch WEnd EndFunc Func _PrePostInstallSoftware($sSWName, $Form2) GUISetState(@SW_DISABLE, $Form2) $g6Form = GUICreate("Pre And Post Install Software For: " & $sSWName, 552, 424) $g6Group1 = GUICtrlCreateGroup("Pre-Install Software", 16, 16, 513, 177) GUICtrlSetTip(-1, "These software will run BEFORE installing the software you are configuring (" & $sSWName & ").") $g6Label1 = GUICtrlCreateLabel("Software #1", 24, 40, 62, 17) $g6Input1 = GUICtrlCreateInput("", 24, 56, 409, 21) $g6Button1 = GUICtrlCreateButton("Select", 440, 56, 75, 23, $WS_GROUP) $g6Label2 = GUICtrlCreateLabel("Software #2", 24, 120, 62, 17) $g6Input2 = GUICtrlCreateInput("", 24, 136, 409, 21) $g6Button2 = GUICtrlCreateButton("Select", 440, 136, 75, 23, $WS_GROUP) $g6Label5 = GUICtrlCreateLabel("Switch", 224, 80, 36, 17) $g6Combo1 = GUICtrlCreateCombo("", 264, 80, 169, 25) GUICtrlSetData($g6Combo1, $sAllSwitches) $g6Label6 = GUICtrlCreateLabel("Switch", 224, 160, 36, 17) $g6Combo2 = GUICtrlCreateCombo("", 264, 160, 169, 25) GUICtrlSetData($g6Combo2, $sAllSwitches) $g6Button6 = GUICtrlCreateButton("Detect", 440, 80, 75, 20, $WS_GROUP) $g6Button7 = GUICtrlCreateButton("Detect", 440, 160, 75, 20, $WS_GROUP) $g6Label9 = GUICtrlCreateLabel("Installer", 24, 80, 40, 17) $g6Combo5 = GUICtrlCreateCombo("", 72, 80, 145, 25) GUICtrlSetData(-1, $sAllInstallers) $g6Label10 = GUICtrlCreateLabel("Installer", 24, 160, 40, 17) $g6Combo6 = GUICtrlCreateCombo("", 72, 160, 145, 25) GUICtrlSetData(-1, $sAllInstallers) $g6Label13 = GUICtrlCreateLabel("Clear Data", 96, 39, 54, 16) GUICtrlSetColor(-1, 0x800080) GUICtrlSetCursor (-1, 0) $g6Label14 = GUICtrlCreateLabel("Clear Data", 96, 119, 54, 16) GUICtrlSetColor(-1, 0x800080) GUICtrlSetCursor (-1, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) $g6Group2 = GUICtrlCreateGroup("Post-Install Software", 16, 208, 513, 177) GUICtrlSetTip(-1, "These software will run AFTER installing the software you are configuring (" & $sSWName & ").") $g6Label3 = GUICtrlCreateLabel("Software #1", 24, 232, 62, 17) $g6Input3 = GUICtrlCreateInput("", 24, 248, 409, 21) $g6Button3 = GUICtrlCreateButton("Select", 440, 248, 75, 23, $WS_GROUP) $g6Label4 = GUICtrlCreateLabel("Software #2", 24, 312, 62, 17) $g6Input4 = GUICtrlCreateInput("", 24, 328, 409, 21) $g6Button4 = GUICtrlCreateButton("Select", 440, 328, 75, 23, $WS_GROUP) $g6Label7 = GUICtrlCreateLabel("Switch", 224, 272, 36, 17) $g6Combo3 = GUICtrlCreateCombo("", 264, 272, 169, 25) GUICtrlSetData($g6Combo3, $sAllSwitches) $g6Label8 = GUICtrlCreateLabel("Switch", 224, 352, 36, 17) $g6Combo4 = GUICtrlCreateCombo("", 264, 352, 169, 25) $g6Button8 = GUICtrlCreateButton("Detect", 440, 272, 75, 20, $WS_GROUP) $g6Button9 = GUICtrlCreateButton("Detect", 440, 352, 75, 20, $WS_GROUP) $g6Label11 = GUICtrlCreateLabel("Installer", 24, 272, 40, 17) $g6Combo7 = GUICtrlCreateCombo("", 72, 272, 145, 25) GUICtrlSetData(-1, $sAllInstallers) $g6Label12 = GUICtrlCreateLabel("Installer", 24, 352, 40, 17) $g6Combo8 = GUICtrlCreateCombo("", 72, 352, 145, 25) GUICtrlSetData(-1, $sAllInstallers) GUICtrlSetData($g6Combo4, $sAllSwitches) $g6Label15 = GUICtrlCreateLabel("Clear Data", 96, 231, 54, 16) GUICtrlSetColor(-1, 0x800080) GUICtrlSetCursor (-1, 0) $g6Label16 = GUICtrlCreateLabel("Clear Data", 96, 311, 54, 16) GUICtrlSetColor(-1, 0x800080) GUICtrlSetCursor (-1, 0) GUICtrlCreateGroup("", -99, -99, 1, 1) $g6Button5 = GUICtrlCreateButton("Save Settings", 389, 392, 139, 25, $WS_GROUP) GUISetState(@SW_SHOW) $sSWLoc1 = IniRead($fIniConfig, $sSWName, "SWLoc1", "") $sSWLoc2 = IniRead($fIniConfig, $sSWName, "SWLoc2", "") $sSWLoc3 = IniRead($fIniConfig, $sSWName, "SWLoc3", "") $sSWLoc4 = IniRead($fIniConfig, $sSWName, "SWLoc4", "") $sSWSw1 = IniRead($fIniConfig, $sSWName, "SwSw1", "") $sSWSw2 = IniRead($fIniConfig, $sSWName, "SwSw2", "") $sSWSw3 = IniRead($fIniConfig, $sSWName, "SwSw3", "") $sSWSw4 = IniRead($fIniConfig, $sSWName, "SwSw4", "") GUICtrlSetData($g6Input1, $sSWLoc1) GUICtrlSetData($g6Input2, $sSWLoc2) GUICtrlSetData($g6Input3, $sSWLoc3) GUICtrlSetData($g6Input4, $sSWLoc4) If $sSWSw1 <> "" Then GUICtrlSetData($g6Combo1, $sSWSw1, $sSWSw1) EndIf If $sSWSw2 <> "" Then GUICtrlSetData($g6Combo2, $sSWSw2, $sSWSw2) EndIf If $sSWSw3 <> "" Then GUICtrlSetData($g6Combo3, $sSWSw3, $sSWSw3) EndIf If $sSWSw4 <> "" Then GUICtrlSetData($g6Combo4, $sSWSw4, $sSWSw4) EndIf While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE $sExit = MsgBox(262148, "Attention", "Do you want to close this window without saving?") If $sExit = 6 Then ; If they want to exit without saving, do it. Otherwise, they will save & window will exit. GUISetState(@SW_ENABLE, $Form2) GUIDelete($g6Form) ExitLoop EndIf Case $g6Button5 $sSWLoc1 = GUICtrlRead($g6Input1) IniWrite($fIniConfig, $sSWName, "SwLoc1", $sSWLoc1) $sSWLoc2 = GUICtrlRead($g6Input2) IniWrite($fIniConfig, $sSWName, "SwLoc2", $sSWLoc2) $sSWLoc3 = GUICtrlRead($g6Input3) IniWrite($fIniConfig, $sSWName, "SwLoc3", $sSWLoc3) $sSWLoc4 = GUICtrlRead($g6Input4) IniWrite($fIniConfig, $sSWName, "SwLoc4", $sSWLoc4) $sSWSw1 = GUICtrlRead($g6Combo1) IniWrite($fIniConfig, $sSWName, "SwSw1", $sSWSw1) $sSWSw2 = GUICtrlRead($g6Combo2) IniWrite($fIniConfig, $sSWName, "SwSw2", $sSWSw2) $sSWSw3 = GUICtrlRead($g6Combo3) IniWrite($fIniConfig, $sSWName, "SwSw3", $sSWSw3) $sSWSw4 = GUICtrlRead($g6Combo4) IniWrite($fIniConfig, $sSWName, "SwSw4", $sSWSw4) GUISetState(@SW_ENABLE, $Form2) GUIDelete($g6Form) ExitLoop Case $g6Button1 $sSWLoc = FileOpenDialog ("Please Select Pre-Install Software #1", @ScriptDir & "\Software", "Applications (*.exe; *.msi)") GUICtrlSetData($g6Input1, $sSWLoc) Case $g6Button2 $sSWLoc = FileOpenDialog ("Please Select Pre-Install Software #1", @ScriptDir & "\Software", "Applications (*.exe; *.msi)") GUICtrlSetData($g6Input2, $sSWLoc) Case $g6Button3 $sSWLoc = FileOpenDialog ("Please Select Pre-Install Software #1", @ScriptDir & "\Software", "Applications/Registry (*.exe; *.msi; *.reg; *.key)") GUICtrlSetData($g6Input3, $sSWLoc) Case $g6Button4 $sSWLoc = FileOpenDialog ("Please Select Pre-Install Software #1", @ScriptDir & "\Software", "Applications/Registry (*.exe; *.msi; *.reg; *.key)") GUICtrlSetData($g6Input4, $sSWLoc) Case $g6Button6 $sSWLoc = GUICtrlRead($g6Input1) $aStringSplit = StringSplit($sSWLoc, "\") $sSWLoc = $aStringSplit[$aStringSplit[0]] _GetInstallerType($sSWLoc, $g6Combo5, $g6Combo1, Default, $g6Button6) Case $g6Button7 $sSWLoc = GUICtrlRead($g6Input2) $aStringSplit = StringSplit($sSWLoc, "\") $sSWLoc = $aStringSplit[$aStringSplit[0]] _GetInstallerType($sSWLoc, $g6Combo6, $g6Combo2, Default, $g6Button7) Case $g6Button8 $sSWLoc = GUICtrlRead($g6Input3) $aStringSplit = StringSplit($sSWLoc, "\") $sSWLoc = $aStringSplit[$aStringSplit[0]] _GetInstallerType($sSWLoc, $g6Combo7, $g6Combo3, Default, $g6Button8) Case $g6Button9 $sSWLoc = GUICtrlRead($g6Input4) $aStringSplit = StringSplit($sSWLoc, "\") $sSWLoc = $aStringSplit[$aStringSplit[0]] _GetInstallerType($sSWLoc, $g6Combo8, $g6Combo4, Default, $g6Button9) Case $g6Combo5 _SetSwitchData($g6Combo5, $g6Combo1, Default) Case $g6Combo6 _SetSwitchData($g6Combo6, $g6Combo2, Default) Case $g6Combo7 _SetSwitchData($g6Combo7, $g6Combo3, Default) Case $g6Combo8 _SetSwitchData($g6Combo8, $g6Combo4, Default) Case $g6Label13 GUICtrlSetData($g6Input1, "") GUICtrlSetData($g6Combo5, "", "") GUICtrlSetData($g6Combo1, "", "") GUICtrlSetData($g6Combo5, $sAllInstallers, "") GUICtrlSetData($g6Combo1, $sAllSwitches, "") Case $g6Label14 GUICtrlSetData($g6Input2, "") GUICtrlSetData($g6Combo6, "", "") GUICtrlSetData($g6Combo2, "", "") GUICtrlSetData($g6Combo6, $sAllInstallers, "") GUICtrlSetData($g6Combo2, $sAllSwitches, "") Case $g6Label15 GUICtrlSetData($g6Input3, "") GUICtrlSetData($g6Combo7, "", "") GUICtrlSetData($g6Combo3, "", "") GUICtrlSetData($g6Combo7, $sAllInstallers, "") GUICtrlSetData($g6Combo3, $sAllSwitches, "") Case $g6Label16 GUICtrlSetData($g6Input4, "") GUICtrlSetData($g6Combo8, "", "") GUICtrlSetData($g6Combo4, "", "") GUICtrlSetData($g6Combo8, $sAllInstallers, "") GUICtrlSetData($g6Combo4, $sAllSwitches, "") EndSwitch WEnd EndFunc Func _HelpTopics() $Form7 = GUICreate("Help", 633, 447) $Label1 = GUICtrlCreateLabel("", 8, 16, 612, 425) GUICtrlSetData(-1, "This program uses silent switches to install software without user interaction. " & _ "To use this functionality, you can edit the Config.ini file to add software and their switches. Example: " & _ @CRLF & @CRLF & "[7z1900-x64.exe] ; <--- This is the actual file name" & _ @CRLF & "Description=YourDescripton" & @CRLF & "Switch=YourSwitcth" & @CRLF & "Category=YourCategory" & @CRLF & "etc... etc..." & _ @CRLF & @CRLF & "Here are some common switches for various installers: (more included in this program's features)" & @CRLF & @CRLF & "/silent used for Inno Setup installers" & @CRLF & _ "/verysilent used for Inno Setup installers" & @CRLF & "/S used for Nullsoft (aka NSIS) installers" & @CRLF & "/s used for Wise installers" & _ @CRLF & "-s used for Ghost installers" & @CRLF & "-ms used for Mozilla installers" & @CRLF & "/quiet used for Microsoft installers" & @CRLF & _ "/qb used for Microsoft installers" & @CRLF & "/qn used for Microsoft installers" & @CRLF & "/passive used for Microsoft installers" & @CRLF & _ "/Q used for Microsoft installers") GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE GUIDelete($Form7) ExitLoop EndSwitch WEnd EndFunc ;==>_HelpTopics Func _WM_NOTIFY($hWnd, $iMsg, $wParam, $lParam) Local $tStruct = DllStructCreate($tagNMHDR, $lParam) Local $hWndFrom = DllStructGetData($tStruct, 1) Local $iCode = BitAND(DllStructGetData($tStruct, 3), 0xFFFFFFFF) If $iCode = $NM_DBLCLK Then $sSWDblClk = StringTrimRight(_GUICtrlListView_GetItemTextString($hWndFrom), 1) GUICtrlSendToDummy($cDummy) EndIf EndFunc ;==>_WM_NOTIFY1 point -
1 point
-
Here is a modified _GDIPlus_GraphicsDrawStringEx() function example from AutoIt help file. It shows different levels of transparency of text. #include <GDIPlus.au3> #include <GUIConstantsEx.au3> Example() Func Example() Local $hGUI, $hGraphic, $hBrush, $hFormat, $hFamily, $hFont, $tLayout ; Create GUI $hGUI = GUICreate("GDI+", 400, 300) GUISetBkColor(0xFFDDDD) ; Hex colour format is 0xRRGGBB (0xRR for Red channel, 0xGG for Green channel, and 0xBB for Blue channel)chanels range from 0 to 0xFF or 255) GUISetState(@SW_SHOW) ; Draw a string _GDIPlus_Startup() $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) $hFormat = _GDIPlus_StringFormatCreate() $hFamily = _GDIPlus_FontFamilyCreate("Arial") $hFont = _GDIPlus_FontCreate($hFamily, 18, 2) For $i = 0 To 100 Step 10 $tLayout = _GDIPlus_RectFCreate(10, Int(2.6 * $i), 390, 50) ; Hex colour format is 0xAARRGGBB( when Alpha channel 0xAA = 0xFF the colour is 100% (fully) opaque. When 0xAA = 0x00 the colour is 100% fully transparent, invisible.) $hBrush = _GDIPlus_BrushCreateSolid("0x" & Hex(Int(255 * $i / 100), 2) & "0000FF") _GDIPlus_GraphicsDrawStringEx($hGraphic, "Hello world (" & 100 - $i & "% transparent)", $hFont, $tLayout, $hFormat, $hBrush) _GDIPlus_BrushDispose($hBrush) Next ; Loop until the user exits. Do Until GUIGetMsg() = $GUI_EVENT_CLOSE ; Clean up resources _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_GraphicsDispose($hGraphic) _GDIPlus_Shutdown() EndFunc ;==>Example1 point
-
As explained in the help of the Call() function you can pass a variable number of arguments to a function using the Call() statement and an 1D array as second argument. That is, you have to stack all your arguments in an 1D array, where the first element (element[0]) must contains the string "CallArgArray" and the following elements contains your arguments (also arrays are allowed as parameters), the receiving function must accept as many arguments as are stacked in the array. So is up to you to prepare the proper array related to the number of arguments accepted by the function you have to call. Call("A") Dim $aArguments[4] = ["CallArgArray", "First parameter", "Second", 3] ; pass 3 arguments Call("B", $aArguments) Dim $aArguments[5] = ["CallArgArray", 1, "Second", 3, 4] ; pass 4 arguments CallMyFunction("C", $aArguments) ; use your custom function to make the Call ; this function call another function and pass as many arguments as contained in the array (if any) Func CallMyFunction($FunctionName, $aArguments = "") Call($FunctionName, $aArguments) EndFunc ;==>CallMyFunction Func A() ConsoleWrite("Function A() has no arguments" & @CRLF) EndFunc ;==>A Func B($sabc, $pqr, $xyz) ConsoleWrite("Received: " & $sabc & @TAB & $pqr & @TAB & $xyz & @CRLF) EndFunc ;==>B Func C($abc, $xyz, $test, $text = "") ConsoleWrite("Received: " & @NumParams & " arguments." & @CRLF) EndFunc ;==>C1 point
-
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 Func A() ConsoleWrite( "A()" & @CRLF ) EndFunc Func B($sabc,$pqr,$xyz) ConsoleWrite( "B(" & $sabc & "," & $pqr & "," & $xyz & ")" & @CRLF ) EndFunc Func C($abc,$xyz,$test,$text) ConsoleWrite( "C(" & $abc & "," & $xyz & "," & $test & "," & $text & ")" & @CRLF ) EndFunc Func CallFunc( $f, $p1 = Default, $p2 = Default, $p3 = Default, $p4 = Default ) Return FuncName($f) = "A" ? $f() : FuncName($f) = "B" ? $f($p1,$p2,$p3) : $f($p1,$p2,$p3,$p4) EndFunc Example() Func Example() CallFunc( A ) CallFunc( B, 1, 2, 3 ) CallFunc( C, 1, 2, 3, 4 ) EndFunc1 point
-
Slow tooltips in latest autoit version.
SkysLastChance reacted to boludoz for a topic
I think the error goes beyond that.0 points -
Exactly, it is an internal problem of the exe, compared to the 2018 version, I cannot tell you the error because it is not open source. If I run the autoit with the 2022 version and the 2018 AutoIt3.exe this works perfectly, I just want to report the bug.0 points