How can i send keyboard input from Go language, like virtual keyboard

1,708 views
Skip to first unread message

SProgrammer

unread,
Jan 25, 2014, 7:08:13 PM1/25/14
to golan...@googlegroups.com
How can i send keyboard input from Go language, like virtual keyboard, is there any sample sites where many examples are available for initial basic versions to play with?
Like in Lua samples by categories to just get started ( http://lua-users.org/wiki/SampleCode)

Thank you


Andy Balholm

unread,
Jan 25, 2014, 10:36:41 PM1/25/14
to golan...@googlegroups.com
On Saturday, January 25, 2014 4:08:13 PM UTC-8, SProgrammer wrote:
How can i send keyboard input from Go language, like virtual keyboard,

I don't know. It really depends more on your operating system than on the programming language. If you ask a more specific question maybe someone can help you.
 
is there any sample sites where many examples are available for initial basic versions to play with?
Like in Lua samples by categories to just get started ( http://lua-users.org/wiki/SampleCode)

There is a site gobyexample.com. I haven't looked at it enough to know if it's any good, but it sounds like what you're looking for. 

SProgrammer

unread,
Jan 26, 2014, 5:13:36 AM1/26/14
to golan...@googlegroups.com
@Andy Balholm: i could not find any example of keyboard button press via Go. Specially how to trigger button press for Windows and Mac using Go?
Tried following but its a listener.

signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)

Dmitry Vyukov

unread,
Jan 26, 2014, 5:37:31 AM1/26/14
to SProgrammer, golang-nuts
You need use some OS API function, it's possible to invoke arbitrary
windows functions with syscall.Syscall.
Something here must give you the answer:
https://www.google.com/search?q=msdn+emulate+keyboard+press
> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

Matt Silverlock

unread,
Jan 26, 2014, 6:35:15 AM1/26/14
to golan...@googlegroups.com
For OS X you could (and this might be missing a better way) exec AppleScript, use CGO and Quartz C bindings or the appscript package from PyPi (http://appscript.sourceforge.net/). 

(sometimes there's better tools for the job!)
Reply all
Reply to author
Forward
0 new messages