Sendkeys

Discussion in 'Archives' started by Terrankiller, Sep 5, 2008.

Thread Status:
Not open for further replies.
Sendkeys
  1. Unread #1 - Sep 5, 2008 at 11:54 AM
  2. Terrankiller
    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    Sendkeys

    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
    
     
  3. Unread #2 - Sep 5, 2008 at 6:10 PM
  4. Govind
    Joined:
    Apr 22, 2005
    Posts:
    7,825
    Referrals:
    13
    Sythe Gold:
    23
    Prove it! Trole Tier 1 Prizebox Tortoise Penis Le Monkey UWotM8? Wait, do you not have an Archer rank? Potamus

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    Sendkeys

    C++ makes it easier, all the constants are declared for you.
     
  5. Unread #3 - Dec 10, 2008 at 12:55 PM
  6. kridan500
    Joined:
    Feb 11, 2007
    Posts:
    217
    Referrals:
    1
    Sythe Gold:
    0

    kridan500 Active Member
    Banned

    Sendkeys

    how do i use it in my autityper script.
    iv made it in a module
    help me im new
     
< Selling Vesta's Plateskirt | A good RS selling/buying stuff site besides gold4rs >

Users viewing this thread
1 guest
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site