Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: How can I close a Windows program called from a my Perl script?

by danren924 (Initiate)
on Jan 18, 2013 at 21:43 UTC ( #1014135=note: print w/replies, xml ) Need Help??


in reply to Re: How can I close a Windows program called from a my Perl script?
in thread How can I close a Windows program called from a my Perl script?

The program is, unfortunately, a proprietary GUI program, and not widely available. It does, however, use standard Windows GUI controls or keyboard shortcuts to close, such as "Alt-F, E" or a mouse click on the "X".

The only command line parameters are the source and destination file names.

Thanks again.
  • Comment on Re^2: How can I close a Windows program called from a my Perl script?

Replies are listed 'Best First'.
Re^3: How can I close a Windows program called from a my Perl script?
by BrowserUk (Pope) on Jan 18, 2013 at 22:52 UTC

    Then you might be able to use something like this which starts a copy of notepad aysnchronously (system 1, ...), then waits 10 seconds before sending it the Alt-F X key sequnce to close it:

    #! perl -slw use strict; use Win32::GuiTest qw[FindWindowLike SetForegroundWindow SendKeys]; system 1, q[notepad.exe]; Win32::Sleep( 10000 ); for ( FindWindowLike( undef, 'Notepad' ) ) { SetForegroundWindow( $_); SendKeys( '%fx', 5 ); }

    Note: that as coded, this will close all running copies of notepad. To be more selective, see the pod for Win32::GuiTest::FindWindowLike().


    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
    ), then waits 10 seconds before sending it the Alt-F X key sequnce to close it: #! perl -slw use strict; use Win32::GuiTest qw

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1014135]
help
Chatterbox?
[marioroy]: Thank you Lady_Aleena. I've bookmarked the page.
[1nickt]: folks, would you say that 1.0 is an integer ?
[Lady_Aleena]: 1nickt, I wouldn't, but I'm not normal.
LanX aggrees, LA isn't normal ;-P
[Lady_Aleena]: LanX, thanks bunches.
[Lady_Aleena]: Rigth now I'm ranting in my head about an old subject.
[1nickt]: Hm, that is, how to prevent Perl from turning 1.0 into 1? I feel sure this must be an faq, but am reading perlnum and not finding the answer ...
[Lady_Aleena]: 1nickt, why does it matter in this case?
[1nickt]: Hm, perhaps this? "Operators which expect an integer force the argument into the integer format."
[1nickt]: Can this be? So print

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (11)
As of 2017-05-24 18:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?