How to set up a complicated hotkey?

Hi, I was wondering if anyone could help me get this hotkey working or point me in the direction of another similar setup I can dissect.

This is as far as I could get thinking though how it would work but I’m not sure what I’m doing.

#press alt x
kmi = km.keymap_items.new('moveandscrubkeyframes', 'X', 'PRESS', alt=True)

#copy keyframe of selected
'pose.copy'
#delete keyframe of selected
'anim.keyframe_delete'

#hotkey only active while alt x is pressed, not sure how.
kmi = km.keymap_items.new('screen.frame_offset', 'WHEELDOWNMOUSE', 'PRESS')
kmi_props_setattr(kmi.properties, 'delta', 1)

kmi = km.keymap_items.new('screen.frame_offset', 'WHEELUPMOUSE', 'PRESS')
kmi_props_setattr(kmi.properties, 'delta', -1)

#release alt x
kmi = km.keymap_items.new('moveandscrubkeyframes', 'X', 'Release', alt=True)

#paste keyframe
'pose.paste'

I basically want to be able to press and hold alt x while in pose mode then scroll with the mouse wheel and it move the keyframe of the currently selected objects then release alt x to confirm.

Would also be fine if it worked like bevel and pressing the button entered mode where the mousewheel changed the value and then lmb confirmed

I haven’t done any scripting like this, but have you looked at the code for the dopesheet? This is where you can do these actions you describe.

I haven’t but will take a look, I think i’m a bit ahead of myself tbh and should follow some basic tutorials