![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| Guest | reference / manage application windows with vbscript Hi, I am trying to automate a gui application by using 'wshshell.sendkeys'. What I want to do (if possible) is load the app and wait for a window to become active in the app, then execute some 'sendkeys' commands. I have used autoit before and I know that works, but I want VBscript to do it. Is this possible?? Thanks -- Firewalker82 |
My System Specs![]() |
| | #2 (permalink) |
| Guest | Re: reference / manage application windows with vbscript Firewalker82 wrote: Quote: > What I want to do (if possible) is load the app and wait for a window to > become active in the app, then execute some 'sendkeys' commands. Yes, you can do this with vbScript, but... First off, launch your app with the shell.run method. Then use appactivate AS A FUNCTION. It will return false if your app has not appeared yet (finished loading). When the app window appears, then appactivate will return true. At that point you can start sending keys. Some apps don't accept keystrokes until a fraction of a second after they finish loading. Also some apps don't accept a "blast" of keystrokes (a long string), but rather expect the keys to come one-at-a-time, as though somebody was actually typing stuff in. And so, you sometimes have to play around with the sleep method, to get your app to accept the keystrokes you send. All that being said, appactivate and sendkeys is not very reliable. The keystrokes will go to the app with focus, and any number of apps can pop up to steal the focus away from your target app (e.g. im, av updates, and any number of other things). So it will frequently happen that your keystrokes will land on some other focus-stealing app, with undesired, unfortunate or even disastrous consequences. cheers, jw ____________________________________________________________ You got questions? WE GOT ANSWERS!!! ..(but, no guarantee the answers will be applicable to the questions) |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Can vbscript capture Word.Application events ? | VB Script | |||
| Application keeps sending request to disable Desktop Window Manage | Vista General | |||
| Article: How To Manage Windows Vista Application Compatibility | Vista General | |||