Jump to content

New to the site but need a bit of GUI help...


Recommended Posts

And you did good start with Autoit.

Thx, I suppose my last big hurdle will be to merge the script with the GUI and I know for a fact thats something I would need either yours or Melbas help with. The script is pretty much done... but if you dont mind me asking for one last favor then would you care to take a crack at merging it with the GUI Zed ?

Any questions please dont hesitate to ask.

If the Pause/Break function "hot key" needs to be removed to make the script work with the single action Start n Stop button then fine but if it can be tied to the button and leave the hot key intact then even better. Either way ty for trying this if you dont mind ;-)

Here's the Script

Opt("MouseCoordMode", 1)        ;1=absolute, 0=relative, 2=client

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")

; default is a paused script
TogglePause()


While 1

    While NOT $Paused
        ToolTip('WoW Vendor Loop is " Running "',0,0)
        
        $Pos = MouseGetPos() 
        MouseClick("right", $pos[0], $pos[1], 1) ; 1 right click at location x,y
        Sleep(10000) ; sleep 10 seconds

        Send("{ESC}") ; press esc
        Sleep(5000) ; sleep 5 seconds
    WEnd

WEnd

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
        ToolTip('WoW Vendor Loop is " Not Running "',0,0)
    WEnd
    ToolTip("")
EndFunc

Here's the GUI

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Global $actionitem, $label 

_Main()

Func _Main()
    Local $filemenu, $fileitem
    Local $exititem, $disclaimeritem, $authoritem, $programitem, $dlitem
    Local $msg
    
    GUICreate(" WoW Vendor Loop", 245, 50)

    $filemenu = GUICtrlCreateMenu("File")
    $disclaimeritem = GUICtrlCreateMenuItem("Disclaimer", $filemenu)
    $programitem = GUICtrlCreateMenuItem("Program Function", $filemenu)
    $authoritem = GUICtrlCreateMenuItem("Author Info", $filemenu)
    ; next one creates a menu separator (line)
    GUICtrlCreateMenuItem("", $filemenu)
    $exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
    ; Action button
    $actionitem = GUICtrlCreateButton("Start", 185, 5, 55, 20)
    
    $filemenu = GUICtrlCreateMenu("DL Vend-o-matic")
    $dlitem = GUICtrlCreateMenuItem("http://wow.curse.com/downloads/wow-addons/details/vendomatic.aspx", $filemenu)

    $label = GUICtrlCreateLabel("  WoW Vendor Loop is not running.", 8, 8, 170, 15)
    GUICtrlSetBkColor($label, 0xFF0000)
    GUISetState()

    While 1
        $msg = GUIGetMsg()

        Select
            Case $msg = $disclaimeritem
                MsgBox(0, "Disclaimer", "Disclaimer:" & @CRLF & "       This program is a fine line issue since it can effectively allow un-attended" & @CRLF & "vendor buying / botting. So use at your own risk unless you want to take the" & @CRLF & "off chance of not being caught and banned or suspended by a GM. So please" & @CRLF & "when possible always use this program while at your keyboard. In either case," & @CRLF & "the author of this program assumes no responsibility what so ever of how you" & @CRLF & "use or even misuse his program.")
                
            Case $msg = $programitem
                MsgBox(0, "Program Function", "Program Function:" & @CRLF & "       This program serves no real function unless you have the Vend-o-matic mod" & @CRLF & "as it will just open and close a vendors bag every 15 seconds. Its main function" & @CRLF & " is to help automate the buying of items from World of Warcraft vendors while" & @CRLF & "working along side the Vend-o-matic mod from the curse.com website.")
                
            Case $msg = $authoritem
                MsgBox(0, "Author Info", "Language:    English" & @CRLF & "Platform:      Win9x/NT" & @CRLF & "Author:         Andrew C. McNamara ( MoreBloodWine@hotmail.com )" & @CRLF & "" & @CRLF & "Support:       Melba23 & Zedna of the AutoIt scripting forums.")
            
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop

            Case $msg = $exititem
                ExitLoop
            
            Case $msg = $actionitem
                _action()
                
            Case $msg = $dlitem
                _ShellExecute()
            
        EndSelect
    WEnd

    GUIDelete()

    Exit
EndFunc   ;==>_Main

