DannyJ Posted May 31, 2021 Share Posted May 31, 2021 AD (Active Directory Users and Computers) is a powerful tool, if you go to User Properties -> Attribute Editor -> proxyAddress. So I want to copy just the work of this little program. Here is my example script of my copy, how do I add the extra change values features? #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Multi-valued String Editor", 498, 437, 579, 334) $List1 = GUICtrlCreateList("", 40, 168, 289, 162) $Button1 = GUICtrlCreateButton("Add", 352, 120, 123, 25) $Button2 = GUICtrlCreateButton("Remove", 344, 168, 131, 25) $Input1 = GUICtrlCreateInput("", 40, 120, 281, 21) $Label1 = GUICtrlCreateLabel("Attribute", 40, 48, 44, 17) $Label2 = GUICtrlCreateLabel("proxyAddress", 128, 48, 92, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
water Posted May 31, 2021 Share Posted May 31, 2021 How do you want to add new values? At the top of the list, at the end, before/after a selected item? DannyJ 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
DannyJ Posted May 31, 2021 Author Share Posted May 31, 2021 (edited) 5 minutes ago, water said: How do you want to add new values? At the top of the list, at the end, before/after a selected item? @water If nothing is selected then the top of the list. If something selected before a selected item, just like in AD. Edited May 31, 2021 by DannyJ Link to comment Share on other sites More sharing options...
water Posted May 31, 2021 Share Posted May 31, 2021 First step: Add the input to the end of the list #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $sListData = "Line 1|Line 2", $sInput = "" GUICreate("Multi-valued String Editor", 498, 437, 579, 334) $hList = GUICtrlCreateList("", 40, 168, 289, 162) GUICtrlSetData($hList, $sListData) $hBtnAdd = GUICtrlCreateButton("Add", 352, 120, 123, 25) $hBtnRemove = GUICtrlCreateButton("Remove", 344, 168, 131, 25) $hInput = GUICtrlCreateInput("", 40, 120, 281, 21) GUICtrlCreateLabel("Attribute", 40, 48, 44, 17) GUICtrlCreateLabel("proxyAddress", 128, 48, 92, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $hBtnAdd $sInput = GUICtrlRead($hInput) If $sInput <> "" Then $sListData = $sInput & "|" & $sListData GUICtrlSetData($hList, "|" & $sListData) ; | clears the list before sending new entries EndIf EndSwitch WEnd My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted May 31, 2021 Share Posted May 31, 2021 (edited) You can't insert values into a list control as the passed values always get sorted. Try to add "1234" and "Test". This thread explains why Edited May 31, 2021 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
water Posted May 31, 2021 Share Posted May 31, 2021 New version: Sort "problem" solved Adds/removes item at the position of a selected item expandcollapse popup#include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <ListboxConstants.au3> #include <WindowsConstants.au3> #include <Array.au3> Global $sListData = "Line 1|Line 2", $sInput = "" GUICreate("Multi-valued String Editor", 498, 437, 579, 334) $hList = GUICtrlCreateList("", 40, 168, 289, 162, BitOR($WS_BORDER, $WS_VSCROLL, $LBS_NOTIFY)) GUICtrlSetData($hList, $sListData) $hBtnAdd = GUICtrlCreateButton("Add", 352, 120, 123, 25) $hBtnRemove = GUICtrlCreateButton("Remove", 352, 168, 123, 25) $hInput = GUICtrlCreateInput("", 40, 120, 289, 21) GUICtrlCreateLabel("Attribute:", 40, 48, 44, 17) GUICtrlCreateLabel("proxyAddress", 90, 48, 92, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $hBtnAdd, $hBtnRemove $sInput = GUICtrlRead($hInput) If $sInput <> "" Or $nMsg = $hBtnRemove Then $iSelected = _GUICtrlListBox_GetCurSel($hList) ; Get the currently selected item in the List Box If $iSelected < 0 Then $iSelected = 0 ; No item selected If $sListData = "" Then ; Listbox is empty $sListData = $sInput Else $aListData = StringSplit($sListData, "|", $STR_NOCOUNT) ; Split current listbox content If $nMsg = $hBtnAdd Then _ArrayInsert($aListData, $iSelected, $sInput) ; Insert the new item Else _ArrayDelete($aListData, $iSelected) ; Remove the selected item EndIf $sListData = _ArrayToString($aListData) ; Create a string EndIf GUICtrlSetData($hList, "|" & $sListData) ; Update the listbox EndIf EndSwitch WEnd My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 1, 2021 Moderators Share Posted June 1, 2021 Moved to the appropriate forum, as the Developer General Discussion forum very clearly states: Quote General development and scripting discussions. Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums. Moderation Team "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now