Jump to content

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


Recommended Posts

I'm new to AutoIt and so far it seems ok but I have little to no scripting abilities so bare with me here.

I figured before I start work on the script itself which is half done I'd work on a GUI since I figured that would be my biggest hurdle. As you will see most of the work for the GUI is done. It's a very simple straight forward GUI so I was able to get this much done by looking at some examples. Anyway, this is what I need help with...

If you plug in the below code and run the script you will see that it brings up a small GUI. Well, in the right corner of this GUI I'd like to have a single button but one that preforms two functions with changing text if at all possible. So when the script first runs the button would say Start. After you press it the buttons text would change to Stop and when you press stop to stop the script the buttons text would change back to Start.

Is this even possible ?

To help get my point accross of how the button should act I've attached a small program whos single button functions in the way I would like the start / stop button on my GUI to function.

GUICreate(" WoW Vendor Loop",225,40)

$trackmenu = GuiCtrlCreateContextMenu ()
$authoritem = GuiCtrlCreateMenuitem ("Author",$trackmenu)
; next one creates a menu separator (line)
GuiCtrlCreateMenuitem ("",$trackmenu)
$aboutitem = GuiCtrlCreateMenuitem ("About",$trackmenu)
; next one creates a menu separator (line)
GuiCtrlCreateMenuitem ("",$trackmenu)
$exititem = GuiCtrlCreateMenuitem ("Exit",$trackmenu)

GuiSetState()

While 1

    $msg = GuiGetMsg()
If $msg = $exititem Or $msg = -3 Or $msg = -1 Then ExitLoop
If $msg = $authoritem Then Msgbox(0,"Author", "Language:    English" & @CRLF & "Platform:      Win9x/NT" & @CRLF & "Author:         Andrew C. McNamara ( MoreBloodWine@hotmail.com )")
If $msg = $aboutitem Then Msgbox(0,"About","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." & @CRLF & "" & @CRLF & "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.")

WEnd

GUIDelete()

Exit

XuMouse.exe

Link to comment
Share on other sites

  • Moderators

MoreBloodWine,

First, welcome to the AutoIt forums.

A good start - some code to work on and a clear question. I wish some other newcomers would do the same. :)

Although you seem to be doing fine so far, could I recommend 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.

Doing what you want to do in your GUI is really quite simple (if you know the commands to use! :) ):

#include <GUIConstantsEx.au3>

GUICreate(" WoW Vendor Loop", 225, 40)

$trackmenu = GUICtrlCreateContextMenu()
$authoritem = GUICtrlCreateMenuItem("Author", $trackmenu)
; next one creates a menu separator (line)
GUICtrlCreateMenuItem("", $trackmenu)
$aboutitem = GUICtrlCreateMenuItem("About", $trackmenu)
; next one creates a menu separator (line)
GUICtrlCreateMenuItem("", $trackmenu)
$exititem = GUICtrlCreateMenuItem("Exit", $trackmenu)
; Action button
$actionitem = GUICtrlCreateButton("Start", 10, 10, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $exititem, $GUI_EVENT_CLOSE
            ExitLoop
        Case $authoritem
            MsgBox(0, "Author", "Language:    English")
        Case $aboutitem
            MsgBox(0, "About", "Disclaimer")
        Case $actionitem
            _action()
    EndSwitch

WEnd

GUIDelete()

Exit

Func _Action()
    Switch GUICtrlRead($actionitem)
        Case "Start"
            GUICtrlSetData($actionitem, "Stop")  ; <<<<<<<<<<<<<< change button text
            ; whatever you need as start code here
            MsgBox(0, "", "Started")
        Case "Stop"
            GUICtrlSetData($actionitem, "Start")  ; <<<<<<<<<<<<< change button text
            ; whatever you need as stop code here
            MsgBox(0, "", "Stopped")
    EndSwitch
EndFunc   ;==>_Action

I have also introduced the Switch command in place of multiple If lines - it makes life a lot easier as you can see! Please ask if anything is unclear.

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

MoreBloodWine,

First, welcome to the AutoIt forums.

A good start - some code to work on and a clear question. I wish some other newcomers would do the same. :)

Although you seem to be doing fine so far, could I recommend 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.

Doing what you want to do in your GUI is really quite simple (if you know the commands to use! :) ):

#include <GUIConstantsEx.au3>

GUICreate(" WoW Vendor Loop", 225, 40)

$trackmenu = GUICtrlCreateContextMenu()
$authoritem = GUICtrlCreateMenuItem("Author", $trackmenu)
; next one creates a menu separator (line)
GUICtrlCreateMenuItem("", $trackmenu)
$aboutitem = GUICtrlCreateMenuItem("About", $trackmenu)
; next one creates a menu separator (line)
GUICtrlCreateMenuItem("", $trackmenu)
$exititem = GUICtrlCreateMenuItem("Exit", $trackmenu)
; Action button
$actionitem = GUICtrlCreateButton("Start", 10, 10, 80, 30)

GUISetState()

While 1

    Switch GUIGetMsg()
        Case $exititem, $GUI_EVENT_CLOSE
            ExitLoop
        Case $authoritem
            MsgBox(0, "Author", "Language:    English")
        Case $aboutitem
            MsgBox(0, "About", "Disclaimer")
        Case $actionitem
            _action()
    EndSwitch

WEnd

GUIDelete()

Exit

Func _Action()
    Switch GUICtrlRead($actionitem)
        Case "Start"
            GUICtrlSetData($actionitem, "Stop")  ; <<<<<<<<<<<<<< change button text
            ; whatever you need as start code here
            MsgBox(0, "", "Started")
        Case "Stop"
            GUICtrlSetData($actionitem, "Start")  ; <<<<<<<<<<<<< change button text
            ; whatever you need as stop code here
            MsgBox(0, "", "Stopped")
    EndSwitch
EndFunc   ;==>_Action

I have also introduced the Switch command in place of multiple If lines - it makes life a lot easier as you can see! Please ask if anything is unclear.

M23

Thx for the help thusfar, I'll plug your code in now and test it out then I gotta crash big time... gotta go nighty night for a change ;-p

(I tend to stay up late racking my brain over things like this lol...)

I always try to be clear when I can, surprised I was clear tonight though since my brains bout on empty. Anyway, I've done some reading and to borrow a somewhat idiotic quote... its all chinese to me.

Dont get me wrong I get some of it but thats like 1% of what I get... I'm more confortable with HTML and even then I dont understand that to much. Glad to know I am off to a good start though. The script itself that will be plugged into this GUI is almost all but done... I have some fine tweaking to do but this is what it looks like right now.

Just like the GUI it's a fairly small and straight forward so when it comes time to merge it with the GUI I dont imagine much work would need to be done so it operates right "so they play together nice".

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)
        
        MouseClick("right", 460, 388, 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 "Paused"',0,0)
    WEnd
    ToolTip("")
EndFunc
Link to comment
Share on other sites

  • Moderators

MoreBloodWine,

is there a way to stop the popup that comes up every time the start/stop button is pressed ?

Just delete the MsgBox lines in the _action function.

Do not take this the wrong way, but if you have to ask such a simple question then you really do need to learn a bit more about AutoIt before trying to use it seriously - or you are going to get very frustrated! :)

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

Ok so I didnt call it a night yet so sue me lol... You'll find that I take offense to very little. Honestly I didnt even look, I just came out and straight asked, you are right though. I do have and still do need to learn alot before using AutoIt "seriously" as your put it which is why I'm starting with a simple script. The GUI I could have easily waited on... I just tend to jump in a pool without looking at where I'm diving sometimes.

Link to comment
Share on other sites

I wanted to take a slightly different approach with my GUI and menu items so heres what I got now...

It all works ok except for one thing... when you hit the "Start" button I get an error message... and I know my solution is staring me right in the face but I cant seem to figure it out. I've looked in the help section and I cant find anything to help me even though I'm sure it's there. I know I shouldnt try doing GUI's yet form your previous comment but I'd like to think what I've done so far shows that I am learning and am still trying to learn more. Anyway, can you please help me figure out what I'm doing wrong here because when I try to use the "Start" button I'm getting a Variable used without being declared message when to the best of my knowledge I declared it at the top of my script, maybe it's a code placement thing but right now I'm stumped.

Ty for putting up with my noobish attempts and what I'd like to say is an ok GUI attempt for a newb whos only two days into AutoIt.

Ps; What do you think of my new GUI compared to the previous one... grant it the changes are minor but I'd like to think this new version is a bit more professional looking / user friendly.

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

_Main()

Func _Main()
    Local $filemenu, $fileitem, $separator1
    Local $exititem, $disclaimeritem, $authoritem, $programitem, $actionitem
    Local $msg
    #forceref $separator1

    GUICreate(" WoW Vendor Loop", 225, 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)
    $separator1 = GUICtrlCreateMenuItem("", $filemenu)
    $exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
    ; Action button
    $actionitem = GUICtrlCreateButton("Start", 165, 5, 55, 20)

    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 )")
            
            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop

            Case $msg = $exititem
                ExitLoop
            
            Case $msg = $actionitem
                _action()

        EndSelect
    WEnd

    GUIDelete()

    Exit
EndFunc   ;==>_Main
Func _Action()
    Switch GUICtrlRead($actionitem)
        Case "Start"
            GUICtrlSetData($actionitem, "Stop")  ; <<<<<<<<<<<<<< change button text
            ; whatever you need as start code here
        Case "Stop"
            GUICtrlSetData($actionitem, "Start")  ; <<<<<<<<<<<<< change button text
            ; whatever you need as stop code here         
    EndSwitch
EndFunc   ;==>_Action
Link to comment
Share on other sites

  • Moderators

MoreBloodWine,

Spot the difference: :)

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Global $actionitem

_Main()

Func _Main()
    Local $filemenu, $fileitem, $separator1
    Local $exititem, $disclaimeritem, $authoritem, $programitem
    Local $msg
    #forceref $separator1

    GUICreate(" WoW Vendor Loop", 225, 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)
    $separator1 = GUICtrlCreateMenuItem("", $filemenu)
    $exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
    ; Action button
    $actionitem = GUICtrlCreateButton("Start", 165, 5, 55, 20)

    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 )")

            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop

            Case $msg = $exititem
                ExitLoop

            Case $msg = $actionitem
                _action()

        EndSelect
    WEnd

    GUIDelete()

    Exit
EndFunc   ;==>_Main

Func _Action()
    Switch GUICtrlRead($actionitem)
        Case "Start"
            GUICtrlSetData($actionitem, "Stop")  ; <<<<<<<<<<<<<< change button text
            ; whatever you need as start code here
        Case "Stop"
            GUICtrlSetData($actionitem, "Start")  ; <<<<<<<<<<<<< change button text
            ; whatever you need as stop code here
    EndSwitch
EndFunc   ;==>_Action

The answer is here if you cannot find it easily:

The difference between

Global and Local scope matters a HUGE amount.

I hate to sound like a broken record but......

you really do need to learn a bit more about AutoIt

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

MoreBloodWine,

Spot the difference: :)

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Global $actionitem

_Main()

Func _Main()
    Local $filemenu, $fileitem, $separator1
    Local $exititem, $disclaimeritem, $authoritem, $programitem
    Local $msg
    #forceref $separator1

    GUICreate(" WoW Vendor Loop", 225, 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)
    $separator1 = GUICtrlCreateMenuItem("", $filemenu)
    $exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
    ; Action button
    $actionitem = GUICtrlCreateButton("Start", 165, 5, 55, 20)

    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 )")

            Case $msg = $GUI_EVENT_CLOSE
                ExitLoop

            Case $msg = $exititem
                ExitLoop

            Case $msg = $actionitem
                _action()

        EndSelect
    WEnd

    GUIDelete()

    Exit
EndFunc   ;==>_Main

Func _Action()
    Switch GUICtrlRead($actionitem)
        Case "Start"
            GUICtrlSetData($actionitem, "Stop")  ; <<<<<<<<<<<<<< change button text
            ; whatever you need as start code here
        Case "Stop"
            GUICtrlSetData($actionitem, "Start")  ; <<<<<<<<<<<<< change button text
            ; whatever you need as stop code here
    EndSwitch
EndFunc   ;==>_Action

The answer is here if you cannot find it easily:

The difference between

Global and Local scope matters a HUGE amount.

I hate to sound like a broken record but......

M23

Havent looked at anything yet because I wanted to get this reply out there... You can repeat it all you want if you feel it truly helps to say it. However, I know I need to learn more about AutoIt... quite a bit actually but I'd like to think everything I've accomplished thus far shows that I am indeed trying ;-)
Link to comment
Share on other sites

I didnt use the spoilrer ;-p

I "spotted" the difference... I needed to take the $actionitem from line 11 and turn it into a Global $actionitem

I should have spotted this and probably would have if I read more which I am trying to do at the same time while working on my script / GUI. Either way Ty for everything thus far ;-)

Link to comment
Share on other sites

  • Moderators

MoreBloodWine,

Do not worry, I am not going to keep on repeating it - because I know you have taken it on board. :)

Seriously, Autoit is very powerful, but does require a bit of understanding to fully utilise that power. Those of us who are longer-term residents here just get a bit liverish at times when we continually see questions which a short perusal of the Help file or a minimal understanding of the language would solve in an instant.

As I said at the beginning - you are well on the way, but a bit of effort (which I know you are making) will make a huge difference. (Did I just say it again? :) )

Keep up the reading - and do not be afraid to keep asking. Those who try to help themselves are always helped here - it is the "code-it-for-me" brigade who get short shrift.

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

MoreBloodWine,

Do not worry, I am not going to keep on repeating it - because I know you have taken it on board. :P

Seriously, Autoit is very powerful, but does require a bit of understanding to fully utilise that power. Those of us who are longer-term residents here just get a bit liverish at times when we continually see questions which a short perusal of the Help file or a minimal understanding of the language would solve in an instant.

As I said at the beginning - you are well on the way, but a bit of effort (which I know you are making) will make a huge difference. (Did I just say it again? :) )

Keep up the reading - and do not be afraid to keep asking. Those who try to help themselves are always helped here - it is the "code-it-for-me" brigade who get short shrift.

M23

Damn... so does that mean I can't erase it all, forget what I know and ask you to code it all for me from scratch :)

Seriously though, Ty for everything so far ;-)

I will say this though, my biggest hurdle I know for a fact will be once I'm done tweaking my script so it's just perfect will be when it comes time to merge it with the GUI and get them to play nice with eachother heh

Edit: Just askin for a nudge in the right direction on this one ( not asking you to do the work / coding for me ;-p ) because I cant seem to find anything in help but I'm probably just using the wrong keyword. Anyway, where in the "help" might I want to start looking to make the following work ?

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

What I want to do it have the URL open up a new browser window ( not hijack an existing one ) when clicked. Pretty much just like how when you click SciTE Lite Help under help in AutoIt it takes you to http://www.autoitscript.com/autoit3/scite/ but without hijacking a current browser window.

Edited by MoreBloodWine
Link to comment
Share on other sites

  • Moderators

MoreBloodWine,

Look at ShellExecute. :)

M23

Edit. But use a separate function and add the menuitem to your GUIGetMsg loop.

Edited by Melba23

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

MoreBloodWine,

Look at ShellExecute. :)

M23

Edit. But use a separate function and add the menuitem to your GUIGetMsg loop.

Now that I'm finally rested and relaxed I figured I'd work on this heh... Anyway, I got the ShellExecute part figured out.

; Execute iexplore.exe and proceed to Vend-o-matic on curse.com
ShellExecute("iexplore.exe", "http://wow.curse.com/downloads/wow-addons/details/vendomatic.aspx")

Now I just need to work on the menuitem / GUIGetMsg part and the function... so far so good Melba ;-)

Edited by MoreBloodWine
Link to comment
Share on other sites

And the crowd goes wild cheering for MoreBloodWine as he takes a bow in the fact that he finally solved _ShellExecute on his own with no help from anyone other than Melba who pointed him in the right direction :)

Ok, now the question is this... so it appears to work but did I do it right ?

I only ask because even though things appear to work they might not have been done right.

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Global $actionitem

_Main()

