This is a snippet I like to use for easily accessing the state of modifier keys when a user runs a script. I figured I would post it here as I couldn't easily track it down when I needed it today and thought it might be useful to other folks as well.
def get_modifiers():
"""Returns state of modifier keys: ctrl, shift, alt
Example Usage:
ctrl, shift, alt = get_modifiers()
"""
bc = c4d.BaseContainer()
if c4d.gui.GetInputState(c4d.BFM_INPUT_KEYBOARD,c4d.BFM_INPUT_CHANNEL,bc):
ctrl = bc[c4d.BFM_INPUT_QUALIFIER] & c4d.QCTRL
shift = bc[c4d.BFM_INPUT_QUALIFIER] & c4d.QSHIFT
alt = bc[c4d.BFM_INPUT_QUALIFIER] & c4d.QALT
return ctrl, shift, alt