Sign in to follow this  
Followers 0
hoocrax

Problems with my pixelbot

6 posts in this topic

Hello all !

Im making this simple tool that clicks a few times enters values and again click.

So, my problems are i want this process to occur at the start immediately ( i set delay as 1 second ) , which is fine till there.

Then i want it to repeat every 4 h 3 min so i set the delay ( sleep(14580000) it works fine too but i want this process to run over again and again for every 4 hours 3 mins. I could figure out how to do that so i just copy pasted it many times which makes the script very lenghty and confusing . I want to know if theres an other alternative to what i decribed above .

And i also notice that it is not possible to exit the program when the sleep command is active .. i wanna know how to fix that too.

#include <GUIConstantsEx.au3>

GUICreate("Skylab Bot 0.1 by hoocrax", 335, 50)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("Resolution:1600x900 Type:PREMIUM", 8, 10)
$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)
While 1
    $msg = GUIGetMsg()
    
    Select
        
        Case $msg = $startbutton
sleep(1000)
MouseMove(401,637)
MouseClick("")
MouseMove(442,641)
MouseClick("")
send("4000")
MouseMove(546,649)
MouseClick("")
sLeep(1000)

sleep(14580000)
MouseMove(401,637)
MouseClick("")
MouseMove(442,641)
MouseClick("")
send("4000")
MouseMove(546,649)
MouseClick("")
sLeep(1000)

sleep(14580000)
MouseMove(401,637)
MouseClick("")
MouseMove(442,641)
MouseClick("")
send("4000")
MouseMove(546,649)
MouseClick("")
sLeep(1000)

sleep(14580000)
MouseMove(401,637)
MouseClick("")
MouseMove(442,641)
MouseClick("")
send("4000")
MouseMove(546,649)
MouseClick("")
sLeep(1000)

sleep(14580000)
MouseMove(401,637)
MouseClick("")
MouseMove(442,641)
MouseClick("")
send("4000")
MouseMove(546,649)
MouseClick("")
sLeep(1000)

sleep(14580000)
MouseMove(401,637)
MouseClick("")
MouseMove(442,641)
MouseClick("")
send("4000")
MouseMove(546,649)
MouseClick("")
sLeep(1000)



Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop

    EndSelect
        
    WEnd

Share this post


Link to post
Share on other sites



Hello Hoocrax,

First Welcome to AutoIt!

Your GUI structure was wrong, not sure how you were seeing your button and and label, however I took a moment to fix that up for you as well. There are a multitude of ways to accomplish the 2 tasks you asked help for. I created a secondary sleep function for you that will poll the GUI for a stop button while still in sleep mode, this will take care of your 2nd question. As for your first question, I have rewritten your code a little to allow your script to run non-stop until the stop button has been pressed. If you want it to run a maximum amount of time you could add a counter and check for that as well.

Hope this helps!

#include <GUIConstantsEx.au3>

GUICreate("Skylab Bot 0.1 by hoocrax", 335, 50)

GUICtrlCreateLabel("Resolution:1600x900 Type:PREMIUM", 8, 10)
$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)
$stopbutton = GUICtrlCreateButton("Stop", 260, 8, 60)

GUISetState(@SW_SHOW)

While 1

    $msg = GUIGetMsg()

    Select
        Case $msg = $startbutton
            While 1
                If SleepCheck(1000) Then ExitLoop;exits loop if a stop code was returned from SleepCheck Function
                MouseClick("left", 401, 637)
                MouseClick("left", 442, 641)
                Send("4000")
                MouseClick("left", 546, 649)
                If SleepCheck(14580000) Then ExitLoop
            WEnd
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
    EndSelect
WEnd

Func SleepCheck($sleeptime)
    $timerInit = TimerInit();grabs your a starting point for your timer
    Do
        $msg = GUIGetMsg();polls to see if the stop button has been pressed
        If $msg = $stopbutton Then Return(1);If stopbutton has been pressed will return 1 for a stop code
        Sleep(10); a very small sleep function to reduce CPU overload...increase if it is still taking up to much CPU
    Until TimerDiff($timerInit) >= $sleeptime;checks to see if the sleep time has elapsed from your initial point
    Return(0)
EndFunc

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry.  

Share this post


