Execute Keystrokes

Hi,

Is there a way to execute keystrokes via python somehow?
I often just want certain blender functions to be executed one after the other.
Right now i want to enter the scale tool (s) > switch to y axis (y) > custom y axis (y) > snap all selected vertices to 0 (0) and apply everything (enter)
Now with a script where i can enter keystrokes i only would have to add s,y,y,0,enter in the corresponding line and would have my addon ready.
Is there some way to do this with python?

Cheers Christian

either pass all required arguments to the operator, or if there are multiple, combine them in a Macro:

I wish I would understand anything of this I just read. :wink:
But thanks, I will try to figure it out :slight_smile:

Your input sequence should translate to the following arguments:

bpy.ops.transform.resize(value=(1, 0, 1), constraint_axis=(False, True, False), constraint_orientation='Cube')

“Cube” is the transformation orientation (a custom one).

Thanks CoDEmanX!
I was able to achieve what I wanted even without coding btw.
All parameters were accessible in the Shortcut Editor itself :slight_smile: