Run v1 libraries in-process with AutoHotkey.dll

Post your working scripts, libraries and tools.
lexikos
Posts: 9665
Joined: 30 Sep 2013, 04:07
Contact:

Run v1 libraries in-process with AutoHotkey.dll

09 Sep 2022, 18:55

This is a script for AutoHotkey v2.0-beta.8 (probably v2.0-beta.6+), using AutoHotkey.dll to make use of AutoHotkey v1 libraries within a v2 script.

This requires AutoHotkey.dll from AutoHotkey_H v1 in an appropriate location for DllCall to find it, such as the current directory or the directory containing AutoHotkey.exe.


This was meant to be a quick proof of concept, but it turns out to be trickier than I thought. To retrieve functions, classes and other objects from AutoHotkey.dll and use them safely, it is necessary to manually marshal the object's IDispatch pointer. Otherwise, the script will most likely deadlock when the object is used, because it will be called on the wrong thread. Marshalling gives the v2 script a COM proxy object which takes care of forwarding calls and return values between the v2 thread and the v1 thread.

I realized after posting it that thqby's script probably already does something similar, but I haven't tested it.
hasantr
Posts: 933
Joined: 05 Apr 2016, 14:18
Location: İstanbul

Re: Run v1 libraries in-process with AutoHotkey.dll

21 Sep 2022, 12:54

That's great. If we can use it efficiently, our V2 transition will be much quicker and easier.
User avatar
cyruz
Posts: 348
Joined: 30 Sep 2013, 13:31

Re: Run v1 libraries in-process with AutoHotkey.dll

24 Jan 2023, 15:56

@lexikos

I see that you are developing the "official" dll... :D
ABCza on the old forum.
My GitHub.
elbitjusticiero
Posts: 78
Joined: 06 May 2017, 11:07

Re: Run v1 libraries in-process with AutoHotkey.dll

17 Mar 2023, 05:39

Windows Defender won't allow me to download the AutoHotkey_H zip file because it contains the Wacatac.B!ml Trojan (or so it claims).

Is this a false alarm? Are there any alternative locations to download the zip, or maybe just the dll?
geek
Posts: 1054
Joined: 02 Oct 2013, 22:13
Location: GeekDude
Contact:

Re: Run v1 libraries in-process with AutoHotkey.dll

17 Mar 2023, 08:22

Wacatac.B!ml is a "machine learning" categorized item. The ML classifier Microsoft uses thinks just about any unsigned code is Wacatac.B!ml. You can look around online at other people reporting it. A bunch of them (myself included) have gotten it for small programs we wrote ourselves. I've had Wacatac.B!ml detected on android apps I've built. Impressive detective work from Microsoft. Yes, this android app I built myself moments ago from code I wrote is clearly a Windows trojan...

You can also download the dlls from here:

https://github.com/HotKeyIt/ahkdll-v1-release/

https://github.com/HotKeyIt/ahkdll-v1-release/archive/refs/heads/master.zip
elbitjusticiero
Posts: 78
Joined: 06 May 2017, 11:07

Re: Run v1 libraries in-process with AutoHotkey.dll

17 Mar 2023, 11:29

Thank you so much! I imagined it would be a false alarm, but you never know.

Return to “Scripts and Functions (v2)”

Who is online

Users browsing this forum: No registered users and 21 guests