Passing number variables to keystrokes

Hey guys,
This might be very basic but I am stumped. I am trying to pass a numerical variable to a keystroke. I know I could use a string but i want to use a loop and increment the number. I am unable to do so. Here is the very basic script without the loop. When I use it it will not enter the variable into the UI. It works if I use a string but not a variable.



tell application "System Events"
	set a to 100571
	delay 3
	
	key code 55
	delay 0.2
	
	keystroke "4"
	delay 0.5
	
	keystroke a
	delay 2
	
	
end tell


Any help would be appreciated.

Christopher

I don’t know what you’re trying to accomplish because you haven’t indicated the process that is to receive the keystrokes, BUT: the keystroke command only takes unicode text. You’ll have to use “a as text”.

Thanks that worked. Im working on a very crude import of information into an EMR that is running as a javascript applet and is not directly scriptable. Thanks so much.