Python and Keypres


I just started to learn Python. I want to simulate/automate a bunch of keypresses. I’m using a script made by David (Text Warp) as a reference. Now i need not just a CTRL or an ALT or SHIFT to be pressed but a CTRL and SHIFT. I want to make dupli’s real “CTRL-SHIFT-A” for example. How can i accomplish that?
This is my script so far:
import Blender, math
from Blender import Curve, CurNurb, Scene, Text3d, Object, Camera
from Blender import Window, Mathutils, BezTriple, Draw
def keypress( key, Qual ):
id = Window.GetScreenInfo( Window.Types.VIEW3D )[0][‘id’]
if Qual:
Window.SetKeyQualifiers( Qual )
Window.QAdd( id, key, 1 )
Window.QHandle( id )

Window.SetKeyQualifiers( 0 )
Window.QHandle( id )

keypress( Draw.AKEY, Window.Qual.CTRL )


Thanx, Twan

I didnt expect this to be so difficult, but i still cannot find it.
I’m looking for a way to program a CTRL-SHIFT-A keypress in Python. I managed to use the CTRL or the SHIFT but not both buttons in combination with the AKEY…

Any help appreciated,

Thanx Twan

your script works as is - just call your keypress-function with:

keypress(Draw.AKEY, Window.Qual.CTRL|Window.Qual.SHIFT)

Qualifiers can be OR’ed - see documentation of the SetKeyQualifiers(qual) function…
The popup appears to confirm the “make dupli objects real” - i you have an object with dupli… active.
But now in the popup you cannot send the return key with your keypress-function anymore
(I think there’s no solution for sending keypresses to popups so far)

Hi Michael,

That did the trick, Thanx a lot.