Jump to content

Recommended Posts

Posted (edited)

Hi All,

I need to select each subchild from tree view & Click Ok button.

So i implemented logic by using _GUICtrlTreeView.GetFirstChild() & _GUICtrlTreeView.GetNextChild() methods & used looping statements

the logic works correctly for only selecting item but when i inserted code of clicking ok button then the window disappears i invoked the vindow before ending of loop But while when the loop starts again it doesnot expand the items & unable to select item.

i used _GUICtrlTreeView_GetItemText() method for checking item handle of items to expand but it returns blank.

Please find below snippet of my code & screenshot.

send("{ALT}")

Send("{T}")

Send("{ENTER}")

_WinWaitActivate("CustomTest","")

$hTreeView=ControlGetHandle("CustomTest","","[CLASS:SysTreeView32; INSTANCE:1]")

$hADDButton=ControlGetHandle("CustomTest","","[CLASS:Button; CLASSNN:Button5; TEXT:Add ->; INSTANCE:5]")

$hOKButton=ControlGetHandle("CustomTest","","[CLASS:Button; CLASSNN:Button2; TEXT:OK; INSTANCE:2]")

_RemovePreviousTests()

$htmp_item=_GUICtrlTreeView_GetFirstItem($hTreeView)

$Childcount=_GUICtrlTreeView_GetSiblingCount($hTreeView,$htmp_item)

$k=1

While $k<=$Childcount

if $k=1 Then

$htmp_item=_GUICtrlTreeView_GetFirstItem($hTreeView)

$SubChildCount=_GUICtrlTreeView_GetChildCount($hTreeView,$htmp_item)

Else

$htmp_item=_GUICtrlTreeView_GetNextSibling($hTreeView,$htmp_item)

$SubChildCount=_GUICtrlTreeView_GetChildCount($hTreeView,$htmp_item)

if $htmp_item=0 Then

ExitLoop

EndIf

EndIf

$j=1

While $j<=$SubChildCount

if $j=1 Then

$Temp1=_GUICtrlTreeView_GetFirstChild($hTreeView,$htmp_item)

$Tests=_GUICtrlTreeView_GetChildCount($hTreeView,$Temp1)

Else

$Temp1=_GUICtrlTreeView_GetNextChild($hTreeView,$Temp1)

$Tests=_GUICtrlTreeView_GetChildCount($hTreeView,$Temp1)

EndIf

$i=1

While $i<=$Tests

_GUICtrlTreeView_Expand($hTreeView)

Sleep(5000)

if $i=1 Then

$hwItem=_GUICtrlTreeView_GetFirstChild($hTreeView,$Temp1)

_GUICtrlTreeView_ClickItem($hTreeView,$hwItem)

_GUICtrlButton_Click($hADDButton)

Sleep(2000)

_SelectTest()

_GUICtrlButton_Click($hOKButton)

Sleep(2000)

_SaveFile($i)

Send("{ALT}")

Send("{T}")

Send("{ENTER}")

_WinWaitActivate("CustomTest","")

_RemovePreviousTests()

Else

$hwItem=_GUICtrlTreeView_GetNextChild($hTreeView,$hwItem)

_GUICtrlTreeView_ClickItem($hTreeView,$hwItem)

_GUICtrlButton_Click($hADDButton)

Sleep(1000)

_SelectTest()

_GUICtrlButton_Click($hOKButton)

Sleep(1000)

_SaveFile($i)

Sleep(1000)

MsgBox(1,"Test","Hi")

Send("{ALT}")

Send("{T}")

Send("{ENTER}")

_WinWaitActivate("CustomTest","")

_RemovePreviousTests()

EndIf

$i=$i+1

WEnd

$j=$j+1

WEnd

$k=$k+1

WEnd

Please let me know if any one have suggestions for me.

Thanks,

Mayur

Edited by Mayur
Posted

Hi All,

I need to select each subchild from tree view & Click Ok button.

So i implemented logic by using _GUICtrlTreeView.GetFirstChild() & _GUICtrlTreeView.GetNextChild() methods & used looping statements

