Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

How to get handle of a window on desktop (this window is not created by perl code)

by ppp (Acolyte)
on Jan 13, 2015 at 05:43 UTC ( [id://1113040]=perlquestion: print w/replies, xml ) Need Help??

ppp has asked for the wisdom of the Perl Monks concerning the following question:

I am perl beginner and installed successfully Tk module for GUI. I wanna write a script which must click at any particular location on Desktop window (please note that i am not creating any new window ,i have some existing window on desktop (not created by Perl program) and that alwyays pop at the center of Desktop). I wanna click on a button on that desktop window after every 30 minutes.

So i am trying to write a script for :

(1) Either obtaining handle of a window which is not created by perl's code (and not at all related to perl, it is obatined by inserting dongle in USB port which contains a button that i wanna click by perl script after every 30 mins).

(2) Or to find any way to click at the desktop at any position(because my that window launches always at same position so if i click at any particular position after in 30 mins through my script then it should work).

Any help in achieving my task ?

I have found GetDesktopWindow() but the problem is what if i loose focus of the window which i have to click ? and how to recognize which window will be in focus.

Is there any way to keep that window in focus ? (I mean i have seen in taskmanager that the window to be clicked is running by the name "App.exe") . Is this information not enough to keep in focus the window obtained by "App.exe".

  • Comment on How to get handle of a window on desktop (this window is not created by perl code)

Replies are listed 'Best First'.
Re: How to get handle of a window on desktop (this window is not created by perl code)
by dasgar (Priest) on Jan 13, 2015 at 06:24 UTC

    What OS are you trying to do this on?

    Based on your most recent thread asking for help (What should i install to use GUI in windows 8(x64) Strawberry or Activeperl), I'm assuming that you're on Windows. In that case, the module that you want is Win32::GuiTest. This module lets you automate GUI interfaces in Windows.

    Just a few notes of caution about trying to automate GUIs in Windows:

    • You can't have this run on the system if no user is logged into local console or through remote desktop connection. In the case where no user is logged into a local console or remote desktop connection, the Windows OS does not create the GUI environment. That means you can't automate GUIs.
    • Using this through a remote desktop connection can be problematic. At times when the remote desktop connection program loses focus (i.e. you're using another applicaiton), the remote system suspends/stops the GUI environment (running applications/services continue to run). When that happens, you can't automate GUIs.

    I'm not familiar enough with the Windows OS to give you a better technical explanations of the notes above. Those are descriptions of what I personally encountered when using Win32::GuiTest as well as another automation tool to automate GUIs.

Re: How to get handle of a window on desktop (this window is not created by perl code)( gui automation)
by Anonymous Monk on Jan 13, 2015 at 08:05 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1113040]
Approved by dasgar
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (5)
As of 2024-04-19 12:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found