How to set a checkbox to checked state in a ListView using Autohotkey
-
26-09-2019 - |
Question
I am writing a Autohotkey script that need to 'check' and 'uncheck' checkboxes defined inside a listViewControl.
I think the way to do it is using a SendMessage to the listview (or maybe to the listview item itself?) using the LVM_SETITEMSTATE parameter but i don't know the exact format...anyone have any idea?
SendMessage, LVM_SETITEMSTATE, 1000, SysListView321
i think that 1000 means that the checkbox will be checked and 2000 means that he will be unchecked.
do i need to do a loop for each ListViewItem?
I had also tried to use the
LV_Modify(0, "+Checked")
But it doesnt seems to work also.
To emphasize the problem, I am not creating my own List View, i'm trying to manipulate the state of an exisiting application ListView.... (i'm running an installer and using the AutoHotKey script i press the next buttons on each of the screens, but in this screen i need to first select all the components and only then move to the next screen) Any AutoHotKey Experts in here?
Solution
One way of solving this issue ( a non elegant way) is :
ControlGet, List, List,, SysListView321,,,,
{
Loop, Parse, List, `n ; Rows are delimited by linefeeds (`n).
{
RowNumber := A_Index
Loop, Parse, A_LoopField, %A_Tab% ; Fields (columns) in each row are delimited by tabs (A_Tab).
{
if A_Index = 3
{
IfInString, HaystackTemp, %A_LoopField%
{
ControlSend, SysListview321, {Space}
}
}
}
ControlSend, SysListview321, {Down}
}
}
Do you know a more elegant way?