Making an AppleScript that holds down a key
Try running your code using the key down &amp; key up features of AppleScript.

code:

tell application "System Events"
    key down option
    delay 5
    key up option
end tell