Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Windows; If (2003) MS Word or Excel are already executing?

by sflitman (Hermit)
on Jun 02, 2010 at 23:36 UTC ( #842822=note: print w/ replies, xml ) Need Help??


in reply to Windows; If (2003) MS Word or Excel are already executing?

You can programmatically close windows if you know their handles. Here are two non-tested examples.

use Win32::GuiTest qw/SendMessage/; use Win32::FindWindow; $window = find_window( basename => 'winword.exe' ); SendMessage($window->hwnd,WM_CLOSE,0,0);
OR
use Win32::CtrlGUI; my $window =Win32::CtrlGUI::wait_for_window(qr/Word/); $window->send_keys("!fx"); my $window =Win32::CtrlGUI::wait_for_window(qr/Excel/); $window->send_keys("!fx");
HTH,
SSF


Comment on Re: Windows; If (2003) MS Word or Excel are already executing?
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2014-10-21 05:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (96 votes), past polls