Ravie Posted September 6, 2009 Share Posted September 6, 2009 What Command would I use to pull this off? Would appreciate the help, New to autoit. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("AFK", 591, 213, -1399, 117) $Label1 = GUICtrlCreateLabel("Start", 200, 24, 227, 26) GUICtrlSetFont(-1, 11, 800, 0, "Arial Black") $Button1 = GUICtrlCreateButton("Start WoW", 208, 64, 75, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Anti-AFk", 352, 64, 75, 25, $WS_GROUP) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button2 Exit Case $Button1 Run(@ProgramFilesDir & "\World of Warcraft\WoW.exe") EndSwitch WEnd ;I want to activate this Code below on $Button2, and only when I push Button 2 WinWaitActive( "World Of Warcraft") Sleep(7000) clipput("xxxxxxx") send("^v ") Sleep(300) Send("{TAB}") Sleep(200) Send("xxxxxx") Sleep(900) send("{ENTER}") Sleep(3000) Send("{DOWN}") Sleep(500) send("{ENTER}") Sleep(1800) send("{ENTER}") Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted September 6, 2009 Moderators Share Posted September 6, 2009 Ravie,First, welcome to the Autoit forums.You need to put the code into a function and then call it when your button is pressed. So, place the code between Func...EndFunc statements, give it a name and then add the function name in place of "Exit" in your Case $Button2.But, as you are obviously a complete beginner, I would very strongly suggest reading the Help file carefully (at least the first few sections - Using AutoIt, Tutorials and the first couple of References) - this will help you enormously. You should also look at the excellent tutorials that you will find here and here.Do NOT get disheartened - everyone has to start somewhere. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
shay Posted September 6, 2009 Share Posted September 6, 2009 if i understand u correctly,u want to do X when pressing button 1and Y when pressing button 2try this (part of your code)Case $Button2 ;insert the whole command for button 2 Exit Case $Button1 Run(@ProgramFilesDir & "\World of Warcraft\WoW.exe")hop i helped "If the facts don't fit the theory, change the facts." Albert Einstein Link to comment Share on other sites More sharing options...
Ravie Posted September 6, 2009 Author Share Posted September 6, 2009 Thank you for the fast replys, This helped alot thanks Link to comment Share on other sites More sharing options...
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