Func _Action()
    Switch GUICtrlRead($actionitem)
        Case "Start"
            GUICtrlSetData($actionitem, "Stop")  ; <<<<<<<<<<<<<< change button text
            GUICtrlSetData($label, "  WoW Vendor Loop is running.")
            GUICtrlSetBkColor($label, 0x00FF00)
            ; whatever you need as start code here
        Case "Stop"
            GUICtrlSetData($actionitem, "Start")  ; <<<<<<<<<<<<< change button text
            GUICtrlSetData($label, "  WoW Vendor Loop is not running.")
            GUICtrlSetBkColor($label, 0xFF0000)
            ; whatever you need as stop code here         
    EndSwitch
EndFunc   ;==> _Action

Func _ShellExecute()
    ShellExecute("iexplore.exe", "http://wow.curse.com/downloads/wow-addons/details/vendomatic.aspx")
EndFunc
Link to comment
Share on other sites

  • Moderators

MoreBloodWine,

If you get stuck here is my version. There are quite a few changes to make everything fit together nicely - I have commented them so you can see where and why I have changed things:

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)
Opt("MouseCoordMode", 1)        ;1=absolute, 0=relative, 2=client

Global $actionitem, $exititem, $label, $Paused = False  ; <<<<<<<<<<<<<<<<<<<<<<<<<<< Set $Paused as False when you declare it
HotKeySet("{PAUSE}", "TogglePause")

_Main()

Func _Main()
    Local $filemenu, $fileitem
    Local $disclaimeritem, $authoritem, $programitem, $dlitem
    Local $msg

    GUICreate(" WoW Vendor Loop", 245, 50)

    $filemenu = GUICtrlCreateMenu("File")
    $disclaimeritem = GUICtrlCreateMenuItem("Disclaimer", $filemenu)
    $programitem = GUICtrlCreateMenuItem("Program Function", $filemenu)
    $authoritem = GUICtrlCreateMenuItem("Author Info", $filemenu)
    ; next one creates a menu separator (line)
    GUICtrlCreateMenuItem("", $filemenu)
    $exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
    ; Action button
    $actionitem = GUICtrlCreateButton("Start", 185, 5, 55, 20)

    $filemenu = GUICtrlCreateMenu("DL Vend-o-matic")
    $dlitem = GUICtrlCreateMenuItem("http://wow.curse.com/downloads/wow-addons/details/vendomatic.aspx", $filemenu)

    $label = GUICtrlCreateLabel("  WoW Vendor Loop is not running.", 8, 8, 170, 15)
    GUICtrlSetBkColor($label, 0xFF0000)

    GUISetState()

    While 1
        Switch GUIGetMsg() ; <<<<<<<<<<<<<< Use Switch, not Select - see below for why!
            Case $disclaimeritem
                MsgBox(0, "Disclaimer", "Disclaimer:" & @CRLF & "       This program is a fine line issue since it can effectively allow un-attended" & @CRLF & "vendor buying / botting. So use at your own risk unless you want to take the" & @CRLF & "off chance of not being caught and banned or suspended by a GM. So please" & @CRLF & "when possible always use this program while at your keyboard. In either case," & @CRLF & "the author of this program assumes no responsibility what so ever of how you" & @CRLF & "use or even misuse his program.")

            Case $programitem
                MsgBox(0, "Program Function", "Program Function:" & @CRLF & "       This program serves no real function unless you have the Vend-o-matic mod" & @CRLF & "as it will just open and close a vendors bag every 15 seconds. Its main function" & @CRLF & " is to help automate the buying of items from World of Warcraft vendors while" & @CRLF & "working along side the Vend-o-matic mod from the curse.com website.")

            Case $authoritem
                MsgBox(0, "Author Info", "Language:    English" & @CRLF & "Platform:      Win9x/NT" & @CRLF & "Author:         Andrew C. McNamara ( MoreBloodWine@hotmail.com )" & @CRLF & "" & @CRLF & "Support:       Melba23 & Zedna of the AutoIt scripting forums.")

            Case $GUI_EVENT_CLOSE, $exititem ; <<<<<<<<< because it lets you have multiple choices in a Case !!
                ExitLoop

            Case $actionitem
                _action()

            Case $dlitem
                _ShellExecute()

        EndSwitch
    WEnd

    GUIDelete()

    Exit
EndFunc   ;==>_Main

