Question about sendkeys
issueid=309 27-08-2011 20:28
thinBasic author
Number of reported issues by ErosOlmi: 35
Question about sendkeys

ORIGINAL THREAD by user stapper : http://www.thinbasic.com/community/s...about-sendkeys


thinBasic Sendkeys function is internally using Keybd_Event api now superseded by SendInput

I'm now developing a new thinBasic function called SendString that will use SendInput function as core engine.

First experiment seems working fine. It will have much more control over what is possible to do.
Example:
SendString "{SHIFT_DOWN}{CTRL_DOWN}{LEFT}{SHIFT_UP}{CTRL_UP}"
Another advantage over previous way is that SendString will also be able to simulate mouse events.

Stay tuned.
Issue Details
Issue Number 309
Issue Type Feature
Project thinBasic
Category Core engine (thinCore.dll)
Status Implemented
Priority 5 - Medium
Suggested Version 1.8.8
Implemented Version 1.8.9
Milestone thinBasic 1.8.9.0
Votes for this feature 0
Votes against this feature 0
Assigned Users (none)
Tags (none)




28-08-2011 09:05
thinBasic author
Ok, I've developed SendString function.
Syntax is the following
SendString ( StringToSend [, MillisecsKeystrokeDelay[, MillisecsToWaitAtEnd]] )
Example
SendString "{SHIFT_DOWN}{CTRL_DOWN}{LEFT}{LEFT}{LEFT}{SHIFT_UP}{CTRL_UP}{DEL}", 500, 1000

Supported keys are:
"CTRL_DOWN"
"CTRL_UP"
"ALT_DOWN"
"ALT_UP"
"SHIFT_DOWN"
"SHIFT_UP"
"WIN_DOWN"
"WIN_UP"
                 
"BACKSPACE", "BS"
"ENTER", "ENT"
"INSERT", "INS"
"DELETE", "DEL"

"RIGHT"
"LEFT"
"UP"
"DOWN"
                 
"ARROWRIGHT"
"ARROWLEFT"
"ARROWUP"
"ARROWDOWN"

"HOME"
"END"
                 
"TAB"
"ESCAPE", "ESC"
"PGUP"
"PGDN"

"F1"
"F2"
"F3"
"F4"
"F5"
"F6"
"F7"
"F8"
"F9"
"F10"
"F11"
"F12"
"F13"
"F14"
"F15"
"F16"
"APPS"
"NUMLOCK"        
"PRTSC"          
"SCROLLLOCK"
"HELP"
"CAPITAL"
Note that for CTRL, SHIFT, ALT and WIN it is supported the down and up event so programmer can fine tune when such keys must be pressed and released.

New feature will be present in next release.

28-08-2011 09:09
thinBasic author
Uses "UI"


Dim hWnd As Long


hWnd = Win_FindByTitle("...Notepad")


'---If found ...
If hWnd Then
  Sleep 1000
  Win_SetForeground(hWnd)
  Sleep 1000
  SendString "aaaaaaaaa bbbbbbbbbbb bbbbbbbbbb", 0, 1000
  SendString "{SHIFT_DOWN}{CTRL_DOWN}{LEFT}{LEFT}{LEFT}{SHIFT_UP}{CTRL_UP}{DEL}", 500, 1000
  
  hWnd = Win_FindByTitle("thinAir...")
  Win_SetForeground(hWnd)
End If


Beep

+ Reply