help with create ListView + LvAdd Button Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
ibieel
Posts: 216
Joined: 17 Oct 2021, 23:30

help with create ListView + LvAdd Button

Post by ibieel » 20 Sep 2022, 22:26

hey guys, I never made a ListView, I read the documentation but I don't understand the technical terms, could someone help me to assemble one?

I wanted to add data to the list and know how to read the data from that list

Can anyone make the add data to list view?
or give me tips on how to do it efficiently?

my GUI code is below. Thank you for your help
(is the code right? what can i improve?)
image.png
image.png (38.88 KiB) Viewed 752 times

Code: Select all

#SingleInstance, Force
Gui, Color, 390202
Gui, Font, cWhite
Gui, Margin, 10, 10
Gui, +AlwaysOnTop

Gui, Add, Button, x280 y50 w150 h30 gAddStep, Add Step

Gui, Add, Tab, x2 y1 w790 h760 , Tab1|Tab2
Gui, Add, Text, x22 y39 w200 h20 +Center, Configure os Passos:
Gui, Add, Text, x22 y69 w110 h20 , Selecione uma opcao:
Gui, Add, DropDownList, x132 y69 w100 h20 vDropDownList_Action Choose1, Click Map
Gui, Add, GroupBox, x22 y99 w570 h110 , Escolha a marca do Mini Mapa que voce quer andar:
Gui, Add, Radio, x32 y119 w30 h20 vMark1, 1
GuiControl,, Mark1, 1
Gui, Add, Radio, x82 y119 w30 h20 vMark2, 2
Gui, Add, Radio, x132 y119 w30 h20 vMark3, 3
Gui, Add, Radio, x182 y119 w30 h20 vMark4, 4
Gui, Add, Radio, x232 y119 w30 h20 vMark5, 5
Gui, Add, Radio, x282 y119 w30 h20 vMark6, 6
Gui, Add, Radio, x332 y119 w30 h20 vMark7, 7
Gui, Add, Radio, x382 y119 w30 h20 vMark8, 8
Gui, Add, Radio, x432 y119 w30 h20 vMark9, 9
Gui, Add, Radio, x482 y119 w33 h20 vMark10, 10

Gui, Add, GroupBox, x22 y229 w580 h480 , Configuracao Atual:
Gui, Add, ListView, x27 y249 r20 w570 h455, Step|Action


; Generated using SmartGUI Creator 4.0
Gui, Show, x280 y86 h773 w806, New GUI Window
Step := 0
Return


AddStep:
	Step++
	GuiControlGet, DropDownList_Action
	LV_Add("", Step,DropDownList_Action)
RETURN

GuiClose:
ExitApp



User avatar
neovis
Posts: 34
Joined: 12 Jun 2022, 03:56
Location: Republic of Korea
Contact:

Re: help with create ListView + LvAdd Button  Topic is solved

Post by neovis » 21 Sep 2022, 02:47

Here is a simple example.

https://www.autohotkey.com/docs/commands/GuiControls.htm#DropDownList
https://www.autohotkey.com/docs/commands/GuiControls.htm#Radio

Code: Select all

Gui Add, DDL, vddl, Apple||Line|Orange
Gui Add, Radio, Checked vradio, A
Gui Add, Radio, x+m, B
Gui Add, Radio, x+m, C
Gui Add, Button, xm w80 gaddItem, Add
Gui Add, ListView,, DropDownList|Radio
Gui Show
return

addItem:
Gui Submit, NoHide
LV_Add("", ddl, radio)
return

User avatar
ibieel
Posts: 216
Joined: 17 Oct 2021, 23:30

Re: help with create ListView + LvAdd Button

Post by ibieel » 21 Sep 2022, 13:14

neovis wrote:
21 Sep 2022, 02:47
Here is a simple example.

https://www.autohotkey.com/docs/commands/GuiControls.htm#DropDownList
https://www.autohotkey.com/docs/commands/GuiControls.htm#Radio

Code: Select all

Gui Add, DDL, vddl, Apple||Line|Orange
Gui Add, Radio, Checked vradio, A
Gui Add, Radio, x+m, B
Gui Add, Radio, x+m, C
Gui Add, Button, xm w80 gaddItem, Add
Gui Add, ListView,, DropDownList|Radio
Gui Show
return

addItem:
Gui Submit, NoHide
LV_Add("", ddl, radio)
return
could you give me examples of how to use "LV_GetNext" ?
I didn't understand very well how it works from the documentation

another question, is there a way to make a certain line of the ListView be in FOCUS/SELECTED without the user having clicked on it?

garry
Posts: 3795
Joined: 22 Dec 2013, 12:50

Re: help with create ListView + LvAdd Button

Post by garry » 21 Sep 2022, 15:00

@neovis thank you for the solution
another question, is there a way to make a certain line of the ListView be in FOCUS/SELECTED without the user having clicked on it?
LV_Modify(3, "+Select +Focus") ;- or use check

here I tried to make a > Listview with CSV-file : PRINT ADD DELETE MODIFY SEARCH

Code: Select all

;-------- 星期三 九月 2022-09-21  21:01 UTC --------------
;-
;- MODIFIED =
;- CREATED  = 20220921
;- FILE     = Listview: PRINT ADD DELETE MODIFY SEARCH
;-----------------------------------------------------
#Warn
#NoEnv
#SingleInstance force
Setworkingdir,%a_scriptdir%
SetBatchLines, -1
;--
SplitPath,a_scriptname, name, dir, ext, name_no_ext, drive
mainwindowtitle:=name_no_ext                           ;-- GUI-NAME
F1:= a_scriptdir . "\" . mainwindowtitle . ".txt"      ;-- CSV-file
dlm:=";"                                               ;-- DELIMITER
gosub,CreateTestFile
;--
Gui,1:Color,Black,Black
Gui,1:Font,S12 CYellow,Lucida Console
color=D4D0C8          ;- grayxxx
Gui,add,text  ,x30  y10                , Use rightclick for MODIFY or DELETE
Gui, Add, ListView, background%color% cBlack grid x30 y45 w600 h560 vMLV1 gLVGO +altsubmit, Name|Fullpath
Gui, Add, Edit,x30  y625 w200 h27 -vscroll hWndHED1 vSRCH gSearch
SendMessage 0x1501, 1, "SEARCH Here",, ahk_id %hed1%
Gui, Add, Edit,x240 y625 w70  h27 -vscroll vTotal1 right
Gui,add,button,x400 y625 w100 h27 gADD  , ADD_NEW
Gui,add,button,x520 y625 w90  h27 gPrint, PRINT
LV_ModifyCol(1,570),LV_ModifyCol(2,0)
Gui, Show,x100 y100 w650 h680,%mainwindowtitle%
;--------- if rightclick Listview Row ------------
Menu, CMenu, Add, 
Menu, CMenu, Add, MODIFY         , menuDo
Menu, CMenu, Add, 
Menu, CMenu, Add, 
Menu, CMenu, Add, DELETE         , menuDo
Menu, CMenu, Add, 
;----
Fill:
Gui,1:default
LV_Delete()
i:=0
GuiControl, -Redraw, MLV1
Fileread,var, *P65001 %f1%
for x,y in strsplit(var,"`n","`r")
	{
    if Y=
      continue
	row := []
	loop, parse, y,%dlm%
		row.push(a_loopfield)
	i++  
	LV_add("",row*)	
	}
GuiControl, +Redraw, MLV1
Guicontrol,1:,total1,%i%
GuiControl,1:Focus,srch
Return
;=======================================
;-
;-----------------------------------
GuiClose:
ExitApp
;-----------------------------------
;-
;------------- MENU when rightclick on row ----------
menux:
if (rn=0)
  return
