Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista Tutorial - reference / manage application windows with vbscript

Reply
 
Old 07-08-2008   #1 (permalink)
Firewalker82
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 SpecsSystem Spec
Old 07-08-2008   #2 (permalink)
mr_unreliable
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.
hi Firewalker,

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 SpecsSystem Spec
Reply

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46