PornoRalle Posted July 15, 2007 Posted July 15, 2007 (edited) Hey everyone , I´am new at writing Bots especially using Auto-it. I am currently working on a GW-Bot which i call a "Drunkbot" which takes several flasks of Alcohol during a certain time. The Bot itself works fine but i got Problems with a GUI. At first i want to post the Sourcecode : expandcollapse popup#include <GUIConstants.au3> Opt("GUICoordMode",1) #region - GUI Create GUICreate('Drunkbot') ;controls GUICtrlCreateLabel ("Drunkbot",20,20 ); added for show $Button_1 = GUICtrlCreateButton ("OK", 50, 300, 80); OK Button $Button_2 = GUICtrlCreateButton ("Cancel", 250, 300, 80); Cancel Button GUISetState(@SW_SHOW) #endregion #region - GUI SelectLoop While 1 $msg = GUIGetMsg(@SW_SHOW) Select Case $msg = $GUI_EVENT_CLOSE; $GUI_EVENT_CLOSE Exit Case $msg = $Button_1; Button Ok starts the bot <<------------------------------------------------------------- Func _A() <--------------- Case $msg = $Button_2 MsgBox ( 0 , "Ok..." , "Cya Soon :)" ,10) Exit Case $msg = 1 Case $msg = 1 EndSelect WEnd #endregion ;Functions #region - Functions Func _A() <------------------------------------------------------- Opt("WinWaitDelay",100) Opt("WinTitleMatchMode",4) Opt("WinDetectHiddenText",1) Opt("MouseCoordMode",0) WinWait("Guild Wars","") If Not WinActive("Guild Wars","") Then WinActivate("Guild Wars","") WinWaitActive("Guild Wars","") Sleep(8000) MouseClick("left",1206,933,2) Sleep(1800) MouseClick("left",1206,933,2) Sleep(2100) MouseClick("left",1206,933,2) $count = 0 While $count < 1 Sleep(56270) MouseClick("left",1206,933,2) Sleep(57780) MouseClick("left",1206,933,2) Sleep(58630) MouseClick("left",1206,933,2) Sleep(55310) MouseClick("left",1206,933,2) wEnd EndFunc I marked the Problem with arrows .. so how can i connect the Loop which starts the bot with the Operation after Pressing "$Button1"? At the Time nothing happens after pressing the Button "Ok". greetz Edited July 15, 2007 by PornoRalle
Dieuz Posted July 15, 2007 Posted July 15, 2007 (edited) While 1 $msg = GUIGetMsg(@SW_SHOW) Select Case $msg = $GUI_EVENT_CLOSE; $GUI_EVENT_CLOSE Exit Case $msg = $Button_1; Button Ok starts the bot _A() Case $msg = $Button_2 MsgBox ( 0 , "Ok..." , "Cya Soon :)" ,10) Exit Case $msg = 1 Case $msg = 1 EndSelect WEndReplace Func _A() to _A() Edited July 15, 2007 by Dieuz
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now