MouseGetPos, musX, musY
Menu, CMenu, Show, %musX%,%musY%
return
;------------------------
menudo:
If (A_ThisMenuItem = "DELETE")
   gosub,DELETEx                 
If (A_ThisMenuItem = "MODIFY")
   gosub,MODIFYx                 
return
;============= END MENU ================
;-
;============= ADD_NEW =================
ADD:
Gui,1:submit,nohide
Gui,2:Font,S12 cBlack,Lucida Console
Gui,2:Add,Text,   x1   y5  w80          , NAME
Gui,2:Add,Edit,   x80  y5  w500 h27 vA21,
Gui,2:Add,Text,   x1   y50 w80          , URL1
Gui,2:Add,Edit,   x80  y50 w500 h27 vA22,
Gui,2:Add, Button,x550 y90 w50  h27, OK
Gui,2:Show, x2 y385 w620 h130, URL-INPUT
GuiControl,2:Focus,A21
return
;---------------------------------------
2GuiClose:
2GuiEscape:
Gui,2: Destroy
return
;--------------
2ButtonOK:
Gui,2:submit,nohide
if A21=
  {
  Gui,2: Destroy
  return
  }
FILEAPPEND, %A21%%dlm%%A22%`r`n,%F1%,utf-8
Gui,2: Destroy
GoSub,Fill         ;- update LV
return
;=============== END ADD_NEW ================
;-
;=============== DELETE =====================
Deletex:
Gui,1:ListView,MLV1
cxx:="",RowNumber:=0,DeleteArray := []
Loop
 {
 RowNumber := LV_GetNext(RowNumber)
 if not RowNumber
   Break
 LV_GetText(cx1,rownumber)
 cxx .= cx1 . "`n"
 DeleteArray[RowNumber] := "DEL"
 }
msgbox, 262180,TEST ,Want you really DELETE ?`n%cxx% 
ifmsgbox,NO
  {
  for index, in DeleteArray
     LV_Modify(index, "-Select -Focus")
  GuiControl,1:Focus,srch
  return
  }
;--------
cxx=
GuiControl, -Redraw, MLV1
for index, in DeleteArray
  LV_Delete(index-A_Index+1)
GuiControl, +Redraw, MLV1
;---
listx=
ControlGet, Listx, List, , SysListView321,%mainwindowtitle%
stringreplace,listx,listx,`t,%dlm%,all
Filedelete,%f1%
fileappend,%listx%`r`n,%f1%,utf-8
listx:=""
GuiControl,1:Focus,srch
Return
;============= END DELETE ==================
;-
;============= MODIFY ======================
MODIFYx:
Gui,1:submit,nohide
Gui,1:ListView,MLV1
Gui,3:Font,S12 cBlack,Lucida Console
Gui,3:Add,Text,   x1   y5  w80          , NAME
Gui,3:Add,Edit,   x80  y5  w500 h27 vA31,%C1%
Gui,3:Add,Text,   x1   y50 w80          , URL1
Gui,3:Add,Edit,   x80  y50 w500 h27 vA32,%C2%
Gui,3:Add, Button,x550 y90 w50  h27, OK
Gui,3:Show, x2 y385 w620 h130, URL-INPUT
GuiControl,3:Focus,A31
return
;---------------------------------------
3GuiClose:
3GuiEscape:
Gui,3: Destroy
return
;--------------
3ButtonOK:
Gui,3:submit,nohide
FileRead,Filecontent,  *P65001 %f1%
FileDelete, %f1%
StringReplace, FileContent, FileContent,%C1%%dlm%%C2%, %A31%%dlm%%A32%
FileAppend, %FileContent%`r`n, %f1%,UTF-8
filecontent=
Gui,3:destroy
Gosub,fill          
return
;=============== END MODIFY =================
;-
;=============== SEARCH =====================
Search:
GuiControlGet,srch
Gui,1:ListView,MLV1
GuiControl, -Redraw, MLV1
LV_Delete()
i:=0
;--
row := []
for x,y in strsplit(var,"`n","`r")
	{
   	if y=
       continue
    h:=StrSplit(y,dlm)
	;hr:=h[1],mn:=h[2]
    ;if (InStr(h.1,srch) or InStr(h.2,srch))  ;- search in column-1 and in column-2
	if instr(h.1,srch)
		{
		loop, parse, y, %dlm%
			row.push(a_loopfield)
        i++
		LV_add("",row*)	
		row := []
		}
	GuiControl, +Redraw, MLV1	
    Guicontrol,1:,total1,%i%
	}
