Lbessy Posted September 1, 2009 Posted September 1, 2009 hey there, I'm pretty new to Autoit and i've figured out how to do some basic things to help automate the game i'm playing, World of Warcraft. I think i'm about as far as i can go in the programming without learning how to do the GUI stuff. I downloaded the GUI creator thing from the sticky at the top of the GUI forums, i've made a GUI with a button. But now i'm trying to figure out how to import it into my code. Here's my code, it simply runs an auto clicker to click the "6" button in wow no matter what window is activated. I want to set up a simple GUI with a Start, and a stop button. This is simply for my learning experience because i can easily click run, and click "pause" to stop it. Thank you for your help. $win_title = "World of Warcraft" WinActivate($win_title, "") WinSetOnTop($win_title, "", 0) Sleep(1000) HotKeySet("{PAUSE}", "EndScript") $i = 0 $win_title = "World of Warcraft" While $i <= 10 ControlSend ( "World of Warcraft", "", "", "6") Sleep(4500) WEnd Func EndScript() $exit = MsgBox(4, "Ender", "Exit the Bot?") If $exit = 6 Then Exit EndIf EndFunc Thanks, -Lbessy P.S. i have created a "simple" GUI i'm just trying to figure out how to import it into the code
Manjish Posted September 2, 2009 Posted September 2, 2009 post ur gui code please. Then I can show you how to integrate ur main script into the gui code. [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Lbessy Posted September 2, 2009 Author Posted September 2, 2009 hey there, I made a quick GUI with 2 buttons, start and stop. How do i get them so start presses key "1" and stop presses key "2". also, once i get that how do i post the code for it? again, i'm using the "Koda FormDesigner"
Manjish Posted September 3, 2009 Posted September 3, 2009 HI what I meant was that post your GUI code in this forum.. That will save me the effort of making 1 for you. Then I ll integrate ur script with it and take you through how we check for button presses and all that.. [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Manjish Posted September 3, 2009 Posted September 3, 2009 Since I am at home and have a festive holiday today , I might as well do this for you.. expandcollapse popup#include <GUIConstantsEx.au3> Global $j=0 Example() HotKeySet("{PAUSE}", "Stop") Func Example() Local $Button_1, $Button_2, $msg GUICreate("My GUI Button") ; will create a dialog box that when displayed is centered Opt("GUICoordMode", 2) $Button_1 = GUICtrlCreateButton("Start", 10, 30, 100) $Button_2 = GUICtrlCreateButton("Stop", 0, -1) GUISetState() ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 If $j=1 Then ControlSend ( "World of Warcraft", "", "", "6") Sleep(4500) EndIf $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 start() ; Will Run/Open Notepad $j=1 Case $msg = $Button_2 stop() EndSelect WEnd EndFunc ;==>Example Func start() MsgBox(4096,"Start","Started Bot") $win_title = "World of Warcraft" WinActivate($win_title, "") WinSetOnTop($win_title, "", 0) Sleep(1000) EndFunc Func Stop() $exit = MsgBox(4, "Ender", "Exit the Bot?") If $exit = 6 Then Exit EndIf EndFunc [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
Lbessy Posted September 3, 2009 Author Posted September 3, 2009 Thank you for the reply, There is a problem though. When i ran the script, the GUI poped up, and "start" workds, but when i pressed stop it wouldn't stop, and when i hit the "x" button at the top of the screen it didn't close the window, <alt> <f4> didn't work to close it. so i had to do <ctrl> <alt> <delete> and end the task. I don't know if it was just a freak thing but it didn't wanna close. Also i'd like to learn how to create a GUI and import it into the code, if you know of a TUT already out there if you could link it that would be great, thank you for all your help -Lbessy
Manjish Posted September 9, 2009 Posted September 9, 2009 (edited) Thank you for the reply, There is a problem though. When i ran the script, the GUI poped up, and "start" workds, but when i pressed stop it wouldn't stop, and when i hit the "x" button at the top of the screen it didn't close the window, <alt> <f4> didn't work to close it. so i had to do <ctrl> <alt> <delete> and end the task. I don't know if it was just a freak thing but it didn't wanna close. Also i'd like to learn how to create a GUI and import it into the code, if you know of a TUT already out there if you could link it that would be great, thank you for all your help-Lbessy I don't have WOW.. So I can't actually test this. The prob u r describing is quite straightforward. Your while loop is getting busy and is not able to check the GUI events like close. I would have solved this, but as I said I can't test it. You will have to learn to troubleshoot.About the tuts, well u will have to download autoit1-2-3 or Learning to script with autoit. You can search these on Gen Help and support forum. (Sorry, I don't have the time to send u the link.)There's always the help file and it's tutorials. You might wanna check those too. Edited September 9, 2009 by Manjish [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
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