You only need to split the keypress and release for keys that you want to do stuff while you hold it down.

if you don't split them, it is sending a quick keypress at the keyboard repeat rate.

For normal actions a quick keypress is all that is required and so there is no mileage in splitting the key down and up stages.

BTW.. you only need one #ifwinactive statement in your script as it applies to everything below that statement, should save some typing