Jump to content

autoit multithreaded?


Recommended Posts

Hi.

first sorry for my bad frensh english.

i dont know how to multithread, but i have two alternative.

you can create two scripts or executable and:

1- Use TCP or UDP to emulate comunication.

2- Create variable (buffer) in each process and use memory read and memory write to emulate comunication. must dificult because you nead to kno process base adress, pointer and offset of memory variable in each process.

AdlibRegister can be useful.

Peace and evolutio!

Link to comment
Share on other sites

That is IPC (Inter-Process Communication) and definitely not mylti-threading.

It has been discussed ad nauseum that AutoIt will never go this route. Yet you can surely use IPC at will.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Still no.

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

On 15/05/2017 at 4:11 PM, voidFF said:

I have made a exemple

Spoiler

// To use:
// - Copy AutoItX3_DLL.h and AutoItX3_DLL.lib into the project folder.
// - Add AutoItX3_DLL.lib to the linker input files.
// AutoItX3.dll / AutoItX3_x64.dll needs to be in the run path during execution.
// Compile with /MD or /MT

#include "AutoItX3_DLL.h"
#include <thread> // Thread include.

void thread_1() {
    AU3_Send(L"OOOOOOOOOOOOO", 1);
}

void thread_2() {
    AU3_Send(L"IIIIIIIIIIIII", 1);
}

int APIENTRY wWinMain(HINSTANCE hInstance,
    HINSTANCE hPrevInstance,
    LPTSTR    lpCmdLine,
    int       nCmdShow)
{
    UNREFERENCED_PARAMETER(hPrevInstance);
    UNREFERENCED_PARAMETER(lpCmdLine);

    AU3_Run(L"notepad.exe", L"", 1);
    AU3_WinWaitActive(L"Sans titre - Bloc-notes", L"", 0);

    std::thread thread_1_(thread_1); // Thread 1
    std::thread thread_2_(thread_2); // Thread 2
    thread_1_.detach(); // Run
    thread_2_.join(); // Run + Wait

    return 0;
}

Output : oIoIoIoIoIoIoIoIoIoIoIoIoI

 

Link to comment
Share on other sites

nice but thats not from AutoIt.Exe.

I know in general multithreading and so far it was allways a no and not on the to do list

see #39 https://www.autoitscript.com/wiki/FAQ

but as we now can host .NET CLR Runtime

I do not see a reason why you cannot run a C# routine (even embedded from a memory string) with some threads calling AutoIt functions.  (and deal with thread safety in the C# part).

I think I would define it as MT from AutoIt when  All threads share a common heap (from AutoIt)

that seems possible when we host the CLR Runtime.

But I am not in the Multi Threading area from .NET and what kind of rules you should follow to callback to 1 instance of AutoIt.Exe that starts CLR C# and starts 2+ threads and calls back 1 or multiple functions of AutoIt. The examples in CLR.AU3 give examples on how to callback AutoIt function but would be nice if a more expert would give CLR.AU3 a try to see if you can reach the Multi threading from AutoIt (in a stable way).

Link to comment
Share on other sites

I'm not sure that the AutoIt3X DLL is thread-safe without some kind of mutex to insure thread safety. Ascertaining these points would require looking very closely at the source, which is reserved to a few, technically to the sole Jon in practice. For instance, how would @error, @extended behave in all situations, just to point to obvious things?

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

junkew, It's still not the AutoIt code, that's multi threading, It's the C#/VB code. There is nothing new in that at all. We've always been able to implement multi threading in a DLL file. When you're running C#/VB code through .NET CLR it's run in the same way as the code in a DLL file. You can save the C#/VB code in a DLL file. The only difference is that it's run as managed code.

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