08-14-2018, 11:39 AM
I don't know whether AHK script engine can be embedded in other programs, like for example python or C#. If not, can run .ahk script file.
Function AhkExec
Function AhkExec
;/
function $ahkScriptFile
;Executes an Autohotkey script file (.ahk).
;Waits until it ends.
;EXAMPLE
;AhkExec "$documents$\test4.ahk"
str ahk="C:\Program Files\AutoHotkey\AutoHotkey.exe"
str script.expandpath(ahkScriptFile)
int exitCode=RunConsole2(F"{ahk} /ErrorStdOut ''{script}''" _s)
if(exitCode) end F"{ERR_FAILED}. AHK exit code: {exitCode}. Message: {_s}"