Shift+ClickItem in a list object causes "index 8192 is out of bounds" error
I know this was working before but now when I try to shift+click in a list object I get
"The list view subitem's index 8192 is out of bounds."
VBScript
listObj.clickItem(2) 'Clicks the 3rd item in the list
listObj.clickItem(0) 'Clicks the 1st item in the list
call listObj.clickItem(2, skShift) 'Should shift+click the 3rd item so that items 1,2 & 3 are selected but I get this error.
The value of skShift is 8192. Why is the code using the modifier as the index?
SOLVED:
ListBoxes require only one index but ListViews require two. I was caught out because the help for clickItem is the same for both objects. The ListView object clickItem help should be modified to show two indexes.
The sample code should be:
listObj.clickItem(2) 'Clicks the 3rd item in the list
listObj.clickItem(0) 'Clicks the 1st item in the list
call listObj.clickItem(2, 0, skShift)
or
listObj.clickItem(2) 'Clicks the 3rd item in the list
listObj.clickItem(0) 'Clicks the 1st item in the list
if listObj.WndClass="ListBox" then call listObj.clickItem(2, skShift)
if listObj.WndClass="SysListView32" then call listObj.clickItem(2, 0, skShift)