Popular Post NHD Posted June 25, 2022 Popular Post Share Posted June 25, 2022 This is my experiment to achieve multi-threading in AutoIt 😅 Source code, usage and examples in this github repo: https://github.com/nomi-san/true-autoit-multi-threading milos83, Loc, dmob and 4 others 4 3 Link to comment Share on other sites More sharing options...
Loc Posted June 26, 2022 Share Posted June 26, 2022 Up Link to comment Share on other sites More sharing options...
GreeNerO Posted July 6, 2022 Share Posted July 6, 2022 Like it.I will use it for my projects👍 Link to comment Share on other sites More sharing options...
milos83 Posted October 24, 2022 Share Posted October 24, 2022 Nice! Link to comment Share on other sites More sharing options...
Biatu Posted October 28, 2022 Share Posted October 28, 2022 What if you have a rather large compiled exe? it looks like you would be dealing with AutoIt Exe*N threads. What if you were to modify N_GetBinaryModule so that it detects the script resource and omits it? What is what? What is what. Link to comment Share on other sites More sharing options...
philpw99 Posted December 29, 2022 Share Posted December 29, 2022 This is AMAZING ! Simple yet powerful ! I wish I had seen this before. Link to comment Share on other sites More sharing options...
jaberwacky Posted February 24 Share Posted February 24 This is great! I love it! I hope that I'm not asking a newb question ... is there a way to exit a thread? For instance: 1st thread: I start a thread with a GUI. Then I spawn a 2nd thread from here ... 2nd thread: This thread has a TCPRecv in a loop which is always listening to a networked device. The messages received from this device then go into a shared global queue. The GUI then updates itself based on the messages found in the queue. 3rd thread: Then I want to start a thread from the 2nd thread that will process the messages received from the network (shortens them and converts them from binary). I want to be able to exit that third thread. Or does it happen that way and I'm just looking at this all wrong? The following code does not demonstrate my intentions. Just sharing it for completeness. (Also, it doesn't actually implement a real queue data structure at the moment.) expandcollapse popup#AutoIt3Wrapper_Version=B #Autoit3Wrapper_Testing=y #autoit3Wrapper_jump_to_first_error=y #AutoIt3Wrapper_Run_AU3Check=n #AutoIt3Wrapper_AU3Check_Parameters=-w 1 -w 2 -w 4 -w 5 -w 6 -w 7 -d #NoTrayIcon #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include "N.au3" OnAutoItExitRegister(OnAutoItExit) Global $queue = NGlobal() NMain("Main") Func Main() GUICreate("EISCP", 520, 350) Local Const $edit = GUICtrlCreateEdit('', 10, 10, 500, 330, $ES_AUTOVSCROLL + $WS_VSCROLL) GUISetState(@SW_SHOWNORMAL) NRun("Recv") Do Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch GUICtrlSetData($edit, $queue.Command, 1) Sleep(100) Until False EndFunc Func Recv() TCPStartup() Local Const $sIPAddress = "192.168.0.209" Local Const $iPort = 60128 Local Const $ConnectedSocket = TCPConnect($sIPAddress, $iPort) Local $command Do $command = TCPRecv($ConnectedSocket, 2048) If $command Then $queue.Command = ExtractCommand($command) EndIf Sleep(50) Until False EndFunc Func ExtractCommand($command) $command = BinaryMid($command, 5) ; lop off "ISCP" $command = BinaryMid($command, 15) $command = BinaryMid($command, 1, BinaryLen($command) - 3) Return String(BinaryToString($command)) EndFunc Func OnAutoItExit() TCPShutdown() EndFunc Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted February 24 Moderators Share Posted February 24 https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-terminatethread TerminateThread, but I read somewhere that GetCurrentThreadId from Kernel32 dll was deprecated, so I can't see "TerminateThread" from the processthreadsapi api being to safe tbh. jaberwacky 1 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now