Jump to content

a simply clicking bot doesnt work


Recommended Posts

Here is my script that I need help on. It is supposed to click at 3 coordinates and press "-" on a simple click of "start" with a pause button and exit button. please help me and explain what went wrong!

#include <GUIConstants.au3>

#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("NAME", 287, 106, 193, 125)

GUISetBkColor(0x000000)

$Label1 = GUICtrlCreateLabel("NAME", 40, 8, 205, 38)

GUICtrlSetFont(-1, 18, 400, 0, "Ravie")

GUICtrlSetColor(-1, 0xFFFF00)

$Pic1 = GUICtrlCreatePic("C:\Users\USER\Desktop\Egg Machine\Egg.jpg", 192, 48, 52, 52, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$Pic2 = GUICtrlCreatePic("C:\Users\USER\Desktop\Egg Machine\Egg.jpg", 47, 48, 52, 52, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$Button1 = GUICtrlCreateButton("Start!", 104, 56, 81, 33, 0)

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

Global $Paused

HotKeySet( "{PAUSE}", "TogglePause")

HotKeySet( "{DEL}", "Terminate")

Func TogglePause()

$Paused = NOT $Paused

While $Paused

sleep(100)

ToolTip('Script is "Paused"',0,0)

WEnd

ToolTip("")

EndFunc

Func Terminate()

Exit 0

EndFunc

Opt("TrayIconHide", 1)

While

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

Exit

Case $Button1

While

WinActivate("APPLICATION.exe")

Send("{-}")

Sleep(250)

MouseClick("right", 589, 380)

Sleep(500)

MouseClick("right", 587, 451)

Sleep(500)

MouseClick("right", 839, 555)

EndSwitch

WEnd

The stuff in all camps is just the names of the things I have, don't worry I actually have them set. Also I was wondering if you can tell it to open a picture without a file name in the GUI. For example there are 2 of the same pictures in my GUI box and I have specified the file name starting with my C drive, now if I give this program to someone else they will obviously not have the same file name, causing the picture to not show up. Correct? help! Thanks!

Edited by dazzled
Link to comment
Share on other sites

Hello sir.. Uh.. this works to the point where it clicks your 3 points.. and as for the pic.. upload your pictures to photobucket or something and just use the url of the pic in the GUI that should work i think.. so then they can get the pic from anywhere. Or just include the pics in the folder with your script?

#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("NAME", 287, 106, 193, 125)
GUISetBkColor(0x000000)
$Label1 = GUICtrlCreateLabel("NAME", 40, 8, 205, 38)
GUICtrlSetFont(-1, 18, 400, 0, "Ravie")
GUICtrlSetColor(-1, 0xFFFF00)
$Pic1 = GUICtrlCreatePic("", 192, 48, 52, 52)
$Pic2 = GUICtrlCreatePic("", 47, 48, 52, 52)
$Button1 = GUICtrlCreateButton("Start!", 104, 56, 81, 33, 0)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{DEL}", "Terminate")
Func TogglePause()
    $Paused = Not $Paused
    While $Paused
        Sleep(100)
        ToolTip('Script is "Paused"', 0, 0)
    WEnd
    ToolTip("")
EndFunc   ;==>TogglePause
Func Terminate()
    Exit 0
EndFunc   ;==>Terminate
Opt("TrayIconHide", 1)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
                WinActivate("APPLICATION.exe")
                Send("{-}")
                Sleep(250)
                MouseClick("right", 589, 380)
                Sleep(500)
                MouseClick("right", 587, 451)
                Sleep(500)
                MouseClick("right", 839, 555)
        EndSwitch
    WEnd
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...