Guest Posted December 20, 2013 Share Posted December 20, 2013 I have a script that works fine in Windows XP. The script creates a Word doc, and moves back and forth between two apps, clicking, collecting a screen shot, and pasting that into Word. To do this, it uses WinActivate and WinWaitActive to bring focus to the app that the mouse clicks occur in. In WinXP the focus snaps to the target app using WinActivate, but in Windows 7 it does not. Focus stays on the Word doc but the script keeps running, selectively executing only those bits of code that apply to the Word doc. The order of events in XP is: create Word doc, activate other app, mouse clicks, printscreen, activate Word, paste, activate other app, mouseclicks, printscreen, activate Word, paste, etc. The order of events in 7: create Word doc, focus stays on Word, time passes greater than the delays built into the mouseclicks but the cursor is not moving, whatever happens to be on the Windows clipboard is pasted into the Word doc, time passes while the cursor is not moving, whatever happens to be on the Windows clipboard is pasted into the Word doc and it's the same content as the first paste, etc This is weird. The script does not stall when the WinActivate command fails. What is going on? How do I get WinActivate to work in Win7? Link to comment Share on other sites More sharing options...
martin Posted December 20, 2013 Share Posted December 20, 2013 Are you using the window title or its handle? Maybe the Title isn't quite the same in W7 as XP, or mabe your method of getting the handle doesn't work in W7. You haven't given us much to go on yet. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Kovacic Posted December 20, 2013 Share Posted December 20, 2013 I have a script that works fine in Windows XP. The script creates a Word doc, and moves back and forth between two apps, clicking, collecting a screen shot, and pasting that into Word. To do this, it uses WinActivate and WinWaitActive to bring focus to the app that the mouse clicks occur in. In WinXP the focus snaps to the target app using WinActivate, but in Windows 7 it does not. Focus stays on the Word doc but the script keeps running, selectively executing only those bits of code that apply to the Word doc. The order of events in XP is: create Word doc, activate other app, mouse clicks, printscreen, activate Word, paste, activate other app, mouseclicks, printscreen, activate Word, paste, etc. The order of events in 7: create Word doc, focus stays on Word, time passes greater than the delays built into the mouseclicks but the cursor is not moving, whatever happens to be on the Windows clipboard is pasted into the Word doc, time passes while the cursor is not moving, whatever happens to be on the Windows clipboard is pasted into the Word doc and it's the same content as the first paste, etc This is weird. The script does not stall when the WinActivate command fails. What is going on? How do I get WinActivate to work in Win7? any chance you could show us the code you are using? C0d3 is P0etry( ͡° ͜ʖ ͡°) Link to comment Share on other sites More sharing options...
markyrocks Posted December 21, 2013 Share Posted December 21, 2013 (edited) just ran this on my windows 7 laptop....seems to work fine run("notepad.exe") winwait("[CLASS:Notepad]") Run("calc.exe") WinWait("Calculator") WinActivate("[CLASS:Notepad]") Edited December 21, 2013 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
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