Adblock breaks this site

Sendkeys

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

Thread Status:
Not open for further replies.
  1. Terrankiller

    Terrankiller Ex-Administrator
    Retired Administrator Visual Basic Programmers

    Joined:
    May 7, 2005
    Posts:
    1,286
    Referrals:
    1
    Sythe Gold:
    1
    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
    
     
  2. Govind

    Govind The One Musketeer
    Mudkips Highly Respected Retired Administrator

    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
    Sendkeys

    C++ makes it easier, all the constants are declared for you.
     
  3. kridan500

    kridan500 Active Member
    Banned

    Joined:
    Feb 11, 2007
    Posts:
    217
    Referrals:
    1
    Sythe Gold:
    0
    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 >
Thread Status:
Not open for further replies.


 
 
Adblock breaks this site