Simulate CTRL+F12 2 second keypress Im trying to bring up the OS X shutdown dialogue box by simulating the key press Control+F12 for 2 seconds (using a logitech keyboard). No matter how much I try I just can not get it to work. 

My latest script looks like this:

on run
    tell application "System Events"
        key down {key code 111 , key code 59}
        delay 2.0
        key up {key code 111 , key code 59}
    end tell
end run


This should work and does work if I press Control+F12 for 2 seconds on my keyboard, so can someone tell my why it doesn't work when called via applescript?
Rather than simulating a keyboard shortcut, you can simply call the shutdown dialog itself with the following AppleScript:

tell application "loginwindow" to «event aevtrsdn»


…or for the restart dialog:

tell application "loginwindow" to «event aevtrrst»