Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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 studying the Monastery: (2)
As of 2014-07-31 03:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (244 votes), past polls