PDA

View Full Version : Kayboard script?




Poff
Feb 3, 2005, 01:55 AM
I have this game where I sometimes go to the market and try to sell things. Is it possible to write an applescript, or get a little program, that will write the same things again and again? (I cannot copy and paste)

I can get tired of writing "selling steel sword" a thousand times in a row sometimes.. :(



HexMonkey
Feb 3, 2005, 02:15 AM
You can use AppleScript to send some keystrokes to an application as follows:

tell application [Application name] to activate
tell application "System Events" to keystroke "selling steel sword"

You can then use a repeat loop to do this a fixed number of times or until a condition is met, for example:

tell application [Application name] to activate
repeat with i from 1 to 20
tell application "System Events" to keystroke "selling steel sword"
end repeat

You might need to hit the return key after entering a phrase. To do that with AppleScript, just add "& return" after the keystroke command as follows:

tell application "System Events" to keystroke "selling steel sword" & return