Key down boolean with modifier keys?

Is there a little snippet of code to turn modifier keys on and off for a portion of a script?


use the key down / key up command of System Events

activate application "myApp"
tell application "System Events"
	tell process "myApp"
		key down option
		-- do something
		key up option
	end tell
end tell

Caution: if an error occurs in the do something portion of the script, which aborts the script,
the option key remains down!