Link to post
Share on other sites

Hello Hoocrax,

First Welcome to AutoIt!

Your GUI structure was wrong, not sure how you were seeing your button and and label, however I took a moment to fix that up for you as well. There are a multitude of ways to accomplish the 2 tasks you asked help for. I created a secondary sleep function for you that will poll the GUI for a stop button while still in sleep mode, this will take care of your 2nd question. As for your first question, I have rewritten your code a little to allow your script to run non-stop until the stop button has been pressed. If you want it to run a maximum amount of time you could add a counter and check for that as well.

Hope this helps!

#include <GUIConstantsEx.au3>

GUICreate("Skylab Bot 0.1 by hoocrax", 335, 50)

GUICtrlCreateLabel("Resolution:1600x900 Type:PREMIUM", 8, 10)
$startbutton = GUICtrlCreateButton("Start", 190, 8, 60)
$stopbutton = GUICtrlCreateButton("Stop", 260, 8, 60)

GUISetState(@SW_SHOW)

While 1

    $msg = GUIGetMsg()

    Select
        Case $msg = $startbutton
            While 1
                If SleepCheck(1000) Then ExitLoop;exits loop if a stop code was returned from SleepCheck Function
                MouseClick("left", 401, 637)
                MouseClick("left", 442, 641)
                Send("4000")
                MouseClick("left", 546, 649)
                If SleepCheck(14580000) Then ExitLoop
            WEnd
        Case $msg = $GUI_EVENT_CLOSE
            GUIDelete()
            ExitLoop
    EndSelect
WEnd

Func SleepCheck($sleeptime)
    $timerInit = TimerInit();grabs your a starting point for your timer
    Do
        $msg = GUIGetMsg();polls to see if the stop button has been pressed
        If $msg = $stopbutton Then Return(1);If stopbutton has been pressed will return 1 for a stop code
        Sleep(10); a very small sleep function to reduce CPU overload...increase if it is still taking up to much CPU
    Until TimerDiff($timerInit) >= $sleeptime;checks to see if the sleep time has elapsed from your initial point
    Return(0)
EndFunc

AMAZING !

You are an angel in disguise ! Just worked AWESOME !

MY doubt : im gonna set the same thing for different resolutions.. so i just repeat the whole code you gave above from While 1 to EndFunc and just change mouseclick values to my own?

Share this post


Link to post
Share on other sites

I cannot edit the previous post but i tried to repeat the code for a different button with different pixel values and it is not working :unsure:

Share this post


Link to post
Share on other sites

