can someone help me?

Set wshShell =wscript.CreateObject("WScript.Shell")
do
wscript.sleep 3000
wshshell.sendkeys "{/}"
wshshell.sendkeys "{s}"
wshshell.sendkeys "{e}"
wshshell.sendkeys "{n}"
wshshell.sendkeys "{d}"
wshshell.sendkeys "{ }"
wshshell.sendkeys "{t}"
wshshell.sendkeys "{r}"
wshshell.sendkeys "{a}"
wshshell.sendkeys "{d}"
wshshell.sendkeys "{!}"
wshshell.sendkeys "{e}"
wshshell.sendkeys "{s}"
wshshell.sendkeys "{ }"
wshshell.sendkeys "{i}"
wshshell.sendkeys "{m}"
wshshell.sendkeys "{a}"
wshshell.sendkeys "{f}"
wshshell.sendkeys "{k}"
loop

i want to press F5 to stop the loop and f4 to start it again?
adam hassadAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Not feasible (with reasonable effort). Sendkeys is simulating key presses, and using the keyboard interferes with it. The receivimg window has the focus, and so the VBS code will not see any key press.

Only if registering a hotkey in the OS you might be able to bind F4 and F5 to actions globally - but I've never seen VBS code doing that. It probably requires Win32 API calls.

On another note: It is always a bad idea to use Sendkeys. It is very unreliable, and requires to be run in an environment no user interaction is expected.
And you can send multiple keys with one call - much better to read, and (slightly) more reliable.

Lastly, please use reasonable question titles telling something about your issue. That improves the probability to get a reply in a larger scale.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.