Jump to content

How can i simplify my code?


Recommended Posts

Hi, I started using AUTOIT 3 days ago and encountered a problem. Well, I wanted to test different applications using autoit. I have 20 different "pages" in this program and in order to go to the next one you have to select it from the drop-down list.  The problem is how to create a "counter" that would change the variable to the next one after each executed script/for loop, at a given point.

 

HotKeySet("{j}","Stop")
Func stop()
    Exit
EndFunc


Global $Var1 = MouseClick("left",162, 353,1,10)
Global $Var2 = MouseClick("left",285, 395,1,10)
Global $var3 = MouseClick("left",287, 430,1,10)
Global $Var4 = MouseClick("left",293, 460,1,10)


#region Click on the drop-down list and select the next page
MouseClick("left", random(806,819,1),Random(421,501,1),1,10) ;starting click
sleep(random(1500,2000,1))
MouseClick("left", random(169,400,1),Random(230,240,1),1,10) ;click on drop-down list
sleep(random(1500,1700,1))

;Here "counter" $var1 +1
MouseClick("left" ,random(173,445,1),Random(325,343,1),10) ;Click on next page  
sleep(random(900,1200,1))
;MouseClickDrag("left",255, 583,295, 210,10) Moving drop-down list by ten pages.
;sleep(300)


MouseClick("left", random(337,437,1),Random(942,956,1),1,10) ;ending selecting next page
sleep(Random(10000,12000,1)) 
#EndRegion

Best regards, Norbii

Link to post
Share on other sites

Hello Norbiii,

 

welcome to the forum.

 

I have no clue what you want to do. I cannot immagine, what it should be good for placing mouse clicks on random coordinates.

 

What are you trying to do?

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...