Advertisement
Ham62

AutoTyper.bas

Jun 8th, 2017
442
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "Windows.bi"
  2. #define MAPVK_VK_TO_VSC 0
  3. Declare Sub ShiftDown
  4. Declare Sub ShiftUp
  5. Dim shared KeyOut as INPUT_
  6.  
  7.  
  8. Dim as String sSourcefile = Command '"C:\DOSFiles\BC7\BIN\FLAPPY\ASM\BuffPrint.ASM"
  9. Dim as String sSrcBuff = ""
  10. Dim as Integer iFileSz = 0
  11. If Open (sSourceFile for binary access read as #1) Then
  12.     Print "Error opening source file!"
  13.     Sleep: System
  14. End If
  15.  
  16. iFileSz = LOF(1)
  17. sSrcBuff = Space(iFileSz)
  18. Get #1,, sSrcBuff
  19. close #1
  20.  
  21. Open Command for Input as #1
  22.  
  23. KeyOut.type = INPUT_KEYBOARD
  24. Do
  25.     Sleep 1,1
  26. Loop Until (GetAsyncKeyState(VK_ESCAPE) AND &H8000)
  27.  
  28. For X as Integer = 0 to iFileSz-1
  29.     Select Case sSrcBuff[X]
  30.     Case asc("A") to asc("Z") 'put down shift key
  31.         ShiftDown
  32.     Case 10
  33.         Continue For
  34.     Case asc("!"), asc("@"), asc("#"), asc("$"), asc("%"), asc("^"), asc("&"), asc("*"), asc("("), asc(")"), asc("_"), asc("+"), asc("|"), asc("}"), asc("{"), asc("~"), asc("<"), asc(">"), asc("?"), asc(":"), asc("""")
  35.         ShiftDown
  36.     end select
  37.        
  38.     var key = VkKeyScanEx(sSrcBuff[X], 0)
  39.    
  40.     KeyOut.ki.wScan = MapVirtualKey(key, MAPVK_VK_TO_VSC)
  41.     KeyOut.ki.wVk = key
  42.     KeyOut.ki.dwFlags = 0
  43.     SendInput(1, @KeyOut, SizeOf(KeyOut))
  44.    
  45.     Sleep 10,1
  46.    
  47.     KeyOut.ki.dwFlags = KEYEVENTF_KEYUP
  48.     SendInput(1, @KeyOut, SizeOf(KeyOut))
  49.     ShiftUp
  50.     'Sleep 100,1
  51.  
  52. Next X
  53.  
  54. Sub ShiftDown
  55.     KeyOut.type = INPUT_KEYBOARD
  56.     KeyOut.ki.wScan = MapVirtualKey(VK_SHIFT, MAPVK_VK_TO_VSC)
  57.     KeyOut.ki.wVk = VK_SHIFT
  58.     KeyOut.ki.dwFlags = 0
  59.     SendInput(1, @KeyOut, SizeOf(KeyOut))
  60. End Sub
  61.  
  62. Sub ShiftUp
  63.     KeyOut.ki.wScan = MapVirtualKey(VK_SHIFT, MAPVK_VK_TO_VSC)
  64.     KeyOut.ki.wVk = VK_SHIFT
  65.     KeyOut.ki.dwFlags = KEYEVENTF_KEYUP
  66.     SendInput(1, @KeyOut, SizeOf(KeyOut))
  67. End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement