Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VBScript
Sendkeys to windows application doesnt work. i have the following code
Set objAP = CreateObject("wscript.shell")
  objAP.Run "aruser.exe" ' aruser is an windows application
  objAP.AppActivate "aruser.exe"
  objAP.SendKeys "gananu", True
  objAP.SendKeys "{TAB}", True
  objAP.SendKeys "gananu", True
 
When i run this code, it is printing 'gananu' in VB script editor itself, but my requirement is to send 'gananu' to aruser application.
Can someone help. Thanks, ganga
Posted 16-Feb-10 19:24pm
Edited 17-Feb-10 4:40am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

This example [^] works on my system.
Did you try to run the .vbs file outside the editor?
 

 
Please don't add 'fake answers': modify your original post (or write a new one).
Did you try the example of the link (i.e. maybe the problem is not the script, but the application you run)?
Smile | :)
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

thanks for the reply. i tried creating a "command button" in excel sheet with this code and then run, still it failed.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 3

Try to use WScript.Sleep afther the AppActivate call to pause the script for a couple of seconds and give the application time to be activated.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 575
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web03 | 2.8.141220.1 | Last Updated 28 Feb 2010
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100