How to listen to keyboard events

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
hylton
Posts: 53
Joined: Thu Oct 04, 2012 12:49 pm

How to listen to keyboard events

Post by hylton » Tue Oct 16, 2012 9:27 am

Hello,

I would like to create a simple application that performs the task of replacing text as the user types.

Example: The user types .ty and the program replaces it with Thank you.

The program would need to run in the notification area all the time and would need to listen for specific keyboard strokes. If there is a match between what the user is typing and the list of phrases that have been stored in the program, the text would be replaced.

The user would also be able to choose whichever key is used as the trigger. The above example show the period followed by letters as the trigger.

Is this possible with LiveCode?

If yes, could someone please point me in the right direction as to how to listen for keystrokes, and how to send the replacement text to the current active window.

Thank you.

Kind regards
Hylton

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to listen to keyboard events

Post by Klaus » Tue Oct 16, 2012 10:30 am

Hi Hylton,

if you mean to "control" typing OUTSIDE of your Livecode app, this is not possible right out of the box!
That would require an external.


Best

Klaus

hylton
Posts: 53
Joined: Thu Oct 04, 2012 12:49 pm

Re: How to listen to keyboard events

Post by hylton » Tue Oct 16, 2012 10:40 am

Hi Klaus

Yes, the user can be in Word, Excel, Firefox, or any other program that allows text input.

The LiveCode application would simply listen to what the keyboard is doing, and it there is a match, replace the text in the active Window.
Klaus wrote:That would require an external.
What do you mean, and where would I look for that?

Kind regards
Hylton

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: How to listen to keyboard events

Post by Klaus » Tue Oct 16, 2012 10:56 am

Hi Hylton,
hyltonclarkeBUSH1Ex wrote:
Klaus wrote:That would require an external.
What do you mean, and where would I look for that?
Everything that is not supported natively by Livcode can be programmed in C etc. .
into an external file, check the "Externals" folder in the Livecode application folder.
All the "revXXX.dll"s are "externals".

I do not know if such an external exists nor where you could possibly look for this, sorry.


Best

Klaus

Post Reply