There is a pauseScript command that works the same way as the Pause button. However, it seems like you might have better luck just automating this process. You could use code to create a random string of characters:
set myImageName to (any item of a..z for each item of 1..6) joined by empty
This code snippet can generate over 300 million different 6 character strings – it’s not guaranteed that you won’t get the same string twice, but you can see the odds are in your favor – add a character or two and they get even better.
Another option is to create a file of user names that you can read in and iterate over. Or increment a counter that you write to a file each time and read back in for the subsequent runs:
put the first word of file "/path/to/file" into codeNum
add 1 to codeNum
typeText "baseName" & codeNum
put codeNum in file "/path/to/file"
In this way you can maintain a counter over time to reuse in script runs to continue to generate unique names.