2

I'll explain my question: is it possible to write a Python script which interacts with OS X architecture in a high-level way? For example, can I gain control on Mac OS X windows resizing from a Python script? Are there modules for that? I'm not finding any.

To push things even further, would I be able to control keyboard shortcuts too? I mean, with Python, could I write a script that opens a terminal window everytime I type cmd + Enter from wherever I am in that moment, as if it was a system shortcut (Awesome WM style, if you know what I'm talking about)?

Hope I've been clear.

whatyouhide
  • 15,897
  • 9
  • 57
  • 71
  • There is a similar question [here](http://stackoverflow.com/questions/10851804/how-to-convert-a-string-into-a-set-of-keystrokes-in-python-on-osx) about python and calling into C code to trigger keyevents – jdi Dec 12 '12 at 23:57

1 Answers1

0

The 2nd one you can't do for sure, since the events are grabbed by other processes. You should look for a osx specific library for doing that and then write a python wrapper around it.

LtWorf
  • 7,286
  • 6
  • 31
  • 45
  • I was playing around with AppleScript to get this work done, but I really don't like the language nor the way Apple describes it in its developer site docs. Any idea about the libs you're talking about? – whatyouhide Dec 12 '12 at 23:51
  • 1
    @whatyouhide: Well what about [appscript](http://appscript.sourceforge.net/py-appscript/index.html)? – jdi Dec 12 '12 at 23:55