Cybernorty Posted April 30, 2024 Posted April 30, 2024 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]","") and WinActivate ("Material Planning Window - [Material Planning Window]",""). Any direction appreciated. Thanks, Brooks MPR_x.au3
Andreik Posted April 30, 2024 Posted April 30, 2024 (edited) Centura:MDIFrame is the class name. Try this: Local $hMPW = WinActivate ("[CLASS:Centura:MDIFrame]") or AutoItSetOption('WinTitleMatchMode', 2) ; place this once at the beginning of the script Local $hMPW = WinActivate ("Material Planning Window") Edited April 30, 2024 by Andreik
Cybernorty Posted April 30, 2024 Author Posted April 30, 2024 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
Andreik Posted April 30, 2024 Posted April 30, 2024 Use WinList() to list all windows and try to find yours.
Cybernorty Posted May 2, 2024 Author Posted May 2, 2024 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})?
Andreik Posted May 2, 2024 Posted May 2, 2024 (edited) Post the script involving wordpad that fails if VM is not open. Also have a look at SendKeepActive(). Edited May 2, 2024 by Andreik
Cybernorty Posted May 3, 2024 Author Posted May 3, 2024 #include <Date.au3> #include <MsgBoxConstants.au3> Local $hSleep = 5000 Sleep($hSleep) RUN ("Write.exe") Sleep($hSleep) Send ("{PRINTSCREEN}") Sleep($hSleep) Send ("^v")
Andreik Posted May 3, 2024 Posted May 3, 2024 The code above run just fine. You might have some application that steal the focus of you window. Try this and let me know if it works: Run("write.exe") WinWait('[CLASS:WordPadClass]') Send ("{PRINTSCREEN}") SendKeepActive('[CLASS:WordPadClass]') Send ("^v") SendKeepActive('')
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now