;--
/*
;- search in all columns ---------
row := []
for x,y in strsplit(var,"`n","`r")
	{
	if instr(y,srch)
		{
		loop, parse, y, %dlm%
			row.push(a_loopfield)
		if y=
          continue		
        i++
		LV_add("",row*)	
		row := []
		}
    Guicontrol,1:,total1,%i%
	}
*/
;---------------------------------
GuiControl, +Redraw, MLV1
if (srch="")
  {
  sleep,200
  Guicontrol,1:,total1,%i%
  }
Return
;-----------------------------------
;=============== END SEARCH =================

;-
;=============== PRINT ======================
PRINT:
fx:= a_scriptdir . "\" . mainwindowtitle . "_PRINTED.txt"
ifexist,%fx%
   filedelete,%fx%
ControlGet, Listx, List, , SysListView321,%mainwindowtitle%
stringreplace,listx,listx,`t,%dlm%,all
fileappend,%listx%`r`n,%fx%,utf-8
listx=
try
 run,%fx%
return
;================ END PRINT ================
;-
;-----------------------------------
LVGo:
Gui,1:default
Gui,1:ListView,MLV1
  RN:=LV_GetNext("C")
  if (rn=0)
    return
Row := A_EventInfo
LV_GetText(C1,row,1)
LV_GetText(C2,row,2)
C2=%C2%
;--
if A_GuiEvent = Doubleclick
  {
  try
    run,%C2%
  }
;--  
if A_GuiEvent = Rightclick
  goto,menux
return
;-------------------------------------
;=============================================
CreateTestFile:
e2=
(Ltrim C join`r`n
British_pathe;https://www.youtube.com/channel/UCGp4u0WHLsK8OAxnvwiTyhA
BBC_Archive;https://www.bbc.co.uk/archive/
LA_CAMERA_STYLO;https://www.youtube.com/channel/UCxT4JLBXafKV7dCafIceCUg/videos  ;- Film collection
Nikola Tesla Brings Light to Croatia;https://www.arte.tv/en/videos/105654-003-A/nikola-tesla-brings-light-to-croatia/
Nikola Tesla: niech stanie sie swiatlosc!;https://www.arte.tv/pl/videos/105654-003-A/nikola-tesla-niech-stanie-sie-swiatlosc/
News_Portugal;https://news.google.com/topstories?hl=pt-PT&gl=PT&ceid=PT:pt-150
Weather_Portugal;https://www.timeanddate.com/weather/portugal/lisbon
Calypso 我爱卡拉苏 - Grace Chang ( 葛蘭 - Ge Lan );https://www.youtube.com/watch?v=bi4f2E_1or4

)
ifnotexist,%F1%
  fileappend,%e2%,%F1%,utf-8
e2=  
return  
;=========== END SCRIPT =====================================================================================================

User avatar
ibieel
Posts: 216
Joined: 17 Oct 2021, 23:30

Re: help with create ListView + LvAdd Button

Post by ibieel » 21 Sep 2022, 22:02

garry wrote:
21 Sep 2022, 15:00
@neovis thank you for the solution
another question, is there a way to make a certain line of the ListView be in FOCUS/SELECTED without the user having clicked on it?
LV_Modify(3, "+Select +Focus") ;- or use check

here I tried to make a > Listview with CSV-file : PRINT ADD DELETE MODIFY SEARCH

Code: Select all

;-------- 星期三 九月 2022-09-21  21:01 UTC --------------
;-
;- MODIFIED =
;- CREATED  = 20220921
;- FILE     = Listview: PRINT ADD DELETE MODIFY SEARCH
;-----------------------------------------------------
#Warn
#NoEnv
#SingleInstance force
Setworkingdir,%a_scriptdir%
SetBatchLines, -1
;--
SplitPath,a_scriptname, name, dir, ext, name_no_ext, drive
mainwindowtitle:=name_no_ext                           ;-- GUI-NAME
F1:= a_scriptdir . "\" . mainwindowtitle . ".txt"      ;-- CSV-file
dlm:=";"                                               ;-- DELIMITER
gosub,CreateTestFile
;--
Gui,1:Color,Black,Black
Gui,1:Font,S12 CYellow,Lucida Console
color=D4D0C8          ;- grayxxx
Gui,add,text  ,x30  y10                , Use rightclick for MODIFY or DELETE
Gui, Add, ListView, background%color% cBlack grid x30 y45 w600 h560 vMLV1 gLVGO +altsubmit, Name|Fullpath
Gui, Add, Edit,x30  y625 w200 h27 -vscroll hWndHED1 vSRCH gSearch
SendMessage 0x1501, 1, "SEARCH Here",, ahk_id %hed1%
Gui, Add, Edit,x240 y625 w70  h27 -vscroll vTotal1 right
Gui,add,button,x400 y625 w100 h27 gADD  , ADD_NEW
Gui,add,button,x520 y625 w90  h27 gPrint, PRINT
LV_ModifyCol(1,570),LV_ModifyCol(2,0)
Gui, Show,x100 y100 w650 h680,%mainwindowtitle%
;--------- if rightclick Listview Row ------------
Menu, CMenu, Add, 
Menu, CMenu, Add, MODIFY         , menuDo
Menu, CMenu, Add, 
Menu, CMenu, Add, 
Menu, CMenu, Add, DELETE         , menuDo
Menu, CMenu, Add, 
;----
Fill:
Gui,1:default
LV_Delete()
i:=0
GuiControl, -Redraw, MLV1
Fileread,var, *P65001 %f1%
for x,y in strsplit(var,"`n","`r")
	{
    if Y=
      continue
	row := []
	loop, parse, y,%dlm%
		row.push(a_loopfield)
	i++  
	LV_add("",row*)	
	}
GuiControl, +Redraw, MLV1
Guicontrol,1:,total1,%i%
GuiControl,1:Focus,srch
Return
;=======================================
;-
;-----------------------------------
GuiClose:
ExitApp
;-----------------------------------
;-
;------------- MENU when rightclick on row ----------
menux:
if (rn=0)
  return
MouseGetPos, musX, musY
Menu, CMenu, Show, %musX%,%musY%
return
;------------------------
menudo:
If (A_ThisMenuItem = "DELETE")
   gosub,DELETEx                 
If (A_ThisMenuItem = "MODIFY")
   gosub,MODIFYx                 
return
;============= END MENU ================
;-
;============= ADD_NEW =================
ADD:
Gui,1:submit,nohide
Gui,2:Font,S12 cBlack,Lucida Console
Gui,2:Add,Text,   x1   y5  w80          , NAME
Gui,2:Add,Edit,   x80  y5  w500 h27 vA21,
Gui,2:Add,Text,   x1   y50 w80          , URL1
Gui,2:Add,Edit,   x80  y50 w500 h27 vA22,
Gui,2:Add, Button,x550 y90 w50  h27, OK
Gui,2:Show, x2 y385 w620 h130, URL-INPUT
GuiControl,2:Focus,A21
return
;---------------------------------------
2GuiClose:
2GuiEscape:
Gui,2: Destroy
return
;--------------
2ButtonOK:
Gui,2:submit,nohide
if A21=
  {
  Gui,2: Destroy
  return
  }
FILEAPPEND, %A21%%dlm%%A22%`r`n,%F1%,utf-8
Gui,2: Destroy
GoSub,Fill         ;- update LV
return
;=============== END ADD_NEW ================
;-
;=============== DELETE =====================
Deletex:
Gui,1:ListView,MLV1
cxx:="",RowNumber:=0,DeleteArray := []
Loop
 {
 RowNumber := LV_GetNext(RowNumber)
 if not RowNumber
   Break
 LV_GetText(cx1,rownumber)
 cxx .= cx1 . "`n"
 DeleteArray[RowNumber] := "DEL"
 }
