Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

qwert321321

macrumors newbie
Original poster
Jul 28, 2010
2
0
I wish to create a C program, or just a script that would send keyboard combinations to the keyboard.

I was thinking of writing to the keyboard device file, but I am not quite sure how to do this.

Thank you, qwert
 
I think Applescript would probably be the quickest/easiest way to achieve this. Can you be more specific about what your ultimate goal is? I think that info would get you better advice. Are you trying to interact with 3rd party apps?
 
Here is an example of the kind of thing I want to do:

1 highlight text in safari with mouse
2 copy text (cmd-c)
3 switch to previous tab (cmd-shift- leftarrow)
4 go to search bar (alt-tab, alt-tab, alt-tab ......)
5 paste (cmd-v)
6 select search button (alt-tab)
7 open in new tab (cmd-enter)

or say

1 highlight text with mouse
2 copy text (cmd-c)
3 switch to terminal (cmd-tab or something)
4 go to dir ("cd /Users/qwert/notes)
5 make/open note ("vi note.txt")
6 append ( "a" )
7 paste text (cmd-v)
8 save and quit vim (esc, ":qw")
9 switch back to last application (cmd-tab)


I know there are MANY ways of doing these things; but I was thinking shortcut keys would keep things from getting too application specific.
Also being able to do this with C would allow for some cool string parsing, or inserting dates, etc.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.