You don't need to keep sending the command to press the E key...
The logic should look something like...
//
loop while joystick hat key pressed..
if pressed is not set, or is set to false
set bool pressed to true
press key e down
end
pause 0.1 seconds
end
release key e
set bool pressed to false
What happens then, is the e key is pressed and held the first iteration of the loop, every other iteration nothing happens other than the sleep - a controlled toggle ( the variable, ensures the key is only activated once ). The loop checks for updates every 0.1 seconds ( you can change this ). When the loop is exited, when the joystick hat switch is released, then the key e is released and the variable is reset.
Pseudo code, but the logic is sound.
You can use these types of controlled-toggles for other things too. There can be a downside though. If you press the e key on your keyboard - it won't trigger E again in the loop so if there is a way to see if E is pressed then that would be the better method instead of the variable... So if e is pressed and released and resets to state, then it would be re-pressed.