Page 1 of 1

Simulating the keyboard in other applications

Posted: Wed Apr 17, 2013 4:53 pm
by andrewferguson
Hi,
I am trying to find a way to send "virtual keystrokes" to the computer. I know that the "type" command sends keystrokes to LiveCode, but I need it to be sent to the whole computer.

For example:
My Application would be running in the background, receiving messages and then typing text into Microsoft Word. Unfortunatly I cannot just use the "write to file" command, as the keystrokes would need to be sent to other applications, Like Control Panel, or used in shortcuts Ctrl+S.

I don't mind using the command line via the "shell" command, as long as it worked with Windows, Mac OS X and Linux.

Any Ideas?

Re: Simulating the keyboard in other applications

Posted: Sun May 05, 2013 6:13 pm
by andrewferguson
Ok,
After a bit of digging, I found a way to make this work in Mac OS X using AppleScript.

Make a variable and put this into the variable:
tell application "System Events"
keystroke "<name of key>"
end tell

Then:
do <variable name> as applescript

If anyone else has any other ideas on how to make this work for Windows or Linux, I would be glad to hear them.
Andrew