Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-02-17
3
Medium Priority
?
532 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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is an addendum to the following article: Acitve Directory based Outlook Signature (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_24950055.html) The script is fine, and works in normal client-server domains…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses

783 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