Navigation:  thinBasic Modules > UI (User Interface) > Windows >

SendKeys

Previous pageReturn to chapter overviewNext page

 

Description

 

Send text to the current top-level window simulating keyboard keystrokes.

 

Syntax

 

hWnd = Sendkeys(TextToSend [, mSec])

 

Returns

 

Number: handle to the window if found

 

Parameters

 

Name

Type

Optional

Meaning

TextToSend

String

No

Text to send

mSec

Number

Yes

Milliseconds to wait after text has been sent.

 

Remarks

 

This Sendkeys function should emulate most of the same rules as the Visual Basic Sendkeys.

 

You can send these codes:

{ENTER}

{ESC}

{UP}

{DOWN}

{LEFT}

{RIGHT}

{BACKSPACE} or {BS}

{HOME}

{END}

{PGUP}

{PGDN}

{TAB}

{DEL} or {DELETE}

{INS} or {INSERT}

{WIN}

{PRTSC}

(CAPSLOCK}

{NUMLOCK}

{SCROLLLOCK}

{HELP}

{F1} to {F16}

{SLEEP 1000} <-- 1000 miliseconds

{AppActivate WindowName}   <-- switches to this window

 

Precede characters with + for Shift, ^ for Ctrl, % for Alt

example: ^p       would be Ctrl-p

 

You can also group characters for shift/ctrl/alt with parentheses ()

example: ^%({DEL}{DEL})  would be Ctrl-Alt-Del twice

 

To send these special characters {+^%~( as plain characters enclose them in braces

example: {{}      would just send  {

 

To send a key multiple times inclose it in braces with a number like {h 3}

example: {DEL 41)  would send DELETE key 41 times

 

Restrictions

 

See also

 

Examples

 

Sendkeys("This is my text to send.{ENTER}")

 

 

© 2004-2008 thinBasic. All rights reserved. Version 1.7.0.0 Web Site: http://www.thinbasic.com