Jump to content

Recommended Posts

Posted

What Command would I use to pull this off?

Would appreciate the help, New to autoit.

#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}")
  • Moderators
Posted

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. :D

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

if i understand u correctly,

u want to do X when pressing button 1

and Y when pressing button 2

try 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

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
×
×
  • Create New...