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 dmob, Loc, GreeNerO 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...
bipiw Posted May 26 Share Posted May 26 Hello, I have a problem with this UDF. I putted the N.au3 file in UDF folder, and dlls in system 32 and sysWow64, and in UDF folder as well but i still get: >"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "C:\Users\Cyberpunkt\Desktop\Tomek\autoit\N-0.2a\test_1.au3" /UserParams +>13:26:57 Starting AutoIt3Wrapper (21.316.1639.1) from:SciTE.exe (4.4.6.0) Keyboard:00000415 OS:WIN_10/2009 CPU:X64 OS:X64 Environment(Language:0415) CodePage:0 utf8.auto.check:4 +> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\Cyberpunkt\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\Cyberpunkt\AppData\Local\AutoIt v3\SciTE >Running AU3Check (3.3.16.1) from:C:\Program Files (x86)\AutoIt3 input:C:\Users\Cyberpunkt\Desktop\Tomek\autoit\N-0.2a\test_1.au3 +>13:26:57 AU3Check ended.rc:0 >Running:(3.3.16.1):C:\Program Files (x86)\AutoIt3\autoit3.exe "C:\Users\Cyberpunkt\Desktop\Tomek\autoit\N-0.2a\test_1.au3" +>Setting Hotkeys...--> Press Ctrl+Alt+Break to Restart or Ctrl+BREAK to Stop. !>13:26:58 AutoIt3.exe ended.rc:-1073741819 +>13:26:58 AutoIt3Wrapper Finished. >Exit code: 3221225477 Time: 1.967 I'm trying to run the test files from author. I suppose that, i'm doing some stupid, mistake. Can you help me? Link to comment Share on other sites More sharing options...
argumentum Posted May 26 Share Posted May 26 3 hours ago, bipiw said: I have a problem with this UDF On 6/25/2022 at 7:19 AM, NHD said: This is my experiment to achieve multi-threading in AutoIt 😅 @NHD was last seen in July 2022. I would not use this UDF or anything claiming multithreading. But you can always fork. Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. 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