Jump to content

_GUICtrlTreeView_GetText() unable to return different value


rickywaive
 Share

Recommended Posts

Hi, I'm trying to use the GUICtrlTreeView on an application to return the text of a certain section. What I've found is that the handle returned is not changing and it returns the same text everytime. the basic script is below, am I doing something wrong? I've tried multiple functionalities within the GUICtrlTreeView and everything seems to return same thing

thanks,

Ricky

WinActivate($Main_Title)

Sleep(200)

Local $hItem[10], $i = 0

$TreeView_Ctrl = ControlGetHandle($Main_Title, "", "[CLASS:WindowsForms10.SysTreeView32.app.0.2e0c681; INSTANCE:1]")

; Go down to Accessories

while 1

Local $test = _GUICtrlTreeView_GetText($TreeView_Ctrl)

MsgBox(0, "Test", "$test= " & $test)

if ($test == "Accessories") Then

MsgBox(0, "Test", "Exiting")

ExitLoop

EndIf

MsgBox(0, "Test", "check again")

Send("{DOWN}")

Sleep(200)

$test = _GUICtrlTreeView_GetNext($TreeView_Ctrl, $hItem[$i])

$i = $i + 1

WEnd

Link to comment
Share on other sites

You are not using _GUICtrlTreeView_GetText() correctly. Add the item handle as the second parameter.

On getting the item handle, how do you expect $hItem[$i] to contain anything useful as a parameter in _GUICtrlTreeView_GetNext()? You declared the array and then never put anything in it.

:graduated:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

How can I find what the item handle is? when using the AutoIT window info tool, my handle doesn't change for the values in the treeview. I can move down, but the active text doesn't change from the original returned value. So even if I use _GUICtrlTreeView_GetText($TreeView_Ctrl)

after changing the highlighted item, the text returned is still the top level text

thanks,

ricky

Link to comment
Share on other sites

AU3Info only returns the handle of the parent control, not the items. The items have their own handles. Changing the highlighted item is irrelevant because _GUICtrlTreeView_GetText() does not use the current selection for anything. If you don't specify the item, you get the first item by default every time.

Or, keep doing it your way and we'll see how that works out for you...

:graduated:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...