Im looking for a way to execute my scripts without using the exe. Plan is to use the AHK_H (v1) DLL from powershell and let it exec my scripts/code.
I downloaded the release from github and had a look at the exported functions of Autohotkey.dll. My assumption was that the DLL would have the AHK functions like send, sendplay, imagesearch, etc. Seems like it only has function to execute AHK code. Anyway not relevant.
Can someone please help me with getting this to run via powershell or at least tell me what function of the DLL to use and what the parameters are (I should be able to do the DllImport from Powershell)? It's stated no where.
Also can use the DLL without running regsvr? That would be important too.
Thanks
Autohokey.dll v1 from Powershell Topic is solved
Autohokey.dll v1 from Powershell
Last edited by newvice on 23 Aug 2022, 14:09, edited 2 times in total.
Re: Autohokey.dll v1 from Powershell Topic is solved
download the relase from github. there youll find folders fpr x86 and x64 version. I used wx64 withput mt. copy the dll from there.
no regsrv required
this is for starting scripts:
this is for executing ahk commands as strings:
no regsrv required
this is for starting scripts:
Code: Select all
$MethodDefinition = @'
[DllImport("C:\\Users\\XXXDocuments\\XXX\\XXX\\XXX\\XXX\\AutoHotkey.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "ahkdll")]
public static extern int ahkdll(string scriptFilePath, string parameters = "", string title = "");
'@
$ahk = Add-Type -MemberDefinition $MethodDefinition -Name 'ahk' -PassThru
$ahk::ahkdll("C:\Users\XXX\Documents\XXX\XXX\XXX\XXX\test.ahk")
Code: Select all
$MethodDefinition = @'
[DllImport("C:\\Users\\XXX\\Documents\\XXX\\XXX\\XXX\\XXX\\AutoHotkey.dll", CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Unicode, EntryPoint = "ahktextdll")]
public static extern int ahktextdll(string script, string parameters = "", string title = "");
'@
$ahk = Add-Type -MemberDefinition $MethodDefinition -Name 'ahk' -PassThru
$ahk::ahktextdll("msgbox hello")
Who is online
Users browsing this forum: No registered users and 50 guests