Jump to content

Adding Script to button


Yabba
 Share

Recommended Posts

Hello,

Im new to AutoIt and am having some problems.

i created a Gui using Koda and dont know were to put a script i wrote. my Gui has 4 buttons.

the scripts are written for a browser based game so simple mouse clicks at specific locations.

this is my Gui script:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 354, 186, 318, 272)
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\HP_Owner\My Documents\Downloads\BOT.jpg", 0, 0, 353, 185)
GUICtrlCreateButton("", 128, 80, 89, 33, $BS_BITMAP)
GUICtrlSetImage(-1, "C:\Documents and Settings\HP_Owner\My Documents\ATTACKS.bmp", -1) ;this is the button i would like the script on;
GUICtrlCreateButton("", 24, 120, 89, 33, $BS_BITMAP)
GUICtrlSetImage(-1, "C:\Documents and Settings\HP_Owner\My Documents\PLUNDERS.bmp", -1)
GUICtrlCreateButton("", 232, 120, 89, 33, $BS_BITMAP)
GUICtrlSetImage(-1, "C:\Documents and Settings\HP_Owner\My Documents\PROTECTS.bmp", -1)
GUICtrlCreateButton("", 128, 136, 83, 33, $BS_BITMAP)
GUICtrlSetImage(-1, "C:\Documents and Settings\HP_Owner\My Documents\STOP.bmp", -1)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
  Case $GUI_EVENT_CLOSE
   Exit
EndSwitch
WEnd

and this is the code i wish the button to run:

While 1
MouseClick("left",400,630,1)
Sleep(100)
MouseClick("left",660,490,1)
sleep(2000)
MouseClick("left",500,260,1)
Sleep(303000)

WEnd

also is there a way i can make a stop script button because if i start the script it will never end so i need a way to stop it? :)

Thanks in Advance

Yabba @_@

Link to comment
Share on other sites

  • Moderators

I'm unsure where the "come to AutoIt to automate your games" flags are, but it's abundantly clear that no one that comes hear to do so, bothers to read the forum rules before failing.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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