You can detect the command key combination with Get ( ActiveModifierKeys ) but if you mean - can I effectively press the key via script for another process - I think the answer is no.
1 of 1 people found this helpful
You might try using the perform applescript script step. If you put the text you want into a variable and use a Caluclated Perform Applescript with the formula
Perform Applescript ["say" quote($Text) ]
it should use what ever settings text to speech settings you have in System preferences. Please note that the word "say" is in quotes and you use the quote function to send the text to the OS with quotation marks.
This is the AppleScript command with the parameters you'll need:
Set Variable [ $speakExpression ; "say " & Quote ( Table::SpeechField ) & " using \"Alex\" speaking rate 300 pitch 50 modulation 50 volume 1.0" ]
Perform AppleScript [ $speakExpression ]
While this is different from your original request, I believe the intent is the same. In my case, I wanted a script to quickly adjust window size, show toolbar and enter layout mode. The first two were easy, but the last required the following Perform AppleScript to passthrough the cmd-l keystroke:
tell application "System Events"
tell application "System Events" to keystroke "l" using command down