roccos34 Posted September 4, 2023 Share Posted September 4, 2023 (edited) Hi Guys, I'm not very expert in autoit, I need your help, I need to create a small script with GUI that allows me to modify a text file while still allowing line wrapping. Looking at the various codes on the forum I found one that was posted that could be useful for my purpose that I include in the post: the script will only have to modify one type of file which is the SQL Developer configuration file (this compiled script will be managed via the SCCM software catalog as the user does not have administrative rights to write to the file path). The script I found and which I managed to modify for my purpose works for inserting and deleting selected lines but I can't understand how to use the GUIListViewEx function to create a button that allows me to edit the selected line instead of just inserting and cancellation. If on this occasion you can give me some help to improve or correct errors in the script in addition to inserting the aforementioned function I would be grateful (translated with Google) #include <GUIConstantsEx.au3> #include <GUIListView.au3> #include <GUIMenu.au3> #include <Array.au3> #include <File.au3> #include <MsgBoxConstants.au3> #include <WindowsConstants.au3> #include 'Includes\GUIListViewEx.au3' #include 'Includes\_GUICtrlListView_CreateArray.au3' #include 'Includes\_GUICtrlListView_SaveTxt.au3' #include 'Includes\_GUICtrlListView_SaveTxtEx.au3' $PathFile = "C:\temp\sqldeveloper.conf" ; Simulate reading the file into an array Global $aLines = ["Line1", "Line2", "Line3"] If Not _FileReadToArray($PathFile, $aLines, 0) Then MsgBox($MB_SYSTEMMODAL, "", "There was an error reading the file. @error: " & @error) ; An error occurred reading the current script file. EndIf $hGUI = GUICreate("sqldeveloper.conf Configuration Tool", 900, 500) $cLV = GUICtrlCreateListView(" ", 10, 10, 700, 300) _GUICtrlListView_SetColumnWidth($cLV, 0, 890) $cInsert = GUICtrlCreateButton("Insert Line", 800, 10, 80, 30) $cDelete = GUICtrlCreateButton("Delete Line", 800, 50, 80, 30) $cEdit = GUICtrlCreateButton("Edit", 800, 90, 80, 30) $cSave = GUICtrlCreateButton("Save", 800,120, 80, 30) GUISetState() ; Intialise ListView $iLV_Index = _GUIListViewEx_Init($cLV) ; Insert lines _GUIListViewEx_Insert($aLines, True) ; Register required messages _GUIListViewEx_MsgRegister(True, False, False, False) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cInsert $Entry = InputBox ("Inserire la linea","prompt") _GUIListViewEx_Insert($Entry) Case $cEdit ; necessary code ? Case $cDelete _GUIListViewEx_Delete() Case $cSave $aExport = _GUICtrlListView_CreateArray($cLV, Default) ; Use | as the default delimeter. _GUICtrlListView_SaveTxtEx($aExport, $PathFile) EndSwitch WEnd SimpleEditor.au3 sqldeveloper.conf Edited September 4, 2023 by roccos34 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 4, 2023 Moderators Share Posted September 4, 2023 roccos34, Please read the forum rules - asking for help via PM is frowned upon here. But as I am now here - take a look at the _GUIListViewEx_EditItem function. That allows you to edit an item within the ListView. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
roccos34 Posted September 4, 2023 Author Share Posted September 4, 2023 I'm sorry, I hadn't read about this rule, I had already seen "_GUIListViewEx_EditItem " but I can't make it work. Okay, I'll wait for someone to reply to the post I posted in the forum. Thanks and sorry again Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 4, 2023 Moderators Share Posted September 4, 2023 roccos34, Quote but I can't make it work Show the code you tried and we will see if we can get it working. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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