Sign in to follow this  
Followers 0
Newb

Functions overriding buttons but not hotkeys

16 posts in this topic

#1 ·  Posted (edited)

Sorry for posting but i wasn't able to find it on the forum.

I made a little program which automates some functions on my pc.

I've set 3 hotkeys. f1 starts the script, f2 pauses/unpauses it, f3 closes it.

When i use hotkeys, all fine.The script goes, starts, pauses and exit normally. I set up some buttons on the gui too to make the thing more comfortable. At first i named the buttons handles like the function that they activates and there i got the first problem, so i had to change the button handle names because it messed up the script.

Example

$Exit=GuiCtrlCreateButton (etc etc)

Func Exit()

Exit

Endfunc

Same button name, same function name. So i put button name something like $ButtonExit=etc etc

(Saying this in case it might be useful to some reader)

The real problem is this:

$Buttonstart = GUICtrlCreateButton("Start", 176, 8, 49, 25, $WS_GROUP)
$Buttonpause = GUICtrlCreateButton("Pause", 176, 48, 49, 25, $WS_GROUP)
$ButtonExit = GUICtrlCreateButton("Exit", 176, 88, 49, 25, $WS_GROUP)

HotKeySet("{F1}","Start")
HotKeySet("{F2}","Pause")
HotKeySet("{F3}","Close")

Func Start()
blah blah
Endfunc

Func Pause()
blah blah
Endfunc

Func Exit()
blah blah
Endfunc

Button are in a standard GuiGetMsg() gui

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit

    EndSwitch
WEnd

So with the hotkeys all is fine, program runs normally, but with buttons, I can start it, but I can't pause/exit, it seems stuck with the ongoing function...

What's the matter?

Edited by Newb

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites



Newb,

HotKeys will interrupt a running function - normal GUI controls do not unless you take some special actions.

Look at the Interrupting a running function tutorial in the Wiki to see how to get the buttons to work as you wish. :x

As to the naming matter:

$Exit=GuiCtrlCreateButton (etc etc)
Func Exit()

using existing Keyword/Command names as script function names is quite likely to end up in tears - good call to change. There should be no problem with the ControlID variables, but I do tend to avoid it if possible. :P

6*M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Newb,

HotKeys will interrupt a running function - normal GUI controls do not unless you take some special actions.

Look at the Interrupting a running function tutorial in the Wiki to see how to get the buttons to work as you wish. :x

As to the naming matter:

$Exit=GuiCtrlCreateButton (etc etc)
Func Exit()

using existing Keyword/Command names as script function names is quite likely to end up in tears - good call to change. There should be no problem with the ControlID variables, but I do tend to avoid it if possible. :shifty:

6*M23

Well, Thanks a lot Melba23, but I didn't got almost nothing from those articles... Just can't understand them :P

I'll think I'll do in another way, which it may be not good to look, unprofessional or slower, but easier to me.

If you want to eplain me better how the script blocking part works I will be glad to read it. Until then, my solution will be like this:

Func Start()
    While 1
        If $State=1 Then
        Else
        $Stato=1
                Execute function
                Check if $State is changed to 0, If it is then Exitloop, Else keep going on till it wont hit this line of code again
Endfunc

What you think about this?

Edited by Newb

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

Newb,

As I wrote the tutorial, I do not know how to explain it more clearly! :P

However, your suggested solution looks as if it will suffer from the same problem - how do you get the value of $State to change while the function is running? You can do it via a HotKey, but to get the buttons to work you need a message handler as explained (obviously not well enough) in the tutorial.

Let us try and understand what is going on in small steps. Firstly, what is a message handler?

Purist/pedant warning - Look away now! :shifty:

Whenever you do anything in Windows it generates a message which is sent to the affected GUI so it knows what to do. Take clicking on a button within a GUI - AutoIt knows when you have clicked on a button because Windows sends a message saying so. Normally we react to the button press by using a GUIGetMsg loop or setting an GUICtrlSetOnEvent function. But we can also react directly to the message - which is what AutoIt does internally so it knows when to action the code we set for that control. GUIRegisterMsg lets us do the same thing as AutoIt - intercepting the message directly. When a button is pressed it sends out a WM_COMMAND message, so we need to intercept any such messages and see if they come from our button:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

$hButton = GUICtrlCreateButton("Push Me", 10, 10, 80, 30)

GUISetState()

; Intercept Windows WM_COMMAND messages with our own handler
GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

