Adds new code from a file on disk or network in currently executed script.
OutputVar := addFile(FilePath, WaitExecute)
Function Example: LinePtr := addFile(A_ScriptDir "\MyScript.ahk", 1)
OutputVar := DllCall("AutoHotkey.dll\addFile", "Str", A_ScriptDir "\MyScript.ahk", "Int", 1, "UPTR")
OutputVar := DllCall("AutoHotkey.exe\addFile", "Str", A_ScriptDir "\MyScript.ahk", "Int", 1, "UPTR")
The name of the variable in which to store the line pointer to new code, if code could not be added 0 will be stored.
New AutoHotkey script saved on disk or network to be added to currently running script.
0 = add code but do not execute it.
1 = add code, execute it and wait for it to finish execution.
2 = add code, execute it and return immediately (does not wait until
execution finished).
ahkFindFunc, addScript, ahkFindLabel, ahkassign
dllpath:=A_AhkDir "\AutoHotkey.dll"
DllCall("LoadLibrary","Str",dllpath) ; Load the AutoHotkey module.
DllCall(dllpath "\ahktextdll","Str","","Str","","Cdecl") ; start new, empty thread.
DllCall(dllpath "\addFile","Str","NewScript.ahk","Int",1,"Cdecl") ; add and execute code
; Same example like above using included AutoHotkey.dll
dll:=AhkThread()
dll.addFile["NewScript.ahk",1]
; Add new script to current thread
addFile("NewScript.ahk",1)