Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: How to continue running script if .exe program fails

by dasgar (Deacon)
on Sep 13, 2013 at 21:30 UTC ( #1054017=note: print w/ replies, xml ) Need Help??


in reply to How to continue running script if .exe program fails

I'm assuming that the reference to "an .exe program" and your description of what I call a pop up window would indicate that you're on a Windows system. Is that correct?

If so, the answer to your question is yes. Here's how I would approach this task:

  • start a new thread that will do the task of calling the .exe program
  • have a while loop checking to see if the thread is joinable
    • check to see if the pop up window exists
    • if the pop up window exists, automate the response
  • join the thread
  • repeat the above steps for any subsequent .exe calls

For the window automation, you can use Win32::GuiTest. It will have functions that will help you find the pop window and to interact with it (mouse clicks, keystrokes). My recommendation would be to use keystrokes rather than mouse clicks with the Win32::GuiTest stuff.

Another alternative to the Win32::GuiTest would be to use AutoIt. In that case, you would create an AutoIt script and then either call that script from your Perl code or make your AutoIt script an .exe program and call that from your Perl code.

Personally, I would recommend sticking with Win32::GuiTest rather than using AutoIt. However, you might find it useful to get AutoIt for its AutoIt Window Info Tool, which can be used to get information about the windows that you are trying to automate.


Comment on Re: How to continue running script if .exe program fails

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1054017]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (12)
As of 2014-09-02 13:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite cookbook is:










    Results (22 votes), past polls