Jump to content

Send and WinActivate not working with VM closed.


Recommended Posts

My script works if I have the VM open.  If the VM is closed (not logged out), the Window doesn't activate.    I've tried

WinActivate ("[Centura:MDIFrame]","")

image.thumb.png.db1fa50815017b11b9b15eff0cc7e8ab.png

 

and

WinActivate ("Material Planning Window - [Material Planning Window]","").

 

Any direction appreciated.  Thanks, Brooks

MPR_x.au3

Link to comment
Share on other sites

Thanks for your response but no joy for either.  I don't understand the difference, but with the VM open it works.  This is an older program, the .exe file is dated 8-30-2009.  Also, when view the result of 

Local $hMPW = WinActivate ("[CLASS:Centura:MDIFrame]")

$hMPW = 0

Other ideas?

Thanks,

Brooks

Link to comment
Share on other sites

Hi Andreik,

Thanks for your ideas.  Again, if the VM is open it works.  I changed tactics to work with Wordpad.  The same challenge I have with the Material Planning Window app is here also.  The current goal is to open Wordpad.  Printscreen to Clipboard.  Paste into Wordpad. If the VM RDC is open in front of me, it works as expected.  If it is closed, the Send([PRINTSCREEN}) doesn't work.  Even with no apps open, it should take a screenshot of the desktop.  But it does not.  I test this by compiling to an exe.  The script starts with a Sleep(5000).  I double click the exe then immediately close the VM RDC window.  Wait 30 seconds, then reopen the RDC to the VM.  Wordpad is open, but the PRINTSCREEN didn't function.  If I manually do the CTRL V nothing gets pasted into WordPad.  What could be causing the Windows VM to not pick up the Send([PRINTSCREEN})?  

Link to comment
Share on other sites

Posted (edited)

Post the script involving wordpad that fails if VM is not open. Also have a look at SendKeepActive().

Edited by Andreik

When the words fail... music speaks.

Link to comment
Share on other sites

#include <Date.au3>
#include <MsgBoxConstants.au3>
Local $hSleep = 5000

Sleep($hSleep)

RUN ("Write.exe")
Sleep($hSleep)
Send ("{PRINTSCREEN}")
Sleep($hSleep)
Send ("^v")

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...