• Log in or sign up for an account here: https://www.sythe.org/login

Sendkeys

Status
Not open for further replies.

Terrankiller

Ex-Administrator

Retired Administrator
Visual Basic Programmers
Joined
May 7, 2005
Sythe Gold
1
Messages
1,286
Location
California
I'm bored so I wrote my own sendkeys function.

Code:
'Written by: Terrankiller
'[email protected]

'Here is an example of a special key const, this one should be obvious if you want to write custom function or add.

'This one in particular is the return key, or enter.

'Public Const VK_RETURN = &HD

Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Public Declare Function VkKeyScan Lib "user32" Alias "VkKeyScanA" (ByVal cChar As Byte) As Integer

Public Const KEYEVENTF_KEYUP = &H2

Public Const KEYEVENTF_EXTENDEDKEY = &H1

'You will notice a few problems with characters such as "!.)(,/? you need to program the function accordingly

'This function just parses "Text" and uses keypress to emulate the event

Public Function SendKeys(Text As String)

   For i = 1 To Len(Text)
   
      KeyPress (Mid(Text, i, 1))
   
   Next i

End Function

'This function actually "presses" the individual keys

Public Function KeyPress(Key As String)

   On Error Resume Next

      keybd_event VkKeyScan(Asc(LCase(Key))), 0, KEYEVENTF_EXTENDEDKEY, 0

End Function

'This function is just to "press" the enter key

Public Function KeyPressReturn()

   On Error Resume Next

      keybd_event VK_RETURN, 0, KEYEVENTF_EXTENDEDKEY, 0

End Function
 
Le Monkey
Potamus
Prove it!
Sythe Awards 2011 Winner
Tier 1 Prizebox
Tortoise Penis
Trole
UWotM8?
Wait, do you not have an Archer rank?
C++ makes it easier, all the constants are declared for you.
 
how do i use it in my autityper script.
iv made it in a module
help me im new
 
Status
Not open for further replies.
Runescape Gamblingrunescape gambling
Back
Top