Func _Main()
    Local $filemenu, $fileitem, $separator1
    Local $exititem, $disclaimeritem, $authoritem, $programitem, $dlitem
    Local $msg
    #forceref $separator1

    GUICreate(" WoW Vendor Loop", 225, 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)
    $separator1 = GUICtrlCreateMenuItem("", $filemenu)
    $exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
    ; Action button
    $actionitem = GUICtrlCreateButton("Start", 165, 5, 55, 20)
    
    $filemenu = GUICtrlCreateMenu("DL Vend-o-matic")
    $dlitem = GUICtrlCreateMenuItem("http://wow.curse.com/downloads/wow-addons/details/vendomatic.aspx", $filemenu)

    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 )")
            
            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
            ; whatever you need as start code here
        Case "Stop"
            GUICtrlSetData($actionitem, "Start")  ; <<<<<<<<<<<<< change button text
            ; 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,

And very well deserved applause it is too! :)

One point:

While I am lost in admiration for the correct use of #forceref to prevent problems with Au3Check telling you you have never used the $separator1 variable, there is actually no need to declare it in the first place. Although all the GUICtrlCreate* functions return a ControlID, you need only store those you need in a variable - a mere separator need not be stored as you will not use it again (or at least I cannot imagine when you would!) and so the line could read simply:

GUICtrlCreateMenuItem("", $filemenu)

And you can dispense with the #forceref line.

Good luck with the rest of your scripting. If you need help (and if you can discover and correctly use #forceref that seems pretty unlikely! :) ) you know where we are. Feel free to PM if necessary.

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

Pretty unlikely...

You know me so well :)

I'll take a look at it and see if I can somehow manage on my own but it case it turns out to be "pretty unlikely" ill be sure to come knocking on your door ;-p

Edit: Ty for the applause ;-)

Edit 2: I went ahead and deleted #forceref $separator1 and changed $separator1 = GUICtrlCreateMenuItem("", $filemenu) to GUICtrlCreateMenuItem("", $filemenu)

Edited by MoreBloodWine
Link to comment
Share on other sites

I guess all thats left now as far as the GUI is concerned is asking if you can do one thing for me that I can almsot certainly say I'd never be able to do on my own. Least not anytime soon... Anyway, see the pics below ?

Would you be able to do soemthing like this with my GUI ? So next to (left of) the Start/Stop button you would see something similar as below. So when the button reads Start you would see in red " WoW Vendor Loop is not running. " and when the button reads Stop you would see in green " WoW Vendor Loop is running. "

Can this even be done with Autoit ?

Posted Image

Posted Image

#include <GUIConstantsEx.au3>

Opt('MustDeclareVars', 1)

Global $actionitem

_Main()

Func _Main()
    Local $filemenu, $fileitem
    Local $exititem, $disclaimeritem, $authoritem, $programitem, $dlitem
    Local $msg
    
    GUICreate(" WoW Vendor Loop", 225, 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", 165, 5, 55, 20)
    
    $filemenu = GUICtrlCreateMenu("DL Vend-o-matic")
    $dlitem = GUICtrlCreateMenuItem("http://wow.curse.com/downloads/wow-addons/details/vendomatic.aspx", $filemenu)

    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 )")
            
            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
            ; whatever you need as start code here
        Case "Stop"
            GUICtrlSetData($actionitem, "Start")  ; <<<<<<<<<<<<< change button text
            ; 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
Edited by MoreBloodWine
Link to comment
Share on other sites

#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", 225, 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", 165, 5, 55, 20)
    
    $filemenu = GUICtrlCreateMenu("DL Vend-o-matic")
    $dlitem = GUICtrlCreateMenuItem("http://wow.curse.com/downloads/wow-addons/details/vendomatic.aspx", $filemenu)

    $label = GUICtrlCreateLabel("Loop is not running", 8, 8, 150, 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 )")
            
            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, "Loop is running")
            GUICtrlSetBkColor($label, 0x00FF00)
            ; whatever you need as start code here
        Case "Stop"
            GUICtrlSetData($actionitem, "Start")  ; <<<<<<<<<<<<< change button text
            GUICtrlSetData($label, "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

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