Solved

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

Posted on 2011-02-17
3
484 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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Recently I finished a vbscript that I thought I'd share.  It uses a text file with a list of server names to loop through and get various status reports, then writes them all into an Excel file.  Originally it was put together for our Altiris server…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

705 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

18 Experts available now in Live!

Get 1:1 Help Now