Jump to content
Sign in to follow this  
stagius24

Auto click a spot every 2 hours

Recommended Posts

stagius24

Hi,

I had no background in programming, so please ignore my ignorant.

Basically, I want to design a script that can click on a certain spot every 2 hours. It is a flash game, so I guess I must differentiate the pixel so that the program know where to click on.

I found an example script that show how to click on a spot based on color. Does this work with entire flash page too?

Dim $ClickMouse, $MousePrimary, $MouseSecondary, $ExitKey
Dim $Color, $Left, $Top, $Right, $Bottom, $SearchResult, $CheckSwap

$CheckSwap = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
If $CheckSwap = 1 Then
    $MousePrimary = "right"
    $MouseSecondary = "left"
Else
    $MousePrimary = "left"
    $MouseSecondary = "right"
EndIf

; *************************************************;
; Change your settings here                     ;
; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv;
$ExitKey = "{ESC}"
$Color = 0xff00ff
$Left = 0
$Top = 0
$Right = 200
$Bottom = 200
$ClickMouse = $MousePrimary
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^;
; Change your settings here                     ;
; *************************************************;

HotKeySet($ExitKey, '_Exit')

While 1
    $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color)
    If Not @error Then
        MouseClick($ClickMouse, $SearchResult[0], $SearchResult[1], 1, 0)
    EndIf
WEnd

Func _Exit()
    Exit
EndFunc

In the "check your setting part". How does it setting work? What does it mean to say left= 200? .. etc.

Next thing I want to know is how to set a timer so this script can do all over again every 2 hours?

Again, I am sorry if my ignorant annoy you. Please help me with script or ideas.

THank you

Share this post


Link to post
Share on other sites
Qousio

Hi,

I had no background in programming, so please ignore my ignorant.

Basically, I want to design a script that can click on a certain spot every 2 hours. It is a flash game, so I guess I must differentiate the pixel so that the program know where to click on.

I found an example script that show how to click on a spot based on color. Does this work with entire flash page too?

Dim $ClickMouse, $MousePrimary, $MouseSecondary, $ExitKey
Dim $Color, $Left, $Top, $Right, $Bottom, $SearchResult, $CheckSwap

$CheckSwap = RegRead("HKEY_CURRENT_USER\Control Panel\Mouse", "SwapMouseButtons")
If $CheckSwap = 1 Then
    $MousePrimary = "right"
    $MouseSecondary = "left"
Else
    $MousePrimary = "left"
    $MouseSecondary = "right"
EndIf

; *************************************************;
; Change your settings here         ;
; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv;
$ExitKey = "{ESC}"
$Color = 0xff00ff
$Left = 0
$Top = 0
$Right = 200
$Bottom = 200
$ClickMouse = $MousePrimary
; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^;
; Change your settings here         ;
; *************************************************;

HotKeySet($ExitKey, '_Exit')

While 1
    $SearchResult = PixelSearch($Left, $Top, $Right, $Bottom, $Color)
    If Not @error Then
        MouseClick($ClickMouse, $SearchResult[0], $SearchResult[1], 1, 0)
    EndIf
WEnd

Func _Exit()
    Exit
EndFunc

In the "check your setting part". How does it setting work? What does it mean to say left= 200? .. etc.

Next thing I want to know is how to set a timer so this script can do all over again every 2 hours?

Again, I am sorry if my ignorant annoy you. Please help me with script or ideas.

THank you

Just click F1 and read the help ....

MouseClick ( "button" [, x, y [, clicks [, speed ]]] )

PixelSearch ( left, top, right, bottom, color [, shade-variation [, step [, hwnd]]] )

I hope that explained everything to you.

If you just want a script that clicks a certain spot every 2 hours, use:

While 1
$Pixels = PixelSearch ( left, top, right, bottom, color, shade-variation, step, hwnd )
MouseClick ( "button", $Pixels[0], $Pixels[1], clicks, speed )
Sleep(7200000)
Wend

If you don't know how to find the coordinates and colour, use this:

HotKeySet("{ESC}", "Terminate");Выкл.                                                                                           
HotKeySet("{F9}", "ShowMe");Вкл.
Dim $Runner

While 1;Ждет пока запустится $Runner.
    Sleep(20)
    If $Runner Then Start()
    WEnd
    
Func ShowMe();Для включения.                                                                                        
    $Runner = Not $Runner
EndFunc                          
Func Terminate();Для выключения.
    Exit 0
EndFunc 
Func Start()
    Sleep(100)
$pos = MouseGetPos()
sleep(100)
$var = PixelGetColor($pos[0], $pos[1]);Берет цвет
sleep(100)
MsgBox(0,"The coordinates are", $pos[0] & "," & $pos[1])
Msgbox(0,"The decmial color is", $var )
EndFunc

Start the script, move your mouse to the button you want to click, press F9 and it will show you the colour and location of that button.

Edited by Qousio

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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.