msgbox, 262180,TEST ,Want you really DELETE ?`n%cxx% 
ifmsgbox,NO
  {
  for index, in DeleteArray
     LV_Modify(index, "-Select -Focus")
  GuiControl,1:Focus,srch
  return
  }
;--------
cxx=
GuiControl, -Redraw, MLV1
for index, in DeleteArray
  LV_Delete(index-A_Index+1)
GuiControl, +Redraw, MLV1
;---
listx=
ControlGet, Listx, List, , SysListView321,%mainwindowtitle%
stringreplace,listx,listx,`t,%dlm%,all
Filedelete,%f1%
fileappend,%listx%`r`n,%f1%,utf-8
listx:=""
GuiControl,1:Focus,srch
Return
;============= END DELETE ==================
;-
;============= MODIFY ======================
MODIFYx:
Gui,1:submit,nohide
Gui,1:ListView,MLV1
Gui,3:Font,S12 cBlack,Lucida Console
Gui,3:Add,Text,   x1   y5  w80          , NAME
Gui,3:Add,Edit,   x80  y5  w500 h27 vA31,%C1%
Gui,3:Add,Text,   x1   y50 w80          , URL1
Gui,3:Add,Edit,   x80  y50 w500 h27 vA32,%C2%
Gui,3:Add, Button,x550 y90 w50  h27, OK
Gui,3:Show, x2 y385 w620 h130, URL-INPUT
GuiControl,3:Focus,A31
return
;---------------------------------------
3GuiClose:
3GuiEscape:
Gui,3: Destroy
return
;--------------
3ButtonOK:
Gui,3:submit,nohide
FileRead,Filecontent,  *P65001 %f1%
FileDelete, %f1%
StringReplace, FileContent, FileContent,%C1%%dlm%%C2%, %A31%%dlm%%A32%
FileAppend, %FileContent%`r`n, %f1%,UTF-8
filecontent=
Gui,3:destroy
Gosub,fill          
return
;=============== END MODIFY =================
;-
;=============== SEARCH =====================
Search:
GuiControlGet,srch
Gui,1:ListView,MLV1
GuiControl, -Redraw, MLV1
LV_Delete()
i:=0
;--
row := []
for x,y in strsplit(var,"`n","`r")
	{
   	if y=
       continue
    h:=StrSplit(y,dlm)
	;hr:=h[1],mn:=h[2]
    ;if (InStr(h.1,srch) or InStr(h.2,srch))  ;- search in column-1 and in column-2
	if instr(h.1,srch)
		{
		loop, parse, y, %dlm%
			row.push(a_loopfield)
        i++
		LV_add("",row*)	
		row := []
		}
	GuiControl, +Redraw, MLV1	
    Guicontrol,1:,total1,%i%
	}
