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