Repeat loop

Hi All,
I am confusing using the command Repeat loop.
Here, I have to create 70 devices.
for every device I have to rename with increment value.
Suppose I have 10 devices
I have to give the names like device1
device2
device3…device10
this operation should run 3 times
Here,I am pasting my code

Repeat 3 times
put abc ()
end Repeat

function abc ()

put 0 into x
if Imagefound (“Image1”)
Drag"onceplace"
drop “anotherplace”
add 1 to x
TypeText x

end abc.

Please help me…

Every time you call the function you get a new instance of the handler and the counter variable for that instance starts at 0. One quick fix to the code you have would be to make the counter variable in your function a global:

function abc ()
global x
//put 0 into x
if Imagefound ("Image1")
Drag"onceplace"
drop "anotherplace"
add 1 to x
TypeText x

end abc. 

I’m still not sure this code will do exactly what you want it to, but that will fix the issue with variable.