How to hold down the Caps Lock Key with Visual Basic?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
betterman
Newbie
Posts: 2
Joined: Wed Aug 20, 2008 5:35 am

How to hold down the Caps Lock Key with Visual Basic?

Post by betterman » Tue Jan 20, 2009 8:30 am

I'm writing a macro, but I need it to hold down a selection of keys in order to activate anther macro that is specific to a particular program.

In this case, I need the program to hold down the caps lock key and press the right mouse button, then release the caps lock key.

If I can simulate that, then I can get on with the rest of my code. The rest of it's actually complete for the most part, since I was using anther less advanced macro program to emulate that task for me. At the moment though, it seems that macro program has ceased functioning, so I was wondering, since MacroSchedular can implement scripts written in visual basic, if it could also use visual basic to send the command for the tab key being pressed?

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Jan 20, 2009 10:00 am

Macro Scheduler lets you use VBScript in your code, not Visual Basic. The two things are different.

But if that's what you meant, and if you really must send the tab key with VBScript you can do it using the code posted here:

http://www.mjtnet.com/forum/viewtopic.php?t=1696

E.g.:

Code: Select all

VBSTART
Sub Send
  Dim Wsh
  Set Wsh = CreateObject("Wscript.Shell")
  Wsh.SendKeys "{TAB}"
End Sub
VBEND
But I wonder why you want to do this within VBScript, when all you need to do in Macro Scheduler is:

Press Tab

etc
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts