Solved

Does a VB script effect focus if it does not have SendKey commands

Posted on 2011-02-17
3
497 Views
Last Modified: 2012-05-11
I am running an AutoIT script that sometimes sends simulated keyboard strokes to a running WIN7 program.  It does just fine until I also run some VB scripts in the background, then some of the keystrokes seem to be ignored.  The VB scripts do not have any keystroke commands (doing FTP, moving files from folder to folder,  ZIPing).  Do VB scripts with no key commands intefere with or take control of focus while running?
0
Comment
Question by:Mike Caldwell
  • 2
3 Comments
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 34921089
No, they shouldn't, if it's running via wscript.exe, whereas cscript.exe will show a DOS prompt, and will take the focus.  It's not so much SendKeys that changes any focus, it's more things like
objShell.AppActivate "windowtitle"

that would change the focus.

However, if your AutoIT isn't trying to change the focus to whatever it's sending keystrokes to, then performing any other task while that is running will change the focus and the AutoIT keystrokes will go to that object.

Therefore, double-clicking the VBS might change the focus onto the VBS file itself, but not the script during execution.

Regards,

Rob.
0
 
LVL 1

Author Comment

by:Mike Caldwell
ID: 34921736
Thanks Rob.  The VB stuff is not CS, and they run continuously.  So with that I am puzzled why the WIN7 application being controlled by AutoIT seems to run fine while soso, but when the VB scripts are run at the same time some keystrokes to the app seem to get lost.  I start the VB stuff first, then AutoIT.
0
 
LVL 65

Expert Comment

by:RobSampson
ID: 34921960
Is your AutoIT script activating the windows it is supposed to send keystrokes to?  It should be, just to safeguard.

Is your VBScript doing anything file system wise, or system setting wise, that might cause a refresh in Windows 7?  Since Windows 7 automatically continuously refreshes folder views, it could be as simple as adding a new file somewhere that might cause it to refresh, but I'm not sure.

Rob.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Well hello again!  Glad to see you've made it this far without giving up.  In this, the fourth installment of my popular series, I'm going to cover functions and subroutines, what they are, and why they are useful.  Just in case you stumbled onto th…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now