Jump to content

Need help with events


tff2
 Share

Recommended Posts

Hi everyone,

I created a au3 with ~30 Buttons, ~30 Labels and ~30 Inputs.

For each button i created an Event.

So far it works fine...

If I click button1, the script starts a function which get´s the value of input1 and fills all other input fields with values, tries to connect to other pc´s, changes names of buttons depending on online or offline pc´s and so on...

This works also fine...

But if I want to click for example button2 while func button1 is running, it only starts the func button2 AFTER func button1 is done...

Is there any way to change this ?

Many thanks for your help!

Here are some parts of my script:

GUICreate('Tool v' & FileGetVersion(@ScriptName),470,705)
GUISetOnEvent($GUI_EVENT_CLOSE,'SpecialEvents')
GUISetOnEvent($GUI_EVENT_MINIMIZE,'SpecialEvents')
GUISetOnEvent($GUI_EVENT_RESTORE,'SpecialEvents')
GUISetState(@SW_SHOW)

$Button_GetData=GUICtrlCreateButton('Get Data',10,10,100)
GUICtrlSetOnEvent($Button_GetData,'Button_GetData')
$Data_GetData=GUICtrlCreateInput('',115,10,105,'',$ES_CENTER)
$Label_GetData=GUICtrlCreateLabel('',225,15,30,15)

$Button_ExternalIP=GUICtrlCreateButton('Externe IP',10,40,100)
GUICtrlSetOnEvent($Button_ExternalIP,'Button_ExternalIP')
$Data_ExternalIP=GUICtrlCreateInput('',115,40,105,'',$ES_CENTER)
$Label_ExternalIP=GUICtrlCreateLabel('',225,45,30,15)
 
......

Func Button_GetData()
   $ip='10.' & StringLeft(GUICtrlRead($Data_GetData),2) & '.' & StringRight(GUICtrlRead($Data_GetData),2) & '.'
...
    GUICtrlSetData($Data_ExternalIP,$ip & '51')
    If Ping($ip & '1',1000) Then
     GUICtrlSetData($Label_ExternalIP,'online')
     GUICtrlSetColor($Label_ExternalIP,$color_green)
    Else
     GUICtrlSetData($Label_ExternalIP,'offline')
     GUICtrlSetColor($Label_ExternalIP,$color_red)
    EndIf
...
Link to comment
Share on other sites

The Ping function takes time and since Autoit is single-threaded it gets stucked at the command

To make it Asynchronous command line(external execution) would be required

Manadar has implemented such a wrapper check it out

Something similar Trancexx has even done

Regards :)

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

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