another keystroke problem...

set x to 0


repeat 5 times
	delay 0.1
	activate application "Safari"
	tell application "System Events"
		tell process "Safari"
			keystroke x
			keystroke return
			set x to x + 1
			
		end tell
	end tell
	
	
end repeat

Why won’t it type?:confused:

Hi,

you’re going to type ASCII 0 - 4 which does nothing,
you probably want to type the (text) numbers, so you must coerce the number to text


set x to 0
activate application "Safari"
tell application "System Events"
	tell process "Safari"
		repeat 5 times
			delay 0.1
			keystroke x as text
			keystroke return
			set x to x + 1
		end repeat
	end tell
end tell