darkwarrior

Automating clicking function

1 post in this topic

I want to automate the clicking of next icon (right arrow) for instagram posts from the web, however, the codes i have right now will close the viewing of posts after clicking just one next arrow to the next post. Can someone tell me what is wrong? Thanks in advance.

 Global $CheckSwap = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")

 Global $MousePrimary, $MouseSecondary

 If $CheckSwap = 1 Then
     $MousePrimary = "right"
     $MouseSecondary = "left"
 Else
     $MousePrimary = "left"
     $MouseSecondary = "right"
 EndIf

 Global $ExitKey = "^!x"
 Global $Color = 0xb3b3b3
 Global $Left = 0
 Global $Top = 0
 Global $Right = 1174
 Global $Bottom = 392
 Global $ClickMouse = $MousePrimary
 Global $SearchResult

 HotKeySet($ExitKey, '_Exit')

 While 1
     $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color)

     If Not @error Then
         MouseClick($ClickMouse, $SearchResult[0], $SearchResult[1], 1, 70)
     EndIf
 WEnd

 Func _Exit()
     Exit
 EndFunc

Share this post


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