The actual code from my inital post is this: For $i = 1 to $tcitem[0]
$IdofSelected = GUICtrlRead($treeview)
$selText = GUICtrlRead($IdofSelected, 1)
$selText = $selText[0]
_GUICtrlTreeViewSelectItem($gui, $treeview, $tcitem[$i])
Sleep(1000)
NextWhich can be shortened to the following as the first three lines in the for loop serve no purpose for this example. (it's been updated in the intial post): For $i = 1 to $tcitem[0]
_GUICtrlTreeViewSelectItem($gui, $treeview, $tcitem[$i])
Sleep(1000)
Next The code you have there will not pause after each selection which is vital if you actually want to see the selections happening in real time. To answer your question, I want to loop through them all constantly as it's part of a larger function that isn't working correctly due to this code not working. Are you able to fix my initial code or point me in the right direction as to why it is not working correctly? Thank you for your time and intrest in this problem.