; Here is the handler which intercepts the WM_COMMAND messages
Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    
    ; Check if it was our button was pressed and sent the message
    If BitAND($wParam, 0x0000FFFF) =  $hButton Then
        ; It was - so tell us about it
        MsgBox(0, "Button" , "Pushed!")
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

As you can see, we get an indication that the button was pressed without having to use GUIGetMsg or GUICtrlSetOnEvent.

Do you follow so far? :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Newb,

As I wrote the tutorial, I do not know how to explain it more clearly! :P

However, your suggested solution looks as if it will suffer from the same problem - how do you get the value of $State to change while the function is running? You can do it via a HotKey, but to get the buttons to work you need a message handler as explained (obviously not well enough) in the tutorial.

Let us try and understand what is going on in small steps. Firstly, what is a message handler?

Purist/pedant warning - Look away now! :nuke:

Whenever you do anything in Windows it generates a message which is sent to the affected GUI so it knows what to do. Take clicking on a button within a GUI - AutoIt knows when you have clicked on a button because Windows sends a message saying so. Normally we react to the button press by using a GUIGetMsg loop or setting an GUICtrlSetOnEvent function. But we can also react directly to the message - which is what AutoIt does internally so it knows when to action the code we set for that control. GUIRegisterMsg lets us do the same thing as AutoIt - intercepting the message directly. When a button is pressed it sends out a WM_COMMAND message, so we need to intercept any such messages and see if they come from our button:

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$hGUI = GUICreate("Test", 500, 500)

$hButton = GUICtrlCreateButton("Push Me", 10, 10, 80, 30)

GUISetState()

; Intercept Windows WM_COMMAND messages with our own handler
GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

; Here is the handler which intercepts the WM_COMMAND messages
Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    
    ; Check if it was our button was pressed and sent the message
    If BitAND($wParam, 0x0000FFFF) =  $hButton Then
        ; It was - so tell us about it
        MsgBox(0, "Button" , "Pushed!")
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

As you can see, we get an indication that the button was pressed without having to use GUIGetMsg or GUICtrlSetOnEvent.

Do you follow so far? :x

M23

No. :shifty:

I got all the explanation about the message sending, but the code you put, well i can't get nothing of it, even with comments. I wasn't even able to implement it in my script... Duh.... Trying to re read the guide you gave me before, but... nothing. The problem is to implement the code in my script, i really didn't understand what those functions are...

GUISetState() is for drawing an empty GUI? or what?

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND") No idea of what's this

and this (read comments), well, where i have to put this? and what should i put instead of the message box? My function call? or What?

Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam); I don't see where these parameters got passed to function

    ; Check if it was our button was pressed and sent the message
    If BitAND($wParam, 0x0000FFFF) =  $hButton Then;Yeah got this, If buttonpressed is my button then do msgbox
        ; It was - so tell us about it
        MsgBox(0, "Button" , "Pushed!")
    EndIf
    Return $GUI_RUNDEFMSG;What the hell is this??
EndFunc   ;==>_WM_COMMAND

Do i have to post my script source


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Sorry for the double post, but I needed to make a new clear one, which I will edit in case of need. I did it also because I wanted to make the post complete in case someone find himself in the same situation.

Thanks Melba23, I wanted to make this new post because I wanted to update and inform you that I grasped the concept and understood how it works.

Today my mind was overloaded and very tired because I passed all the afternoon trying to solve that problem so I was a bit messed up and not able to read articles clearly and with the needed concentration.

