Jump to content

Running OnEvent Functions in Parallel


Recommended Posts

Hi Members,

I am very new to using Autoit and need assistance. I am trying to create an application to automate some day to day tasks.

The structure of my application is a GUI with multiple tabs and subtabs (mainly to store settings) and buttons to perform actions. I want to create multiple OnEvent functions to run based on button press etc. However, these functions get queued and are executed in serial fashion (which I understand is default behavior of Autoit). I can restrict actions from being executed in parallel by disabling other buttons while one action is triggered by one button. However, while the process is restricted, I still want to be able to navigating the tabs. But, the tabs are frozen until the action from the button completes as the TabSwitch also executes an OnEvent Function which is getting queued.

 I am pretty confident there should be a way to be able to freely navigate the GUI while functions are being executed and seeking your help to figure it out.

I am attaching a sample code which explains the scenario I mentioned. In this code when Button1 is pressed, it disables button2 until the process completes, restricting user to run process 2 and vice versa. However, while the process initiated by button is in progress, I am unable to navigate through the tabs.

I am not a programmer and possibly there is a better way to achieve what I need. Any guidance will be greatly appreciated.

Sample.au3

Link to comment
Share on other sites

Hi argumentum,

Thank you for your prompt response. It took a while for me to understand your UDF.

I tried to modify my sample script. GUICtrlSetOnEvent does not allow us to use functions with parameters. Hence, I had to call the _Fork_Func from another OnEvent function. However, it doesn't seem to execute the function. Hope I have interpreted your UDF correctly. Please advise.

Modified Sample code attached.

Thank you.

Sample.zip

Link to comment
Share on other sites

  • Developers

Moved to the appropriate AutoIt General Help and Support forum, as the Developer General Discussion forum very clearly states:

Quote

General development and scripting discussions.


Do not create AutoIt-related topics here, use the AutoIt General Help and Support or AutoIt Technical Discussion forums.

Moderation Team

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Wizard0f0z changed the title to Running OnEvent Functions in Parallel

..don't have the time to guide you along.
But when Opt("GUIOnEventMode", 1)GUIGetMsg() does not do anything. Read GUISetOnEvent()

If you are thinking of working with child GUIs, I have examples in my list of links.

"Never give up, never surrender". Enjoy learning :ILA2:

Follow the link to my code contribution ( and other things too ).
FAQ - Please Read Before Posting.
autoit_scripter_blue_userbar.png

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