Reputation: 581
Is it possible to have my mac type for you with applescript? What I want is this: when compiled, this applescript will type a phrase, then press enter. Is there any code simulating the pressing of keys?
Upvotes: 1
Views: 2887
Reputation: 1
You will need to let shortcuts run scripts and allow assistive access to control your computer. but heres the code
tell application "System Events"
keystroke "Your text here"
end tell
you can also add a second line of keystroke.
Upvotes: 0
Reputation: 6047
Yes, look at keystroke and key down in System Events > Processes Suite, though you have to turn on Universal Access
Upvotes: 0
Reputation: 6516
The keystroke
command will work for you.
tell application "System Events" to keystroke "A phrase" & return & "Another phrase"
If you want a specific application to do the typing, just do something along these lines:
tell application "System Events" to tell process "TextEdit" to keystroke "A phrase" & return & "Another phrase"
Upvotes: 5