Jump to content

WinActivate doesn't work in Windows7


Guest
 Share

Recommended Posts

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

 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

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

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...