ahkExec


ahkExec is used to run some code from text/variable temporarily.

success:=DllCall(dll_path "\ahkExec","Str","MsgBox % A_Now")

Parameters

Parameter

Description

success

ahkExec() returns true if script was executed and false if not

("MsgBox...")

script as text(or variable containing text) that will be executed.

Return Value

Returns true if script was executed and false if there was an error.

Remarks

None.

Related

AutoHotkey.dll, ahkdll, ahktextdll, ahkReady, addFile, addScript, ahkLabel, ahkFunction, ahkPostFunction, ahkassign, ahkgetvar, ahkTerminate, ahkReload, ahkFindFunc, ahkFindLabel, ahkPause, ahkExecuteLine, Alias, cacheEnable, FindFunc, FindLabel, getTokenValue, getVar, Static, AutoHotkeyMini, DynaCall, CriticalSection, CriticalObject, MemoryLoadLibrary, ResourceLoadLibrary, MemoryGetProcAddress, MemoryFreeLibrary, Other Changes

Example

SetWorkingDir % A_ScriptDir
dll:=AhkDllThread("AutoHotkey.dll") ;creates an additional AutoHotkey thread using AutoHotkey.dll
dll.ahktextdll() ;will automatically add&#Persistent and run "empty" script
dll.ahkExec("a=_Hello World!") ;execute some code
dll.ahkExec("StringTrimLeft,a,a,1") ;execute more code
MsgBox % dll.ahkgetvar.a ;get value of variable a