the logic works correctly for only selecting item but when i inserted code of clicking ok button then the window disappears i invoked the vindow before ending of loop But while when the loop starts again it doesnot expand the items & unable to select item.

i used _GUICtrlTreeView_GetItemText() method for checking item handle of items to expand but it returns blank.

Please find below snippet of my code & screenshot.

send("{ALT}")

Send("{T}")

Send("{ENTER}")

_WinWaitActivate("CustomTest","")

$hTreeView=ControlGetHandle("CustomTest","","[CLASS:SysTreeView32; INSTANCE:1]")

$hADDButton=ControlGetHandle("CustomTest","","[CLASS:Button; CLASSNN:Button5; TEXT:Add ->; INSTANCE:5]")

$hOKButton=ControlGetHandle("CustomTest","","[CLASS:Button; CLASSNN:Button2; TEXT:OK; INSTANCE:2]")

_RemovePreviousTests()

$htmp_item=_GUICtrlTreeView_GetFirstItem($hTreeView)

$Childcount=_GUICtrlTreeView_GetSiblingCount($hTreeView,$htmp_item)

$k=1

While $k<=$Childcount

if $k=1 Then

$htmp_item=_GUICtrlTreeView_GetFirstItem($hTreeView)

$SubChildCount=_GUICtrlTreeView_GetChildCount($hTreeView,$htmp_item)

Else

$htmp_item=_GUICtrlTreeView_GetNextSibling($hTreeView,$htmp_item)

$SubChildCount=_GUICtrlTreeView_GetChildCount($hTreeView,$htmp_item)

if $htmp_item=0 Then

ExitLoop

EndIf

EndIf

$j=1

While $j<=$SubChildCount

if $j=1 Then

$Temp1=_GUICtrlTreeView_GetFirstChild($hTreeView,$htmp_item)

$Tests=_GUICtrlTreeView_GetChildCount($hTreeView,$Temp1)

Else

$Temp1=_GUICtrlTreeView_GetNextChild($hTreeView,$Temp1)

$Tests=_GUICtrlTreeView_GetChildCount($hTreeView,$Temp1)

EndIf

$i=1

While $i<=$Tests

_GUICtrlTreeView_Expand($hTreeView)

Sleep(5000)

if $i=1 Then

$hwItem=_GUICtrlTreeView_GetFirstChild($hTreeView,$Temp1)

_GUICtrlTreeView_ClickItem($hTreeView,$hwItem)

_GUICtrlButton_Click($hADDButton)

Sleep(2000)

_SelectTest()

_GUICtrlButton_Click($hOKButton)

Sleep(2000)

_SaveFile($i)

Send("{ALT}")

Send("{T}")

Send("{ENTER}")

_WinWaitActivate("CustomTest","")

_RemovePreviousTests()

Else

$hwItem=_GUICtrlTreeView_GetNextChild($hTreeView,$hwItem)

_GUICtrlTreeView_ClickItem($hTreeView,$hwItem)

_GUICtrlButton_Click($hADDButton)

Sleep(1000)

_SelectTest()

_GUICtrlButton_Click($hOKButton)

Sleep(1000)

_SaveFile($i)

Sleep(1000)

MsgBox(1,"Test","Hi")

Send("{ALT}")

Send("{T}")

Send("{ENTER}")

_WinWaitActivate("CustomTest","")

_RemovePreviousTests()

EndIf

$i=$i+1

WEnd

$j=$j+1

WEnd

$k=$k+1

WEnd

Please let me know if any one have suggestions for me.

Thanks,

Mayur

post-55933-12662285390466_thumb.jpg

Posted

Anyone knows whats the Problem?

Hi All,

Problem Appears only when window reopens.

Please go through code & If you need any information reply.

Please try at least,i stuck at this point any input may work.

Thanks,

Mayur

Posted

Hi All,

Problem Appears only when window reopens.

Please go through code & If you need any information reply.

Please try at least,i stuck at this point any input may work.

Thanks,

Mayur

I think When window reopens previous handels doesn't work.

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
  • Recently Browsing   0 members

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