;--
/*
;- search in all columns ---------
row := []
for x,y in strsplit(var,"`n","`r")
	{
	if instr(y,srch)
		{
		loop, parse, y, %dlm%
			row.push(a_loopfield)
		if y=
          continue		
        i++
		LV_add("",row*)	
		row := []
		}
    Guicontrol,1:,total1,%i%
	}
*/
;---------------------------------
GuiControl, +Redraw, MLV1
if (srch="")
  {
  sleep,200
  Guicontrol,1:,total1,%i%
  }
Return
;-----------------------------------
;=============== END SEARCH =================

;-
;=============== PRINT ======================
PRINT:
fx:= a_scriptdir . "\" . mainwindowtitle . "_PRINTED.txt"
ifexist,%fx%
   filedelete,%fx%
ControlGet, Listx, List, , SysListView321,%mainwindowtitle%
stringreplace,listx,listx,`t,%dlm%,all
fileappend,%listx%`r`n,%fx%,utf-8
listx=
try
 run,%fx%
return
;================ END PRINT ================
;-
;-----------------------------------
LVGo:
Gui,1:default
Gui,1:ListView,MLV1
  RN:=LV_GetNext("C")
  if (rn=0)
    return
Row := A_EventInfo
LV_GetText(C1,row,1)
LV_GetText(C2,row,2)
C2=%C2%
;--
if A_GuiEvent = Doubleclick
  {
  try
    run,%C2%
  }
;--  
if A_GuiEvent = Rightclick
  goto,menux
return
;-------------------------------------
;=============================================
CreateTestFile:
e2=
(Ltrim C join`r`n
British_pathe;https://www.youtube.com/channel/UCGp4u0WHLsK8OAxnvwiTyhA
BBC_Archive;https://www.bbc.co.uk/archive/
LA_CAMERA_STYLO;https://www.youtube.com/channel/UCxT4JLBXafKV7dCafIceCUg/videos  ;- Film collection
Nikola Tesla Brings Light to Croatia;https://www.arte.tv/en/videos/105654-003-A/nikola-tesla-brings-light-to-croatia/
Nikola Tesla: niech stanie sie swiatlosc!;https://www.arte.tv/pl/videos/105654-003-A/nikola-tesla-niech-stanie-sie-swiatlosc/
News_Portugal;https://news.google.com/topstories?hl=pt-PT&gl=PT&ceid=PT:pt-150
Weather_Portugal;https://www.timeanddate.com/weather/portugal/lisbon
Calypso 我爱卡拉苏 - Grace Chang ( 葛蘭 - Ge Lan );https://www.youtube.com/watch?v=bi4f2E_1or4

)
ifnotexist,%F1%
  fileappend,%e2%,%F1%,utf-8
e2=  
return  
;=========== END SCRIPT =====================================================================================================

the code below i can use to store the data of any list?

Code: Select all

ControlGet, Listx, List, , SysListView321, %mainwindowtitle%
I didn't quite understand how it works.
what is "SysListView321"?
I removed the last parameter and it still worked, is it necessary?

garry
Posts: 3795
Joined: 22 Dec 2013, 12:50

Re: help with create ListView + LvAdd Button

Post by garry » 22 Sep 2022, 09:32

EDIT: note, print only needed if use the 'search' function, otherwise only > run, notepad "%f1%"

Code: Select all

F1:= a_scriptdir . "\test.csv"                                 ;- your existing csv-file or text-file  ( aaa;bbb  ) / this script example has only 2 columns
                                                               ;- also possible to select a file with  > listbox / drag&drop / treeview ... / doubleclick on row to RUN column-2
dlm:=";"                                                       ;- define the delimiter from file F1 
mainwindowtitle :="MyLV_test"                                  ;- rename it what you want  

;- print listview example :
;=============== PRINT ======================
PRINT:
fx:= a_scriptdir . "\" . mainwindowtitle . "_PRINTED.txt"
ifexist,%fx%
   filedelete,%fx%
ControlGet, Listx, List, , SysListView321,%mainwindowtitle%    ;- in listx is the content from listview / %mainwindowtitle% is the right name from GUI ( if wrong  not works )
                                                               ;- for a second listview use > SysListView322
stringreplace,listx,listx,`t,%dlm%,all                         ;- replace listview's TAB with delimiter ( here > ";" )
fileappend,%listx%`r`n,%fx%,utf-8                              ;- write it to file 
listx=
try
 run,%fx%
return
;================ END PRINT ================

Post Reply

Return to “Ask for Help (v1)”