PDA

View Full Version : Simple Applescript question...




imanta
Sep 13, 2006, 11:04 AM
I am just looking to create an Applescript that will attach to an application and execute some keystrokes in the application. Example, I have Word open and I want an AS to write "Hello World" in the active window.

Is this even possible? Any good sites to show me where to even begin?

Thanks!



Unorthodox
Sep 14, 2006, 08:11 AM
This should do it....

tell application "Microsoft Word"
activate
end tell

tell application "System Events"
tell process "Microsoft Word"
keystroke "Goodbye World!"
keystroke return
keystroke "*Jumps off roof*"
keystroke return
keystroke "AHHHHHHHHH!"
keystroke return
keystroke "*Splat*"
end tell
end tell