Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

youtheotube2

macrumors newbie
Original poster
Mar 14, 2013
1
0
I have been trying to get applescript to enter a letter and then press enter in Safari. Ive already looked up programs, but they dont seem to work. The text box I need to type into is inside a game, and the programs just reload the page. It isnt necessary to have it press enter, if I could have it click in a specific spot on the screen. The program ive tried is this...
Code:
tell application "Safari"
	tell application "System Events" to keystroke "x" using command down
	tell application "System Events" to key code 52 using command down
	delay (random number from 1 to 10)
end tell
Any ideas?
 

ytk

macrumors 6502
Jul 8, 2010
252
5
Is Safari active when this is running? Try adding “activate” after the first line.
 

jsdraven

macrumors newbie
Aug 14, 2013
5
0
Sonora, CA
another idea to look into

I don't know if this would help but you may also want to see if there is a way to tell safari to focus on an element on the page. So you may want to view source and find the element ID of that text field to focus then have it echo or type what you need it to do.

Again sorry for lack of specifics I am also supper new to applescript.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.