Func _Action()

    Local $iBegin

    Switch GUICtrlRead($actionitem)
        Case "Start"
            GUICtrlSetData($actionitem, "Stop")

            ; <<<<<<<<<<<<<<<<<<<<<<<<<<<< Your original script starts here
            While 1
                If $Paused Then ; <<<<<<<<<<<<<<< Pause is set, so write label and then look for Stop or Exit

                    If GUICtrlRead($label) <> "  WoW Vendor Loop is Paused." Then
                        GUICtrlSetData($label, "  WoW Vendor Loop is Paused.")
                        GUICtrlSetBkColor($label, 0xFFFF00)
                    EndIf
                    ToolTip('WoW Vendor Loop is Paused',0,0)
                    If Action_Check() Then ContinueCase ; <<<<<<<<<<< If Stop button pressed, move to that Case
                Else ; Run the Vendor Loop
                    GUICtrlSetData($label, "  WoW Vendor Loop is Running.")
                    GUICtrlSetBkColor($label, 0x00FF00)
                    ToolTip('WoW Vendor Loop is Running',0,0)

                    ConsoleWrite("Running Vendor Loop Pt1" & @CRLF)
                    ;Local $Pos = MouseGetPos()
                    ;MouseClick("right", $pos[0], $pos[1], 1) ; 1 right click at location x,y

                    ;Sleep(10000) ; sleep 10 seconds ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<< Makes script unresponsive - better to have a loop as follows
                    $iBegin = TimerInit()
                    While TimerDiff($iBegin) < 10000
                        If Action_Check() Then ContinueCase ; <<<<<<<<<<< If Stop button pressed, move to that Case
                    WEnd

                    ConsoleWrite("Running Vendor Loop Pt2" & @CRLF)
                    ;Send("{ESC}") ; press esc

                    ;Sleep(5000) ; sleep 5 seconds ; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<  Makes script unresponsive - better to have a loop as above
                    $iBegin = TimerInit()
                    While TimerDiff($iBegin) < 5000
                        If Action_Check() Then ContinueCase ; <<<<<<<<<<< If Stop button pressed, move to that Case
                    WEnd
                EndIf
            WEnd

        Case "Stop"
            GUICtrlSetData($actionitem, "Start")
            GUICtrlSetData($label, "  WoW Vendor Loop is not running.")
            GUICtrlSetBkColor($label, 0xFF0000)
            ToolTip("")
            $Paused = False ; <<<<<<<<<<<<<<<<<<<<< Reset any paused condition
    EndSwitch
EndFunc   ;==> _Action

Func _ShellExecute()
    ShellExecute("iexplore.exe", "http://wow.curse.com/downloads/wow-addons/details/vendomatic.aspx")
EndFunc

Func TogglePause()
    If GUICtrlRead($actionitem) = "Start" Then Return ; <<<<<<<<<<<<<<<<<<<<<< No point in pausing if Vendor Loop is not running
    $Paused = NOT $Paused
    If $Paused Then ToolTip('WoW Vendor Loop will Pause',0,0) ; <<<<<<<<<<<<<< The script will pause AFTER current cycle of the vendor loop
EndFunc

Func Action_Check()
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE, $exititem
            Exit ; <<<<<<<<<<<<<<<<<<<<<<<<<< Exit if [X] or menu clicked
        Case $actionitem
            Return 1  ; <<<<<<<<<<<<<<<< The Stop button was pressed, so return a flag
    EndSwitch
    Return 0 ; <<<<<<<<<<<<<<<<<<<<<<<<< Nothing pressed so ensure no flag returned
EndFunc

Let me know if it this is not how you imagined it working - it should be pretty easy to adjust.

But no peeking until you have tried for yourself! :)

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

 

Link to comment
Share on other sites

I promise not to peak, much. By that I just mean I might have to peak a few lines just to get a start or idea or where to try and begin.

Edit: In either case I just wanted to thank you and Zedna again for everything you guys have helped me with so far. If you didnt noticed I credited you both in the "Author Notes".

Nice angry face above btw hehe

Edited by MoreBloodWine
Link to comment
Share on other sites

Quick question while I work on embedding the script into the GUI myself without peeking more than the few lines I said I would. This kinda hit/came to me lastnight but when you build/compiled ones script into an EXE is it possible to excrypt it so it can be backwords engineered for lack of a better term.

So like if someone excrypted their EXE i wouldnt be able to turn the EXE into a script with AutoIts conversion thing.

Link to comment
Share on other sites

  • Moderators

MoreBloodWine,

Searching the forums will provide you with a lot more information in greater detail, but in brief:

- Your plain language script is within the compiled .exe, but in compressed form. It is not immediately viewable with a hex editor, but is by no means secure as it is expanded in memory when the .exe is run.

- Obfuscator (part of the full SciTE4AutoIt3 package) will obscure your script by changing variable and constant names (and a lot more!), which makes it harder to decompile but again does not render the .exe secure.

So, compiling an Autoit script will prevent quick snooping, but a determined, experienced hacker can relatively easily get your source - including passwords, specific filenames, etc.

AutoIt is NOT a secure language (any more than any other).

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

 

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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