
amphoric
Active Members-
Posts
36 -
Joined
-
Last visited
Everything posted by amphoric
-
Array in to List View and Updated after Loop
amphoric replied to amphoric's topic in AutoIt General Help and Support
Thanks Careca! I now have the columns working a treat, although how would I write to the second column the results? I loop through each computer 1 at a time? Thanks -
Hi, I am struggling converting my 1D array to a 2D array and then showing that in my List View. Below is my current code, where I would like to take the array from the input box, and have that displayed as a list within the list view this is a list of computer names, and then update the 2nd column of each line once I have ran a ping and a registry change on each computer name, with either 'Completed' and 'Failed' I have checked out the AutoIt Arrays page here: https://www.autoitscript.com/wiki/Arrays , but unfortunately I cannot get my head around it. Any help would be greatly appreciated. I hope this makes sense. Thanks #include <Date.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <MsgBoxConstants.au3> #include <GUIListBox.au3> #include <GuiListView.au3> #Region ### $Form1 = GUICreate("Title", 515, 533, -1, -1) GUISetBkColor(0xFFFFFF) $Pic2 = GUICtrlCreatePic("Images\pic.jpg", 16, 16, 212, 28) $Label1 = GUICtrlCreateLabel("Label", 240, 16, 271, 33, $SS_CENTER) GUICtrlSetFont(-1, 17, 800, 0, "") $Combo1 = GUICtrlCreateCombo("", 256, 406, 241, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE)) $Label2 = GUICtrlCreateLabel("Please select the location", 45, 401, 210, 20, $SS_CENTER) GUICtrlSetFont(-1, 10, 800, 0, "") $ChangeButton = GUICtrlCreateButton("Change", 286, 487, 75, 25) $RePromptButton = GUICtrlCreateButton("Re-prompt User", 366, 487, 139, 25) $Checkbox1 = GUICtrlCreateCheckbox("I have ensured that my selection is correct.", 10, 487, 273, 25) GUICtrlSetFont(-1, 10, 400, 0, "") $ManLocation = GUICtrlCreateLabel("Please enter the location:", 59, 448, 189, 20, $SS_RIGHT) GUICtrlSetFont(-1, 10, 800, 0, "") GUICtrlSetState(-1, $GUI_HIDE) $ManLocInput = GUICtrlCreateInput("", 256, 445, 241, 24) GUICtrlSetState(-1, $GUI_HIDE) $Label5 = GUICtrlCreateLabel("for this device:", 138, 418, 109, 20, $SS_CENTER) GUICtrlSetFont(-1, 10, 800, 0, "") $Label3 = GUICtrlCreateLabel("Asset Number:", 98, 72, 107, 20, $SS_CENTER) GUICtrlSetFont(-1, 10, 800, 0, "") $Input1 = GUICtrlCreateInput("", 215, 69, 241, 24) $AddMulti = GUICtrlCreateLabel("Add Multiple Assets", 356, 55, 98, 13, $SS_RIGHT) GUICtrlSetFont(-1, 8, 400, 6, "") GUICtrlSetColor(-1, 0x808080) GUICtrlSetCursor (-1, 0) $List1 = GUICtrlCreateListView("", 16, 104, 481, 278) $Add = GUICtrlCreateButton("Add", 461, 68, 35, 25) GUISetState(@SW_SHOW) #EndRegion ### ;### StartForm ### $FormaMultiple = GUICreate("Title", 277, 418, -1, -1) GUISetBkColor(0xFFFFFF) $Label1 = GUICtrlCreateLabel("Please add 1 asset number per line.", 8, 11, 253, 20, $SS_CENTER) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") $OK = GUICtrlCreateButton("OK", 56, 375, 75, 25) $Edit1 = GUICtrlCreateEdit("", 20, 40, 233, 329) $Cancel = GUICtrlCreateButton("Cancel", 136, 375, 75, 25) GUISetState(@SW_HIDE) ;### EndForm ### ;### Add List View Columns START ### ;### Add List View Columns END ### ;### Read Locations START ### ;Read the LOCAL ini file SECTIONS Global $aSections = IniReadSectionNames("Locations.ini") ;If the above succeeded, convert the array to a string with each item separated by a | (pipe) and set the default selected item to $aSections[1] If(Not @Error) Then GUICtrlSetData($Combo1, _ArraytoString($aSections, "|", 1), $aSections[1]) ;### Read Locations END ### ;### Require Admin START ### ;#RequireAdmin ;### Require Admin END ### While 1 $nMsg = GUIGetMsg() ;### Data Validation START ### ;Set Checkbox = ENABLE/DISABLE if not GUICtrlRead($Combo1) = "" AND GUICtrlRead($Combo1) = "Not In List" then if not GUICtrlRead($ManLocInput) = "" Then If not ControlCommand($Form1, "", $Checkbox1, "IsEnabled") Then GUICtrlSetState($Checkbox1, $GUI_ENABLE) Else If ControlCommand($Form1, "", $Checkbox1, "IsEnabled") Then GUICtrlSetState($Checkbox1, $GUI_DISABLE) EndIf Else if GUICtrlRead($Combo1) = "" Then If ControlCommand($Form1, "", $Checkbox1, "IsEnabled") Then GUICtrlSetState($Checkbox1, $GUI_DISABLE) Else If not ControlCommand($Form1, "", $Checkbox1, "IsEnabled") Then GUICtrlSetState($Checkbox1, $GUI_ENABLE) EndIf EndIf ;Set Button = ENABLE/DISABLE If GUICtrlRead($Checkbox1) = 1 Then If Not ControlCommand($Form1, "", $ChangeButton, "IsEnabled") Then GUICtrlSetState($ChangeButton, $GUI_ENABLE) Else If ControlCommand($Form1, "", $ChangeButton, "IsEnabled") Then GUICtrlSetState($ChangeButton, $GUI_DISABLE) EndIf ;### Data Validation END ### Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Add Case $AddMulti GUISetState(@SW_SHOW, $FormaMultiple) Case $Cancel GUISetState(@SW_HIDE, $FormaMultiple) Case $OK $sText = GUICtrlRead($Edit1) $aText = StringSplit($sText, @CRLF, 1) $bText = _ArrayToString($aText, ";", 1, -1) $cText = StringStripWS($bText, $STR_STRIPALL ) $dText = StringReplace($cText,";;",";") GUICtrlSetData($Input1, $dText) GUICtrlSetData($Edit1, "") GUISetState(@SW_HIDE, $FormaMultiple) For $i = 1 To $aText[0] Next Case $Combo1 ; If the combo is actioned Switch GUICtrlRead($Combo1) Case "Not In List" ; Show the manual input controls GUICtrlSetState($ManLocation, $GUI_SHOW) GUICtrlSetState($ManLocInput, $GUI_SHOW) if ControlCommand($Form1, "", $Checkbox1, "IsChecked") then ControlCommand($Form1, "", $Checkbox1, "Uncheck") GUICtrlSetData($ManLocInput, "") Case Else ; Hide them GUICtrlSetState($ManLocation, $GUI_HIDE) GUICtrlSetState($ManLocInput, $GUI_HIDE) if ControlCommand($Form1, "", $Checkbox1, "IsChecked") then ControlCommand($Form1, "", $Checkbox1, "Uncheck") GUICtrlSetData($ManLocInput, "") EndSwitch Case $ChangeButton ChangeReg() Case $RePromptButton RemoveReg() EndSwitch WEnd Func ChangeReg() $MultiAssets = StringSplit(GUICtrlRead($Input1), ";", 1) For $i = 1 To $MultiAssets[0] ; Ping with a timeout of 250ms. Local $iPing = Ping($MultiAssets[$i], 250) If $iPing Then ; If a value greater than 0 was returned then do the following: if not GUICtrlRead($ManLocInput) = "" Then RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "Location", "REG_SZ", "# - " & GUICtrlRead($ManLocInput)) RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "Location", "REG_SZ", "# - " & GUICtrlRead($ManLocInput)) RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "LocationLog", "REG_SZ", @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC) RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "LocationLog", "REG_SZ", @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC) MsgBox($MB_SYSTEMMODAL, "Completed", "Completed") Else If not GUICtrlRead($Input1) = "" Then RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "Location", "REG_SZ", GUICtrlRead($Combo1)) RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "Location", "REG_SZ", GUICtrlRead($Combo1)) RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "LocationLog", "REG_SZ", @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC) RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "LocationLog", "REG_SZ", @MDAY & "/" & @MON & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC) MsgBox($MB_SYSTEMMODAL, "Completed", $MultiAssets[$i] & @CRLF & " Changed to: " & GUICtrlRead($Combo1)) Else MsgBox($MB_SYSTEMMODAL, "Error", "Please ensure all boxes are completed") EndIf EndIf Else MsgBox($MB_SYSTEMMODAL, "Error", "This asset may be OFFLINE, unable to complete") EndIf Next EndFunc ;==>PingReg Func RemoveReg() $MultiAssets = StringSplit(GUICtrlRead($Input1), ";", 1) For $i = 1 To $MultiAssets[0] ; Ping with a timeout of 250ms. Local $iPing = Ping($MultiAssets[$i], 250) If $iPing Then ; If a value greater than 0 was returned then do the following: if not GUICtrlRead($ManLocInput) = "" Then RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "Location", "REG_SZ", "") RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "Location", "REG_SZ", "") RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "LocationLog", "REG_SZ", "") RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "LocationLog", "REG_SZ", "") MsgBox($MB_SYSTEMMODAL, "Completed", "Completed") Else If not GUICtrlRead($Input1) = "" Then RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "Location", "REG_SZ", "") RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "Location", "REG_SZ", "") RegWrite("\\" & $MultiAssets[$i] & "\HKLM\SOFTWARE\Location", "LocationLog", "REG_SZ", "") RegWrite("\\" & $MultiAssets[$i] & "\HKLM64\SOFTWARE\Location", "LocationLog", "REG_SZ", "") MsgBox($MB_SYSTEMMODAL, "Completed", $MultiAssets[$i] & @CRLF & "CLEARED") Else MsgBox($MB_SYSTEMMODAL, "Error", "Please ensure all boxes are completed") EndIf EndIf Else MsgBox($MB_SYSTEMMODAL, "Error", "This asset may be OFFLINE, unable to complete") EndIf Next EndFunc ;==>PingReg1
-
Hi, How would I create something that would show me what button i am pressing on my gamepad? But still allow me to control my game? I have a very simple scratched together piece of code i found which i have got changing picture when i press a certain button, although the window must be active for this to work, stopping me from controlling my game. Please Help! Thanks
-
Stop Label Flashing/Flickering
amphoric replied to amphoric's topic in AutoIt General Help and Support
Melba23 that's works perfectly!!! Thank you so much -
Stop Label Flashing/Flickering
amphoric replied to amphoric's topic in AutoIt General Help and Support
its the label that appears when you select 'Not In List' from the drop down. Cheers -
Good Morning, I am in the process of writing some simple script, although upon selecting 'Not in List' from my drop down it is meant to show a label.... this works although it flashes like crazy!! How can I stop this? #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <EditConstants.au3> #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> #include <EditConstants.au3> Opt("GUIOnEventMode", 1) Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKVCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKVCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKVCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKVCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) Opt("GUIResizeMode", $GUI_DOCKAUTO+$GUI_DOCKLEFT+$GUI_DOCKRIGHT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKHCENTER+$GUI_DOCKVCENTER+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT) #Region ### START Koda GUI section ### Form=H:\!! Applications\User Location Popup\Layout.kxf $Form1 = GUICreate("Your Asset Location", 514, 255, -1, -1, BitOr($WS_BORDER, $WS_POPUP), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW, $WS_EX_COMPOSITED)) GUISetBkColor(0xFFFFFF) $Pic1 = GUICtrlCreatePic("Images\image.jpg", 328, 160, 161, 34) $Pic2 = GUICtrlCreatePic("Images\image1.jpg", 16, 16, 212, 28) $Label1 = GUICtrlCreateLabel("Your Asset Location", 256, 16, 236, 33) GUICtrlSetFont(-1, 17, 800, 0, "MS Sans Serif") $Combo1 = GUICtrlCreateCombo("", 264, 70, 241, 25, BitOR($GUI_SS_DEFAULT_COMBO,$CBS_SIMPLE)) $Label2 = GUICtrlCreateLabel("Please select your current location:", 8, 72, 247, 20, $SS_CENTER) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Button1 = GUICtrlCreateButton("Finish", 376, 216, 75, 25) $Checkbox1 = GUICtrlCreateCheckbox("I have ensured that my selection is correct.", 40, 224, 281, 17) $Label3 = GUICtrlCreateLabel("This is a one time request for your location", 24, 160, 253, 20) GUICtrlSetColor(-1, 0xFF0000) $Label4 = GUICtrlCreateLabel("please ensure the accuracy of your submition.", 16, 176, 275, 20) GUICtrlSetColor(-1, 0xFF0000) $ManLocation = GUICtrlCreateLabel("Please enter your location:", 67, 112, 189, 20, BitOr($SS_CENTER, $WS_EX_COMPOSITED)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xFFFFFF) GUICtrlSetState(-1, $GUI_HIDE) $ManLocInput = GUICtrlCreateInput("", 264, 109, 241, 24) GUICtrlSetState(-1, $GUI_HIDE) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ; Get the sections of LOACTIONS in the ini file Global $aSections = IniReadSectionNames("Locations.ini") ; If the IniReadSectionNames succeeded, conver the array to a string with each item separated by a | (pipe) and set the default selected item to $aSections[1] If (Not @Error) Then GUICtrlSetData($Combo1, _ArraytoString($aSections, "|", 1), $aSections[1]) While 1 $nMsg = GUIGetMsg() ;If Reg Exists - EXIT if Not RegRead ("HKLM\SOFTWARE\location", "Location") = "" Then Exit EndIf ;EXIT - If Admin Account $string = @UserName $searchstring1 = "TSS" $searchstring2 = "SDESK" $searchstring3 = "DESK" $searchstring4 = "PROBADMIN" $searchstring5 = "ENGADMIN" If StringInStr($string, $searchstring1) Or StringInStr($string, $searchstring2) Or StringInStr($string, $searchstring3) Or StringInStr($string, $searchstring4) Or StringInStr($string, $searchstring5) Then Exit EndIf if GUICtrlRead($Combo1) = "Not In List" Then GUICtrlSetState($ManLocation, $GUI_SHOW) Else GUICtrlSetState($ManLocation, $GUI_HIDE) EndIf ;Set Chackbox & Button GUI_SHOW if Not GUICtrlRead($Combo1) = "" Then If Not ControlCommand($Form1, "", $Checkbox1, "IsEnabled") Then GUICtrlSetState($Checkbox1, $GUI_ENABLE) Else If ControlCommand($Form1, "", $Checkbox1, "IsEnabled") Then GUICtrlSetState($Checkbox1, $GUI_DISABLE) EndIf ;Set Button Focus If GUICtrlRead($Checkbox1) = 1 Then If Not ControlCommand($Form1, "", $Button1, "IsEnabled") Then GUICtrlSetState($Button1, $GUI_ENABLE) Else If ControlCommand($Form1, "", $Button1, "IsEnabled") Then GUICtrlSetState($Button1, $GUI_DISABLE) EndIf Switch $nMsg Case $GUI_EVENT_CLOSE Exit ;OK Button Function - Write to reg Case $Button1 RegDelete("HKLM\SOFTWARE\Location", "Location") RegDelete("HKLM64\SOFTWARE\Location", "Location") RegDelete("HKLM\SOFTWARE\Location", "LocationLog") RegDelete("HKLM64\SOFTWARE\Location", "LocationLog") RegWrite("HKLM\SOFTWARE\Location", "Location", "REG_SZ", GUICtrlRead($Combo1)) RegWrite("HKLM64\SOFTWARE\Location", "Location", "REG_SZ", GUICtrlRead($Combo1)) RegWrite("HKLM\SOFTWARE\Location", "LocationLog", "REG_SZ", @MDAY & "-" & @MON & "-" & @YEAR) RegWrite("HKLM64\SOFTWARE\Location", "LocationLog", "REG_SZ", @MDAY & "-" & @MON & "-" & @YEAR) MsgBox($MB_SYSTEMMODAL, "Thank You", "Thank you for your time.") EndSwitch WEnd Cheers
-
Multi Select List Box - Read Selections
amphoric replied to amphoric's topic in AutoIt GUI Help and Support
That's perfect! Thanks so much for your help Melba23!!! Another quick question if I may? How would I now loop through and run an action for each of the selected Listbox items? Cheers -
I have created a simple GUI and would like to read out which selections I select from my multi selection list box, so I can eventually run a loop on the selected items. My current code is below,,, I just cant get it to read out a single selection let alone multiple Thanks in advance #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> #include <WinAPIFiles.au3> #include <GuiListView.au3> #include <ListViewConstants.au3> ;Include and Install required files on run of compiled script Local $bFileInstall = True ; Change to True and ammend the file paths accordingly. ; On 'run' this will install the files to C:\Packaging\ Packaging Upload v1.0 DirCreate ("C:\Pack\PackUpload v1.0\Required") If $bFileInstall Then FileInstall( "H:\!! Applications\Pack Upload\Pack Upload v1.0\Folders.ini", "C:\Pack\Pack Upload v1.0\Required\Folders.ini", $FC_NOOVERWRITE) ;_Apps Local Directory Global $_Apps = "C:\Pack\_Apps" Global $aFileList, $PackageListItems, $sAvailableFolders ;Include The INI File $sIniPath = "C:\Packaging\ Packaging Upload v1.0\Required\Folders.ini" ;Read the INI file section names Local $aArray = IniReadSectionNames($sIniPath) If @error Then Exit MsgBox(0, "Error", "returned @error = " & @error) ;Convert to a string for loading into combo $sPackageTypes = "" For $i = 1 To $aArray[0] $sPackageTypes &= "|" & $aArray[$i] Next PackageList() GUI() Func GUI() #Region ### START GUI section ### $Form1_1 = GUICreate(" - Package Upload", 436, 460, -1, -1) GUISetIcon("C.ico", -1) GUISetBkColor(0xFFFFFF) $ProceedBtn = GUICtrlCreateButton("Proceed", 128, 392, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008000) $CancelBtn = GUICtrlCreateButton("Cancel", 240, 392, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) $Logo = GUICtrlCreatePic(".jpg", 24, 8, 159, 33) $PackageUploadLabel = GUICtrlCreateLabel("Package Upload", 224, 8, 187, 28, BitOR($SS_RIGHT,$SS_CENTERIMAGE)) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) $CreatedByLabel = GUICtrlCreateLabel("Created By ITES", 16, 432, 405, 15, $SS_CENTER) GUICtrlSetFont(-1, 7, 400, 0, "MS Sans Serif") $VerLabel = GUICtrlCreateLabel("Ver. 1.0 ALPHA", 328, 40, 79, 17) $Step1Label = GUICtrlCreateLabel("1. Select The Required Package(s) To Upload", 24, 80, 386, 20, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000080) GUICtrlSetBkColor(-1, 0xE3E3E3) $Graphic3 = GUICtrlCreateGraphic(16, 72, 404, 356, BitOR($GUI_SS_DEFAULT_GRAPHIC,$SS_SIMPLE)) GUICtrlSetColor(-1, 0xE3E3E3) GUICtrlSetBkColor(-1, 0xE3E3E3) Global $PackageList = GUICtrlCreateList("", 24, 104, 385, 100, BitOR($LBS_NOTIFY,$LBS_SORT,$WS_VSCROLL, $LBS_MULTIPLESEL, $LBS_EXTENDEDSEL)) GUICtrlSetData(-1, $PackageListItems) $Step2Label = GUICtrlCreateLabel("2. Select The Required Upload Directory", 24, 216, 386, 20, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000080) GUICtrlSetBkColor(-1, 0xE3E3E3) $PackageTypeCombo = GUICtrlCreateCombo("", 24, 264, 185, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, $sPackageTypes) $PackageTypeLabel = GUICtrlCreateLabel("Package Type:", 25, 242, 111, 17, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xE3E3E3) $PackageStateCombo = GUICtrlCreateCombo("", 224, 264, 185, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetState($PackageStateCombo, $GUI_DISABLE) $PackageStateLabel = GUICtrlCreateLabel("Package State:", 225, 242, 111, 17, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xE3E3E3) $IfFileExistsLabel = GUICtrlCreateLabel("If the file exists would you like to:", 25, 298, 383, 17, $SS_CENTERIMAGE) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xE3E3E3) $Group1 = GUICtrlCreateGroup("", 24, 312, 385, 65) $OverwriteRadio = GUICtrlCreateRadio("OverwriteRadio", 32, 324, 81, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xE3E3E3) $SkipRadio = GUICtrlCreateRadio("SkipRadio", 32, 348, 49, 17) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xE3E3E3) GUICtrlCreateGroup("", -99, -99, 1, 1) $Label5 = GUICtrlCreateLabel("If Package Exists", 120, 323, 106, 20, $SS_CENTERIMAGE) GUICtrlSetBkColor(-1, 0xE3E3E3) $Label6 = GUICtrlCreateLabel("If Package Exists", 85, 347, 106, 20, $SS_CENTERIMAGE) GUICtrlSetBkColor(-1, 0xE3E3E3) GUISetState(@SW_SHOW) #EndRegion ### END GUI section ### While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE ExitLoop Case $CancelBtn Exit Case $PackageTypeCombo ; Read the $PackageTypeCombo combo $SelectedType = GUICtrlRead($PackageTypeCombo) ;Read the avaliable folders in that section $AvailableFolders = IniReadSection($sIniPath, $SelectedType) ;If there are folders convert to string If IsArray($AvailableFolders) Then $sAvailableFolders = "" For $i = 1 To $AvailableFolders [0][0] $sAvailableFolders &= "|" & $AvailableFolders[$i][0] Next GUICtrlSetData($PackageStateCombo, $sAvailableFolders) GUICtrlSetState($PackageStateCombo, $GUI_ENABLE) EndIf Case $ProceedBtn $sItem = GUICtrlRead(GUICtrlRead($PackageList)) $sItem = StringTrimRight($sItem, 1) ; Will remove the pipe "|" from the end of the string MsgBox(0, "Selected Item", $sItem) EndSwitch WEnd EndFunc Func PackageList() ; List all the folders in the _Apps directory using the default parameters. Local $aFileList = _FileListToArray($_Apps, "*") $sFileList = "" For $i = 1 To $aFileList [0] $sFileList &= "|" & $aFileList[$i] Next $PackageListItems = $sFileList If @error = 1 Then MsgBox($MB_SYSTEMMODAL, "", "Path was invalid.") Exit EndIf If @error = 4 Then MsgBox($MB_SYSTEMMODAL, "", "No file(s) were found.") Exit EndIf EndFunc
-
OMG SUBZ! You are my HERO!!!!!! Thank you so much, you don't know how long I've been looking at trying to do this! Can you please explain the changes and why they were required? I would like to learn how/where I went wrong Thanks
- 8 replies
-
- checkbox
- radiobutton
-
(and 2 more)
Tagged with:
-
Does this work with Radio Buttons and Check Boxes? As I cannot get this to work
-
The wmcommand basically allows for the update of the AD Group box when entering the Application name. if you enter a application name it also populates the AD Group box stripping out the ' _ ' (Underscore) character. Unfortunately this new code has stopped that functionality, it no longer auto populates the AD Group input box
- 8 replies
-
- checkbox
- radiobutton
-
(and 2 more)
Tagged with:
-
Hey Subz, Yes like that!! Although this still doesn't allow the user to edit the contents of the input box... I haven't a clue how to make the radiobutton show the other radio buttons either Thanks
- 8 replies
-
- checkbox
- radiobutton
-
(and 2 more)
Tagged with:
-
Good Morning, I hope someone can help, below is a stripped down version of my current .au3 file and there is a few bits I just cant for the life of me get to work; 1. I would like the 'Allow Edit' checkbox once checked to allow the user to edit the contents of the 'AD Group Name' input box 2. I would like the 'Other / Internal Use' radio button if checked to show the '$OtherInternalGroup' group of radio buttons My current code..... #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <WinAPIShellEx.au3> #include <FileConstants.au3> #include <WinAPIFiles.au3> #include <WinAPI.au3> ; used for Lo/Hi word ; Declare Global variables for WM_COMMAND and '_GetAppName()' function. Global $__iComboWrite = 9999, $__iInputValue = 9999, $__iInputWrite = 9999 #Region ### START GUI section ### $Form1_1 = GUICreate("Packaging Wrapper", 435, 545, -1, -1) GUISetIcon("C.ico", -1) GUISetBkColor(0xFFFFFF) Global $ApplicationNameInput = GUICtrlCreateInput("", 24, 168, 385, 21) GUICtrlSetTip(-1, "EG: Corel_WinZip_21.0_0.1") $ADGroupNameInput = GUICtrlCreateInput("", 24, 224, 385, 21) $AllowEditChk = GUICtrlCreateCheckbox("Allow Edit", 344, 200, 65, 17, BitOR($GUI_SS_DEFAULT_CHECKBOX,$BS_RIGHT)) GUICtrlSetBkColor(-1, 0xE3E3E3) $ApplicationTypeGroup = GUICtrlCreateGroup("", 24, 272, 185, 113) $CatalogueAppChk = GUICtrlCreateRadio("Catalogue Application", 32, 288, 137, 17) GUICtrlSetBkColor(-1, 0xE3E3E3) $NonCatalogueAppChk = GUICtrlCreateRadio("Non-Catalogue Application", 32, 320, 161, 17) GUICtrlSetBkColor(-1, 0xE3E3E3) $OtherAppChk = GUICtrlCreateRadio("Other / Internal Use", 32, 352, 137, 17) GUICtrlSetBkColor(-1, 0xE3E3E3) GUICtrlCreateGroup("", -99, -99, 1, 1) ; $OtherInternalGroup = GUICtrlCreateGroup("", 216, 272, 193, 113) $OSCoreApplicationChk = GUICtrlCreateRadio("OS Core Application", 224, 288, 129, 17) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetBkColor(-1, 0xE3E3E3) $InternalOnlyChk = GUICtrlCreateRadio("Internal ONLY Application", 224, 320, 161, 17) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetBkColor(-1, 0xE3E3E3) GUICtrlCreateGroup("", -99, -99, 1, 1) $OtherInternalLabel = GUICtrlCreateLabel("Other / Internal Use", 216, 256, 118, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xE3E3E3) $ConfirmGroup = GUICtrlCreateGroup("", 24, 392, 385, 89) $Confirm = GUICtrlCreateCheckbox("I confirm all details are correct, and I wish to proceed", 48, 456, 329, 17, BitOR($GUI_SS_DEFAULT_CHECKBOX, $BS_CENTER)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetBkColor(-1, 0xE3E3E3) $ConfirmDesc = GUICtrlCreateEdit("", 32, 408, 361, 41, 0, 0) GUICtrlSetData(-1, StringFormat("Please confirm that all entered information is correct, and the you wish to \r\nproceed with the creation of the " & Chr(39) & "Application Toolkit Wrapper" & Chr(39) & ".")) GUICtrlSetBkColor(-1, 0xE3E3E3) GUICtrlCreateGroup("", -99, -99, 1, 1) $ProceedBtn = GUICtrlCreateButton("Proceed", 128, 488, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x008000) $CancelBtn = GUICtrlCreateButton("Cancel", 240, 488, 75, 25) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0xFF0000) $CapitaLogo = GUICtrlCreatePic("Logo.jpg", 24, 8, 159, 33) $PackagingWrapperLabel = GUICtrlCreateLabel("Packaging Wrapper", 224, 8, 187, 28) GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) $CreatedByLabel = GUICtrlCreateLabel("...", 16, 528, 405, 15, $SS_CENTER) GUICtrlSetFont(-1, 7, 400, 0, "MS Serif") $VerLabel = GUICtrlCreateLabel("Ver. 1.0 ALPHA", 328, 40, 79, 17) $Step1Label = GUICtrlCreateLabel("Please Enter The Following Information", 24, 80, 274, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000080) GUICtrlSetBkColor(-1, 0xE3E3E3) $Graphic3 = GUICtrlCreateGraphic(16, 72, 404, 452, BitOR($GUI_SS_DEFAULT_GRAPHIC, $SS_SIMPLE)) GUICtrlSetColor(-1, 0xE3E3E3) GUICtrlSetBkColor(-1, 0xE3E3E3) $ApplicationNameDesc = GUICtrlCreateEdit("", 24, 128, 393, 33, 0, 0) GUICtrlSetData(-1, StringFormat("Must be in the following format: Manufacturer_AppName_AppVersion_Rev\r\nEG: Corel_WinZip_21.0_01")) GUICtrlSetBkColor(-1, 0xE3E3E3) $ADGroupNameLabel = GUICtrlCreateLabel("AD Group Name", 24, 200, 95, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xE3E3E3) $ApplicationNameLabel = GUICtrlCreateLabel("Application Name", 24, 112, 103, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xE3E3E3) $ApplicationTypeLabel = GUICtrlCreateLabel("Application Type", 24, 256, 99, 17, BitOR($SS_CENTER, $SS_CENTERIMAGE)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1, 0x000000) GUICtrlSetBkColor(-1, 0xE3E3E3) GUISetState(@SW_SHOW) #EndRegion ### END GUI section ### ;GLOBAL VARIABLES Global $ApplicationName, $adstring1 Global $ADGroupName = $adstring1 Global $envSystemDrive = EnvGet("systemdrive") Global $PackagingDirectory = "Packaging\???_Apps" Global $FullDir = $envSystemDrive & "\" & $PackagingDirectory & "\" & $ApplicationName Global $currentDate = @MDAY &"-"& @MON &"-"& @YEAR Global $currentTime = @HOUR &":"& @MIN &":"& @SEC ; Register the WM_COMMAND to intercept when the value in the first input's value is changed. GUIRegisterMsg($WM_COMMAND, 'WM_COMMAND') While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $CancelBtn Exit Case $ProceedBtn ;Check Application Name Validity $ApplicationNameInputValid = StringSplit(GUICtrlRead($ApplicationNameInput), "_") If $ApplicationNameInputValid[0]<> 4 Then ConsoleWrite("Application Name - NOT Valid" & @CRLF) $ApplicationNameInputValidYes = 0 MsgBox(0,"Are The Details Correct?", "Application Name NOT Valid.") GUICtrlSetState($ApplicationNameInput,$GUI_FOCUS) Elseif $ApplicationNameInputValid[0]= 4 Then ConsoleWrite("Application Name - Valid" & @CRLF) $ApplicationNameInputValidYes = 1 EndIf ;Is Confirm Checkbox 'Checked' if GUICtrlRead($Confirm) = $GUI_CHECKED Then ConsoleWrite("$Confirm - ticked" & @CRLF) $ConfirmYes = 1 Else $ConfirmYes = 0 ConsoleWrite("$Confirm - NOT ticked" & @CRLF) MsgBox(0,"Are The Details Correct?", "Please complete confirmation.") EndIf ;Is $CatalogueAppChk 'Checked' if GUICtrlRead($CatalogueAppChk) = $GUI_CHECKED Then ConsoleWrite("$CatalogueAppChk - ticked" & @CRLF) $CatalogueAppChkYes = 1 Else ConsoleWrite("$CatalogueAppChk - NOT ticked" & @CRLF) $CatalogueAppChkYes = 0 EndIf ;Is $NonCatalogueAppChk 'Checked' if GUICtrlRead($NonCatalogueAppChk) = $GUI_CHECKED Then ConsoleWrite("$NonCatalogueAppChk - ticked" & @CRLF) $NonCatalogueAppChkYes = 1 Else ConsoleWrite("$NonCatalogueAppChk - NOT ticked" & @CRLF) $NonCatalogueAppChkYes = 0 EndIf ;Is $OtherAppChk 'Checked' if GUICtrlRead($OtherAppChk) = $GUI_CHECKED Then ConsoleWrite("$OtherAppChk - ticked" & @CRLF) $OtherAppChkYes = 1 Else ConsoleWrite("$OtherAppChk - NOT ticked" & @CRLF) $OtherAppChkYes = 0 EndIf ConsoleWrite(@CRLF & "##### COMPLETED #####" & @CRLF) EndSwitch WEnd ;Check for 'Application Name' update Func _GetAppName() $adString = StringReplace(GUICtrlRead($ApplicationNameInput), "_", " ",2) $adstrings = StringSplit($adString, "_") Global $adString1 = $adstrings[1] Global $ApplicationName = GUICtrlRead($ApplicationNameInput) GUICtrlSetData($ADGroupNameInput, $adstring1) EndFunc ;WM_COMMAND Function used for Auto Input of fields Func WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $lParam Local $iHiWord = _WinAPI_HiWord($wParam) ; Control identification code. Local $iLoWord = _WinAPI_LoWord($wParam) ; Control identifier. Switch $iHiWord Case $EN_CHANGE ; When a change event is intercepted. Switch $iLoWord ; Retrieve the controlid. Case _GetAppName() ; If it matches the first input then call the custom function _GetInput. ConsoleWrite("Debug: value was changed." & @CRLF) _GetAppName() EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_COMMAND I hope all this makes sense. Thanks in advance
- 8 replies
-
- checkbox
- radiobutton
-
(and 2 more)
Tagged with:
-
Button not reacting to manual click with mouse
amphoric replied to amphoric's topic in AutoIt General Help and Support
Morning. Yes this does fire off every time I press the button. What could this be :( Cheers -
Button not reacting to manual click with mouse
amphoric replied to amphoric's topic in AutoIt General Help and Support
The button highlights as im clicking on it so i know that there is nothing over it stopping the click.... very strange -
Button not reacting to manual click with mouse
amphoric replied to amphoric's topic in AutoIt General Help and Support
Thanks Melba23, Although there doesnt seem to be anything overlapping the button... Could this be anything else? Thanks -
Hi can someone please help? When i click button '$BtnAdd' it does nothing.... Global $asset = GUICtrlRead($SearchInput) Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $ApplicationList Global $sChosen = GUICtrlRead($ApplicationList) If $sChosen <> "" Then GUICtrlSetData($SearchInput, $sChosen) EndIf Case $BtnAdd If $sPartialData <> "" Then $sFinal = GUICtrlRead($SearchInput) If _ArraySearch($asKeyWords, $sFinal) > 0 Then MsgBox(0, "Chosen", $sFinal) EndIf EndIf Case $hUP If $sPartialData <> "" Then $iCurrIndex -= 1 If $iCurrIndex < 0 Then $iCurrIndex = 0 _GUICtrlListBox_SetCurSel($ApplicationList, $iCurrIndex) EndIf Case $hDOWN If $sPartialData <> "" Then $iTotal = _GUICtrlListBox_GetCount($ApplicationList) $iCurrIndex += 1 If $iCurrIndex > $iTotal - 1 Then $iCurrIndex = $iTotal - 1 _GUICtrlListBox_SetCurSel($ApplicationList, $iCurrIndex) EndIf Case $hENTER If $iCurrIndex <> -1 Then $sText = _GUICtrlListBox_GetText($ApplicationList, $iCurrIndex) GUICtrlSetData($SearchInput, $sText) $iCurrIndex = -1 _GUICtrlListBox_SetCurSel($ApplicationList, $iCurrIndex) EndIf Thanks
-
ahh obviously!!! haha my bad Thanks again Water
-
Ahh perfect! You hero! I have got it working now thank you very much for your help!!! How would i specify it to only check within a single OU though? Thanks
-
Thanks Water, Im struggling to get this to work :/... Could you please give me an example of what the code might be? I have the following code to bring back all groups within a certain OU, but unsure how I can specify only for a certain ComputerName and bring back the results from the certain OU. _ad_GetObjectsInOU($sOU , '(&(ObjectsCategory=group) (distinguishedName=*))', 2, "CN") Cheers
-
How would i use $aUser = _AD_GetUserGroups(@ComputerName & "$") But only show the 'CN' within a list box, not the entire string. Thanks
-
List Box - ADD items and store selected in variable.
amphoric replied to amphoric's topic in AutoIt General Help and Support
Thanks for your reply Subz! Much appreciated... I think i understand this now, although the below code still doesn't work to show me the groups from my specific OU, although works great when i don't try and specify a OU: Func Keywords() Local $sGroups _AD_Open($User,$Pass,"","my.domain.com") Global $sOU = "OU=Group Three,OU=Group Two,OU=Group One,OU=Groups,DC=my,DC=domain,DC=com" $aGroups = _AD_GetObjectsInOU($sOU ,'(&(objectCategory=group)(displayName=*))', 2, "displayName") _AD_Close() _ArrayDisplay($aGroups) $sGroups = _ArrayToString($aGroups, "|", 1) GUICtrlSetData($List1, $sGroups) $iCurrIndex = -1 _GUICtrlListBox_SetCurSel($List1, $iCurrIndex) EndFunc ;==>Keywords This would be for OU: my.domain.com\Groups\Group One\Group Two\Group Three Thanks Again -
List Box - ADD items and store selected in variable.
amphoric replied to amphoric's topic in AutoIt General Help and Support
_AD_GetObjectsInOU('OU=three,OU=four,OU=five,DC=one,DC=two,DC=ad','(&(objectCategory=group)(displayName=*))', 2, "displayName") Would that be correct if i wanted to look into the following OU? one.two.ad\Three\four\five -
List Box - ADD items and store selected in variable.
amphoric replied to amphoric's topic in AutoIt General Help and Support
Im pretty sure i am :/ Could you please give me an example of what it may look like for OU: one.two.ad\Three\four\five Thanks Again