Jump to content

Recommended Posts

Posted

Hello,

I have a script which does alot of processing and can take some time to finish. But I also want to include a button which gives the option to the user to stop the script at any given time.

Im using AutoItSetOption("GUIOnEventMode", 1), so each event has its own function.

The only problem is that once processing starts and I click on the stop button, the event only kicks in at the end of the script not during the script.

How can I create an interrupt to process the Stop button's event function?

Thanks,

Posted

You should be able to use AdlibEnable().

What function tells me if someone has clicked on a button. Like the state of the button has changed.

Posted (edited)

The proper thing to use is @GUI_CtrlId

Switch @GUI_CtrlId
        Case $your_button_here
              ;stuff to do here
EndSwitch

Put this in a function and it will work.

Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Posted

Maybe GUIRegisterMsg()

I think this is the best way. The easiest method I found was like this

GUIRegisterMsg($WM_NOTIFY, "MY_WM_COMMAND")

Func MY_WM_COMMAND($hWnd, $Msg, $wParam, $lParam)
    $nID            = BitAnd($wParam, 0x0000FFFF)
   
      ;if the control is the button and the left mouse is clicked 
    if $nID = $StopButton and _ispressed(1) then            
             $Stop = true
    endif
   
    Return $GUI_RUNDEFMSG
EndFunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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
  • Recently Browsing   0 members

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