in reply to Re^2: Gui Automation using guitest
in thread Gui Automation using guitest

A few lines below spy-- there is spy, which can dive deeper into the window. Please do look at it.

Replies are listed 'Best First'.
Re^4: Gui Automation using guitest
by shayak (Acolyte) on Feb 10, 2011 at 09:42 UTC
    Could not find anything to do with objects in a window in the spy program..

      The program says:

      # Parse a subtree of the whole windoing systme and print as much i +nformation as possible # about each window and each object.

      So, if it "is not working for you", maybe you need to learn about how a window and its controls are structured in Windows, or at least tell us how it fails to dump the structure of a window for you?

Re^9: Gui Automation using guitest
by shayak (Acolyte) on Feb 10, 2011 at 11:10 UTC
    Yeah, i got the output. Actually where i was trying a module was not installed so it was not working.. IT works fine now.. Thank you.. But it shows what all the window contains. Now if i have to go to a particular object i will need its control id or handle of that object.. How do i get that. any help??

      I think now is a good time to learn about Windows and how window handles work in Windows. This topic is not Perl specific.

      You can look at the output and code of spy.pl, and see what information it gets from where, and you can compare that with your target application. In the end, you will need to learn yourself, instead of asking for step-by-step help here. I presume that "Programming Windows" by Charles Petzold, even if old, is still a good introduction to how windows work. Especially, as I remember that it does not use any fancy object oriented wrapper to the Windows API but creates windows and widgets directly. You have to learn that to go the route backwards and understand the data you get from Win32::GuiTest and what it can be used for.

      If you didn't have the module installed you'd have received an error message telling you that Perl couldn't find it, which isn't 'nothing' as you said your program returned. Why didn't you mention this before? If you want help to learn you need to put some effort into asking questions. Failure to do so is a waste of peoples time.

      I suggest you spend time working through Win32::GuiTest::Examples, learning how it works. You seem to be lacking understanding of the underlying concepts involved in what you're trying to do. A forum isn't ideal for drip feeding these concepts to someone. Read and understand Using Win32::GuiTest.

        No actually i didnt get an error message. The program was not executing only.. Actually i was doing this in a vm. I tried it in my host machine and it worked. Then on checking i realized i didnt have a module installed in the vm. I understood my problem and have already started working on it.. Thank you for ur help.
Re^5: Gui Automation using guitest
by shayak (Acolyte) on Feb 10, 2011 at 10:05 UTC
    Well in that code can you show me where exactly is the snippet written to tackle the objects? Im not understanding it..

      Did you run spy.pl? What did it output?

Re^7: Gui Automation using guitest
by shayak (Acolyte) on Feb 10, 2011 at 10:20 UTC
    Nothing. When i tried to run it nothing happened..

      I find this hard to believe, even running spl.pl with no arguments outputs something:

      C:\>perl spy.pl Version: v0.02 Usage: spy.pl --help spy.pl --all spy.pl --title TITLE As the output is quite verbose, probably you'll want to redirect the output to a file: spy.pl options > out.txt

      Run perl spy.pl --all and examine the output.

      This is highly unlikely. spy.pl will at least output usage information. Please show us how you tried to run it. So either you cannot run Perl scripts at all, or you are not telling us exactly what you did and what you got as result.

      For example, it works for me like this:

      > perl -w spy.pl --all ... ++ 459214 , 'Button ', 328230 , Rect:6 +25,465,976,772 'Energiestand' ... ++ 2164734 , 'EXCEL; ', 2426442 , Rect:- +1 ,69 ,168,86 '' +++ 2230202 , 'ComboBox ', 2164734 , Rect:- +1 ,66 ,113,88 ''

      So, it clearly has access to windows and elements within windows, like a ComboBox. Maybe you really should learn how Windows structures application windows and its contents?