Pressing the control key with AppleScript

applescriptvoice-dictation

I use Voice Over and Dragon Dictate. I have figured out how to make Dragon Dictate press Control-Option-A, which makes Voice Over read a page of text, and now I would like to figure out how to tell Voice Over to stop reading through Dragon Dictate. The trouble is that the Voice Over keystroke is just Control. I have never been able to find any AppleScript key code for this.

On the same note, whenever I read about keystrokes in AppleScript, I get the impression that I'm always expected to press some other key along with the control, the command or the option modifier key. But what if I just want to press one modifier key through a program like Dragon Dictate?

Best Answer

If you need to do something and hold it down, try something like this:

                tell application "System Events"
                    tell process "Photoshop"
                        option key down
                    end tell
                end tell
                DO OTHER STUFF HERE
                tell application "System Events"
                    tell process "Photoshop"
                        option key up
                    end tell
                end tell