I got it working, the loop part for different resolutions.. but the stop function does not work :unsure:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.6.1
 Author:         hoocrax

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <GUIConstantsEx.au3>
Opt("WinTitleMatchMode", 2)
GUISetOnEvent($GUI_EVENT_CLOSE, "ExitProgram")
GUICreate("Skylab Bot 0.5 by hoocrax", 600, 600)
GUISetState(@SW_SHOW)
GUICtrlCreateLabel("1600X900 PREMIUM", 10, 35)
GUICtrlCreateLabel("1600X900 NON PREMIUM:", 10, 65)
GUICtrlCreateLabel("1280x720 PREMIUM:", 10, 95)
GUICtrlCreateLabel("1280x720 NON PREMIUM:", 10, 125)
$16premium = GUICtrlCreateButton("SEND PROMERIUM", 200, 30, 180)
$16nonpremium = GUICtrlCreateButton("SEND PROMERIUM", 200, 60, 180)
$12premium = GUICtrlCreateButton("SEND PROMERIUM", 200, 90, 180)
$12nonpremium = GUICtrlCreateButton("SEND PROMERIUM", 200, 120, 180)
$16premiumsell = GUICtrlCreateButton("SEND PROMERIUM + SELL", 400, 30, 180)
$16nonpremiumsell = GUICtrlCreateButton("SEND PROMERIUM + SELL", 400, 60, 180)
$12premiumsell = GUICtrlCreateButton("SEND PROMERIUM + SELL", 400, 90, 180)
$12nonpremiumsell = GUICtrlCreateButton("SEND PROMERIUM + SELL", 400, 120, 180)
$stopbutton = GUICtrlCreateButton("Stop", 260, 8, 60)
While 1

    $msg = GUIGetMsg()

    Select
        Case $msg = $16premiumsell
            While 1
                If SleepCheck(1000) Then ExitLoop;exits loop if a stop code was returned from SleepCheck Function
                WinSetState("[TITLE:www.DarkOrbit.com]", "", @SW_MAXIMIZE)  
                sleep(300)
                MouseClick("left", 799,475)
                sleep(500)
                MouseClick("left", 816,191) 
                sleep(3000)
                MouseClick("left", 401, 637)
                MouseClick("left", 442, 641)
                Send("4000")
                MouseClick("left", 546, 649)
                sleep(4500)
                MouseClick("left", 801,476)
                sleep(1000)
                MouseClick("left", 1028,269)
                MouseClick("left", 451,24)
                MouseClick("left", 451,24)
                sleep(4000)
                MouseClick("left", 792,698)
                sleep(5000)
                MouseClick("left", 1359,100)
                sleep(1500)
                MouseClick("left", 1001,399)
                MouseClick("left", 1001,399)
                sLeep(2000)
                Send("!{F4}")
                If SleepCheck(14580000) Then ExitLoop
            WEnd
        Case $msg = $GUI_EVENT_CLOSE
            
  
        Case $msg = $16premium
            While 1
                If SleepCheck(1000) Then ExitLoop;exits loop if a stop code was returned from SleepCheck Function
                WinSetState("[TITLE:www.DarkOrbit.com]", "", @SW_MAXIMIZE)  
                sleep(300)
                MouseClick("left", 799,475)
                sleep(500)
                MouseClick("left", 816,191) 
                sleep(3000)
                MouseClick("left", 401, 637)
                MouseClick("left", 442, 641)
                Send("4000")
                MouseClick("left", 546, 649)
                sleep(4500)
                MouseClick("left", 801,476)
                sleep(1000)
                If SleepCheck(14580000) Then ExitLoop
            WEnd
        Case $msg = $GUI_EVENT_CLOSE
            
        Case $msg = $12premiumsell
            While 1
                If SleepCheck(1000) Then ExitLoop;exits loop if a stop code was returned from SleepCheck Function
                WinSetState("[TITLE:www.DarkOrbit.com]", "", @SW_MAXIMIZE)  
                sleep(300)
                MouseClick("left", 639,386)
                sleep(500)
                MouseClick("left", 646,197) 
                sleep(3000)
                MouseClick("left", 226,643)
                MouseClick("left", 287,636)
                Send("4000")
                MouseClick("left", 386,649)
                sleep(4500)
                MouseClick("left", 640,384)
                sleep(1000)
                MouseClick("left", 856,272)
                MouseClick("left", 331,21)
                MouseClick("left", 331,21)
                sleep(4000)
                MouseClick("left", 635,580)
                sleep(4500)
                MouseClick("left", 1074,101)
                sleep(2000)
                MouseClick("left", 841,319)
                MouseClick("left", 841,319)
                sLeep(2000)
                Send("!{F4}")
                If SleepCheck(14580000) Then ExitLoop
            WEnd
        Case $msg = $GUI_EVENT_CLOSE
            
        Case $msg = $12premium
           While 1
                If SleepCheck(1000) Then ExitLoop;exits loop if a stop code was returned from SleepCheck Function
                WinSetState("[TITLE:www.DarkOrbit.com]", "", @SW_MAXIMIZE)
                sleep(300)
                MouseClick("left", 639,386)
                sleep(500)              
                MouseClick("left", 646,197) 
                sleep(3000)
                MouseClick("left", 226,643)
                MouseClick("left", 287,636)
                Send("4000")
                MouseClick("left", 386,649)
                sleep(4500)
                MouseClick("left", 640,384)
                sleep(1000)
                If SleepCheck(14580000) Then ExitLoop   
                    WEnd
        Case $msg = $GUI_EVENT_CLOSE
                    
                    
        Case $msg = $16nonpremiumsell
            While 1
                If SleepCheck(1000) Then ExitLoop;exits loop if a stop code was returned from SleepCheck Function
                WinSetState("[TITLE:www.DarkOrbit.com]", "", @SW_MAXIMIZE)  
                sleep(300)
                MouseClick("left", 799,475)
                sleep(500)
                MouseClick("left", 816,191) 
                sleep(3000)
                MouseClick("left", 401, 637)
                MouseClick("left", 442, 641)
                Send("3000")
                MouseClick("left", 546, 649)
                sleep(4500)
                MouseClick("left", 801,476)
                sleep(1000)
                MouseClick("left", 1028,269)
                MouseClick("left", 451,24)
                MouseClick("left", 451,24)
                sleep(4000)
                MouseClick("left", 792,698)
                sleep(4000)
                MouseClick("left", 1359,100)
                sleep(1000)
                MouseClick("left", 1001,399)
                MouseClick("left", 1001,399)
                sLeep(2000)
                Send("!{F4}")
                If SleepCheck(21780000) Then ExitLoop
            WEnd
        Case $msg = $GUI_EVENT_CLOSE
            
  
        Case $msg = $16nonpremium
            While 1
                If SleepCheck(1000) Then ExitLoop;exits loop if a stop code was returned from SleepCheck Function
                WinSetState("[TITLE:www.DarkOrbit.com]", "", @SW_MAXIMIZE)  
                sleep(300)
                MouseClick("left", 799,475)
                sleep(500)
                MouseClick("left", 816,191) 
                sleep(3000)
                MouseClick("left", 401, 637)
                MouseClick("left", 442, 641)
                Send("3000")
                MouseClick("left", 546, 649)
                sleep(4500)
                MouseClick("left", 801,476)
                sleep(1000)
                If SleepCheck(21780000) Then ExitLoop
            WEnd
        Case $msg = $GUI_EVENT_CLOSE
            
        Case $msg = $12nonpremiumsell
           While 1
                If SleepCheck(1000) Then ExitLoop;exits loop if a stop code was returned from SleepCheck Function
                WinSetState("[TITLE:www.DarkOrbit.com]", "", @SW_MAXIMIZE)  
                sleep(300)
                MouseClick("left", 639,386)
                sleep(500)
                MouseClick("left", 646,197) 
                sleep(3000)
                MouseClick("left", 226,643)
                MouseClick("left", 287,636)
                Send("3000")
                MouseClick("left", 386,649)
                sleep(4500)
                MouseClick("left", 640,384)
                sleep(1000)
                MouseClick("left", 856,272)
                MouseClick("left", 331,21)
                MouseClick("left", 331,21)
                sleep(4000)
                MouseClick("left", 635,580)
                sleep(4500)
                MouseClick("left", 1074,101)
                sleep(2000)
                MouseClick("left", 841,319)
                MouseClick("left", 841,319)
                sLeep(2000)
                Send("!{F4}")
                If SleepCheck(21780000) Then ExitLoop
            WEnd
        Case $msg = $GUI_EVENT_CLOSE
            
        Case $msg = $12nonpremium
            While 1
                If SleepCheck(1000) Then ExitLoop;exits loop if a stop code was returned from SleepCheck Function
                WinSetState("[TITLE:www.DarkOrbit.com]", "", @SW_MAXIMIZE)
                sleep(300)
                MouseClick("left", 639,386)
                sleep(500)              
                MouseClick("left", 646,197) 
                sleep(3000)
                MouseClick("left", 226,643)
                MouseClick("left", 287,636)
                Send("3000")
                MouseClick("left", 386,649)
                sleep(4500)
                MouseClick("left", 640,384)
                sleep(1000
                If SleepCheck(21780000) Then ExitLoop   
WEnd
        Case $msg = $GUI_EVENT_CLOSE                    

    
            GUIDelete()
            ExitLoop
    EndSelect
WEnd


Func SleepCheck($sleeptime)
    $timerInit = TimerInit();grabs your a starting point for your timer
    Do
        $msg = GUIGetMsg();polls to see if the stop button has been pressed
        If $msg = $stopbutton Then Return(1);If stopbutton has been pressed will return 1 for a stop code
        Sleep(10); a very small sleep function to reduce CPU overload...increase if it is still taking up to much CPU
    Until TimerDiff($timerInit) >= $sleeptime;checks to see if the sleep time has elapsed from your initial point
    Return(0)
EndFunc

Share this post


Link to post
Share on other sites

Please read the rules on top of the forum

Forum Rules


TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0