Applescript IF statement with click and keystroke?
I don't know any way to do that with AppleScript, but you could add something like this to KeyRemap4MacBook's private.xml:

&lt;autogen&gt;__PointingButtonToKey__ PointingButton::MIDDLE, KeyCode::SHIFT_L&lt;/autogen&gt;


See the source for the key code values and predefined settings.