Tonight (it's in the night that I learn the best) I put up some music and try to read the whole articles about Interrupting a function and GuiRegisterMsg. Then with fresh mind, in about 20-30 minutes of trying and reading, i got the whole thing and almost achieved to implement it in my code.

So, I got how to grab windows messages and pass them to the function, checking wheter a button is pressed or not. Anyway the problem still persist. From what I understood it's because I have to put some kind of checkpoint into the function I want to interrupt.

So tomorrow I will try to put that checkpoint and see what's wrong. Thanks again for your help.

EDIT: Nothing :x I don't get to make those buttons work. Posting reduced version of the code, trying to underline what should be useful to solve the problem:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$GuiPrincipale = GUICreate("Renderizer", 227, 121, 192, 124)
GUICtrlCreateLabel("Auto rendering", 24, 8, 130, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Istruzioni = GUICtrlCreateButton("Instructions", 8, 64, 57, 25, $WS_GROUP)
GUICtrlCreateLabel("STATE:", 16, 32, 68, 17)
$LabelStato = GUICtrlCreateLabel("OFF", 96, 32, 72, 18, BitOR($SS_CENTER,$SS_SUNKEN))
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlCreateLabel("Interval:", 8, 96, 50, 17)
$Intervallo = GUICtrlCreateInput("3", 64, 96, 25, 21)
$BStart = GUICtrlCreateButton("Start", 176, 8, 49, 25, $WS_GROUP)
$BPause = GUICtrlCreateButton("Pause", 176, 48, 49, 25, $WS_GROUP)
$BUscita = GUICtrlCreateButton("Exit", 176, 88, 49, 25, $WS_GROUP)
GUISetState(@SW_SHOW)
GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")
HotKeySet("{F1}","Start")
HotKeySet("{F2}","Pause")
HotKeySet("{F3}","Close")
$Pause1=False
$Stato=0;0=OFF 1=Active 2=In Pause

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Istruzioni
            GUISetState(@SW_DISABLE,$GuiPrincipale)
            MsgBox(0,"BlahBlahBlah","STUFFSTUFFSTUFFSTUFF")
            GuisetState(@SW_ENABLE,$GuiPrincipale)
            GUISetState(@SW_RESTORE,$GuiPrincipale)
    EndSwitch
WEnd

Func Pause()
    If $Stato=0 Then
        Sleep(10)
    Else
    $Pause1= Not $Pause1
    $Stato=2
    Check()
    While $Pause1
        Sleep(100)
    WEnd
    $Stato=1
    Check()
    EndIf
EndFunc

Func Check()
    If $Stato=0 Then
        GUICtrlSetBkColor($LabelStato,0xFF0000)
        GUICtrlSetData($LabelStato,"OFF")
    ElseIf $Stato=1 Then
        GUICtrlSetBkColor($LabelStato,0x00FF00)
        GUICtrlSetData($LabelStato,"ON")
    Elseif $Stato=2 Then
        GUICtrlSetBkColor($LabelStato,0x999999)
        GUICtrlSetData($LabelStato,"In Pause")
    EndIf
EndFunc

Func Start()
    While 1
        If $Stato=1 Then
            $Stato=0
            ConsoleWrite($STato)
            Check()
            ExitLoop
        Else
            $Stato=1
            If Not IsNumber(Number(GUICtrlRead($Intervallo))) Or Number(GUICtrlRead($Intervallo))=0 Then
                GUISetState(@SW_DISABLE,$GuiPrincipale)
                MsgBox(0,"Valore Intervallo Errato","Non hai messo un valore valido nell'intervallo, Il valore verrà ora resettato")
                GUICtrlSetData($Intervallo,"3")
                GuisetState(@SW_ENABLE,$GuiPrincipale)
                GUISetState(@SW_RESTORE,$GuiPrincipale)
                ExitLoop
            EndIf
            Check()
            MouseClick("left",100,300)
            Sleep(1000)
            MouseClick("left",105,306)
            Sleep(1000)
            MouseClick("left",123,347)
            Sleep(1000)
            MouseClick("left",103,368)
            Sleep(1000)
            MouseClick("left",105,309)
            Sleep(1000)
            MouseClick("left",106,300)
            Sleep(1000)
        EndIf
    Wend
EndFunc

Func Close()
    Exit
EndFunc


Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)

    ; Check if it was our button was pressed and sent the message
    If BitAND($wParam, 0x0000FFFF) =  $BStart Then
        Start()
    ElseIf BitAND($wParam, 0x0000FFFF) =  $BPause Then
        Pause()
    ElseIf BitAND($wParam, 0x0000FFFF) =  $BUscita Then
        Close()
    EndIf
    Return $GUI_RUNDEFMSG
EndFunc   ;==>_WM_COMMAND

Sorry if long, tried to make it as small as i could.

Edited by Newb

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

Newb,

I grasped the concept and understood how it works

Hurrah! :x You have restored my faith in my ability to write tutorials! :P

it's because I have to put some kind of checkpoint into the function I want to interrupt

Correct - and this is how you might do it:

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

HotKeySet("{F1}", "Start")
HotKeySet("{F2}", "Pause")
HotKeySet("{F3}", "Close")

$GuiPrincipale = GUICreate("Renderizer", 227, 121, 192, 124)
GUICtrlCreateLabel("Auto rendering", 24, 8, 130, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Istruzioni = GUICtrlCreateButton("Instructions", 8, 64, 57, 25, $WS_GROUP)
GUICtrlCreateLabel("STATE:", 16, 32, 68, 17)
$LabelStato = GUICtrlCreateLabel("OFF", 96, 32, 72, 18, BitOR($SS_CENTER, $SS_SUNKEN))
GUICtrlSetBkColor(-1, 0xFF0000)
GUICtrlCreateLabel("Interval:", 8, 96, 50, 17)
$Intervallo = GUICtrlCreateInput("3", 64, 96, 25, 21)
$BStart = GUICtrlCreateButton("Start", 176, 8, 49, 25, $WS_GROUP)
$BPause = GUICtrlCreateButton("Pause", 176, 48, 49, 25, $WS_GROUP)
$BUscita = GUICtrlCreateButton("Exit", 176, 88, 49, 25, $WS_GROUP)
GUISetState(@SW_SHOW)

GUIRegisterMsg($WM_COMMAND, "_WM_COMMAND")

$Stato = 0;0=OFF 1=Active 2=In Pause

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $Istruzioni
            GUISetState(@SW_DISABLE, $GuiPrincipale)
            MsgBox(0, "BlahBlahBlah", "STUFFSTUFFSTUFFSTUFF")
            GUISetState(@SW_ENABLE, $GuiPrincipale)
            GUISetState(@SW_RESTORE, $GuiPrincipale)
        ; We need the Start button here as we never interrupt with it
        Case $BStart
            Start()
    EndSwitch
WEnd

Func Pause()

    ; Much simpler code - just change the state of the flag

    Switch $Stato
        ; Case 0
            ; Do nothing as we are not running
        Case 1
            $Stato = 2
            GUICtrlSetData($BPause, "Resume") ; Change button text to show action of next press
        Case 2
            $Stato = 1
            GUICtrlSetData($BPause, "Pause")
    EndSwitch
    Check()

EndFunc   ;==>Pause

Func Check()

    If $Stato = 0 Then
        GUICtrlSetBkColor($LabelStato, 0xFF0000)
        GUICtrlSetData($LabelStato, "OFF")
    ElseIf $Stato = 1 Then
        GUICtrlSetBkColor($LabelStato, 0x00FF00)
        GUICtrlSetData($LabelStato, "ON")
    ElseIf $Stato = 2 Then
        GUICtrlSetBkColor($LabelStato, 0x999999)
        GUICtrlSetData($LabelStato, "In Pause")
    EndIf

EndFunc   ;==>Check

Func Start()

    ; Only start if we were stopped - we need to resume a running function
    If $Stato Then Return
    ; Set running flag
    $Stato = 1
    Check()

    While 1
        If Not IsNumber(Number(GUICtrlRead($Intervallo))) Or Number(GUICtrlRead($Intervallo)) = 0 Then
            GUISetState(@SW_DISABLE, $GuiPrincipale)
            MsgBox(0, "Valore Intervallo Errato", "Non hai messo un valore valido nell'intervallo, Il valore verrà ora resettato")
            GUICtrlSetData($Intervallo, "3")
            GUISetState(@SW_ENABLE, $GuiPrincipale)
            GUISetState(@SW_RESTORE, $GuiPrincipale)
            ExitLoop
        EndIf

        ; We check during these pauses whether to pause, continue or exit

        ConsoleWrite("Mouseclicking 1" & @CRLF) ; MouseClick("left",100,300)
        _CheckDuringWait(1000)
        ConsoleWrite("Mouseclicking 2" & @CRLF) ; MouseClick(("left",105,306)
        _CheckDuringWait(1000)
        ConsoleWrite("Mouseclicking 3" & @CRLF) ; MouseClick(("left",123,347)
        _CheckDuringWait(1000)
        ConsoleWrite("Mouseclicking 4" & @CRLF) ; MouseClick(("left",103,368)
        _CheckDuringWait(1000)
        ConsoleWrite("Mouseclicking 5" & @CRLF) ; MouseClick(("left",105,309)
        _CheckDuringWait(1000)
        ConsoleWrite("Mouseclicking 6" & @CRLF) ; MouseClick("left",106,300)
        _CheckDuringWait(1000)
    WEnd

EndFunc   ;==>Start

Func _CheckDuringWait($iPause)

    ; Start the timer
    Local $iBegin = TimerInit()
    ; Until the timer expires we loop here
    Do
        ; If we are to pause then keep resetting the timer to keepus in the loop
        If $Stato = 2 Then $iBegin = TimerInit()
        ; If the [X] is pressed - Exit
        If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit

    Until TimerDiff($iBegin) > $iPause
    ; If the timer runs out we can continue

EndFunc   ;==>_CheckDuringWait

Func Close()
    Exit
EndFunc   ;==>Close

Func _WM_COMMAND($hWnd, $Msg, $wParam, $lParam)

    ; Check if it was our button was pressed and sent the message
    Switch BitAND($wParam, 0x0000FFFF)
        Case $BPause
            Pause()
        Case $BUscita ; Exit directly
            Exit
    EndSwitch
    Return $GUI_RUNDEFMSG

EndFunc   ;==>_WM_COMMAND

I have commented liberally so you should be able to follow, but please do ask if you have any questions. But if necessary wait and try with music this evening - then you might understand better! :shifty:

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

Well, many thanks Melba, but, including those :P buttons in my script is way too hard. It messed up all the script and now i have to add tons of checks everywhere because when I included that windows messages interceptor (DAMNED ME AND WHEN I DECIDED TO PUT THOSE EXTRA BUTTONS IN THE GUI :lol: ) lot of different things need to be fixed now (I.E controls not coloring well, function running just 1 time and then i can't start it again and so on). And a script that just makes some simple click became a 250-300 line script.

Honestly, this need to be improved in autoit. It's ridiculous how much work you have to do to add some buttons in a script with hotkeys... It seems a simple operation, but when someone has to do a simple project, it's totally not worth it. I raged for 2 days, and when i finally got helped by you I still have problems of various nature. Not good at all, I won't never use buttons and functions togheter again :shifty:, unless developement team will make something more easier to handle. Too much effort for a sooooo little gain. :x

Thanks again for you help, you've been very kind and professional, and humorous too, but i surrend. I will make it without buttons. :nuke:

Edited by Newb

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

Newb,

Honestly, this need to be improved in autoit. It's ridiculous how much work you have to do to add some buttons in a script with hotkeys...

But we did not do that - we made the buttons act as HotKeys and so able to interrupt a running function, which is a whole different level. :x

To get the full functionality that you now have just using HotKeys, you would still need a fair amount of the code I added to your original script. Adding a GUIRegisterMsg line and a short handler function to make buttons act as HotKeys does not seem too much effort to me given the benefit you get.

Just accept that you asked to do something which is quite difficult and, at the cost of a pretty small number of lines of additional code, got what you wanted. Or rant away - your choice. :P

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Well, anyway, when i put that "little" additional code, whole script messed up. I think I'll rant away, this script is too simple to loose so much time on it. :x

Edited by Newb

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Honestly, this need to be improved in autoit. It's ridiculous how much work you have to do to add some buttons in a script with hotkeys... It seems a simple operation, but when someone has to do a simple project, it's totally not worth it. I raged for 2 days, and when i finally got helped by you I still have problems of various nature. Not good at all, I won't never use buttons and functions togheter again  :P, unless developement team will make something more easier to handle. Too much effort for a sooooo little gain.  :x

You are newbie (not skilled in Autoit/programming) so you can't do such "clever" recommendations for Autoit improvement because it's wrong.

If you don't want to learn new things then don't plan/make complicated scripts and stay only with basic ones.

No offence.

Edited by Zedna

Share this post


Link to post
Share on other sites

You are newbie (not skilled in Autoit/programming) so you can't do such "clever" recommendations for Autoit improvement because it's wrong.

If you don't want to learn new things then don't plan/make complicated scripts and stay only with basic ones.

No offence.

No problem, I understand your point of view.

Anyway, it seems I will forcefully have to learn that thing, because It seems I'll need it many times. Just now that I managed to finish my project in the old way I decided, I still need those buttons breaking functions in the GUI.

Damn... Let's see how long it will take to master this. Since i registered, I learned a lot, so this should be another easy task...

Thanks for the help guys


I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

Newb,

If you are having trouble integrating "HotKey Buttons" into your script, just post the code and we can take a look to see if we can help you. :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Newb,

If you are having trouble integrating "HotKey Buttons" into your script, just post the code and we can take a look to see if we can help you. :x

M23

Well i totally erased those WM_COMMANDS because the script was so messed up... and I wrote it back as I intended to, now it works fine and it's good with hotkeys. I'll try to add button later when I have my script working and I have time to test that message intercepting functions.

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
Share on other sites

Newb,

Well, when you do get round to it you know where we are if you run into any problems. :x

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

Newb,

Well, when you do get round to it you know where we are if you run into any problems. :P

M23

Well this should happen in a short time, since everytime i try to update/upgrade the script i see i need them more and more. :x

I'm a compulsive poster. When I post something, come to read it at least 5 minutes later after the posting, because I will edit it. I edited even this signature a few minutes later after I wrote it.

Share this post


Link to post
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
Sign in to follow this  
Followers 0