Jump to content

Does AU3 support simultaneos threads?


Azevedo
 Share

Go to solution Solved by water,

Recommended Posts

(topic title: simultaneos --> simultaneous)

Hello.

I'm writing a script to work like a very simple download manager.

Is it possible to have a multi-thread in AU3?

Say it have a listbox with 3 downloads URLs and I want to download them in separed threads simultaneously. (not one after another)

Can AU3 handle this?

Edited by Azevedo
Link to comment
Share on other sites

  • Solution

No. And Multi-threading is not on the ToDo-list.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

Azevedo,

 

Is it possible to have a multi-thread in AU3?

As explained in multiple threads (pun intended) on the forum you cannot run several threads from one script. But you can run a child script multiple times from a parent, which in your case would seem to be enough. :)

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

Azevedo,

 

As explained in multiple threads (pun intended) on the forum you cannot run several threads from one script. But you can run a child script multiple times from a parent, which in your case would seem to be enough. :)

M23

 

ok. But how would I have a callback from the child scripts? (error 404 / http 200 OK / download finished / ...)

Link to comment
Share on other sites

  • Moderators

Azevedo,

Search for "inter process communication" - my personal favourite is trancexx's MailSlot. :)

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

You could use exit codes in your child scripts to get the outcome.

This requires that your main script waits for completion, like RunWait.

If that's not what you want you could look into inter process communication.

That comes to the problem here.

RunWait will be single thread.

Link to comment
Share on other sites

  • Moderators

Azevedo,

 

I would never use such a dirty trick

Would you care to expand on that comment? I have found that UDF very useful on occasion and by no means would I describe it as a "trick". :huh:

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

  • Moderators

Radiance & Azevedo,

Please read this announcement before posting again. :naughty:

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

Azevedo,

 

Would you care to expand on that comment? I have found that UDF very useful on occasion and by no means would I describe it as a "trick". :huh:

M23

Sure!

It is wasteful (memory + cpu time) to open preccess trees to perform trivial tasks.

Then it would be not a child proccess, a grandchild proccess.

No way I'd pipe that way.

Link to comment
Share on other sites

Apologies, didn't mean to upset you.

It's just that IPC is not one of my favorite topics, I've tried so many variants and the one Melba23 statet is one of the best and cleanest.

I agree it is the best solution in AU3 programming.

But I'd never do that.

REAL multi threading is 100x faster and reliable than piping it through a 3 generation proccess tree.

Link to comment
Share on other sites

Are you enlightening us on the benefits of multithreading, or just disparaging the solutions that allow for IPC.

It is wasteful (memory + cpu time) to open preccess trees to perform trivial tasks.

 

 

This is a retarded statement, about a language that is transparently if not deliberately slow and wasteful.  If your mission is speed and efficiency you made the first wrong turn when you selected this language, and then the second was coming here to tell us about the obvious.

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Are you enlightening us on the benefits of multithreading, or just disparaging the solutions that allow for IPC.

 

This is a retarded statement, about a language that is transparently if not deliberately slow and wasteful.  If your mission is speed and efficiency you made the first wrong turn when you selected this language, and then the second was coming here to tell us about the obvious.

 

so unnecessary comment...

Link to comment
Share on other sites

  • Moderators

I think I'm lost on a child of a child...

But more than that, there are many IPC methods, mailslot was only one of them.

TCP/UDP - Main script is the server, the child spawns do a quick client like

SQLite/File/Ini/Etc Method, not really recommended, all that fileopen/write/close/read, bound to overlap somewhere

GUIRegisterMsg + WM_COPY where you have two parts communicate via GUI

I'm sure there are others I'm missing off the top of my head, I think the point they were making was this...

Answering your question directly, No, there is no multi-threading in AutoIt, however an "alternative" may be IPC, and their opinion is that mailslot is the cleanest solution for their needs that they've encountered.

It didn't require a comment/reply, especially a derogatory one that has literally no merit here.

My suggestion... Create your application in a language in that supports multi-threading since you feel you understand it, and use the AutoItX dll to do the medial things you feel the language is for in the first place (I took the liberty of assuming here :) )... win ... win.

Edited by SmOke_N

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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