Jump to content

How to send key to On-Screen Keyboard

Recommended Posts

I want to send key to On-Screen Keyboard (program in win 7) and then On-Screen Keyboard program send that key to notepad, but my script is not work, this is my script:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <Timers.au3>
Global $nDelay,$handle,$pid;
$nDelay = 2000
$gui = GUICreate("My GUI",200,100)
$button_gen = GUICtrlCreateButton("Start",10,30,60)
$button_stop = GUICtrlCreateButton("Stop",10,60,60)
$handle = WinGetHandle('On-Screen Keyboard', "")
$pid = WinGetProcess($handle)
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Switch $msg
Case $button_gen
_Timer_SetTimer($gui, $nDelay, "AutoTDK")
Case $button_stop
Func AutoTDK($hWnd, $Msg, $iIDTimer, $dwTime)
WinActivate("Untitled - Notepad") ; active notepad program
ControlSend($handle, "", $pid,"{SPACE}") ; send space key to On-Screen Keyboard

pls help me

Link to comment
Share on other sites

Sending keys to an On-Screen keyboard, sounds kinda strange. :mellow:

You are on the right track though. Use the AutoIt Window tool to get the ids of the buttons and use ControlClick.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...