CreateScript

Creates a script from main script that can be passed to AutoHotkey.dll, BinRun or DynaRun.

OutputVar := CreateScript(Script , ScriptPath, Password)
Function Example: MyScript := CreateScript("a:=1`nStart:End`nfun{}")

Parameters

OutputVar

The name of the variable in which to store the created script.

Script

Label or function in main Script to include.
Syntax for including label is tartingLabelName:EndingLabelName
Syntax for including function is FunctionName{}

ScriptPath (optional)

The base script to use, default for not compiled: A_ScriptFullPath.

Password (optional)

Password used to compile in Ahk2Exe.

General Remarks

You can have any code between included labels and functions. Script is also loaded from Resource if A_IsCompiled.

Related

AutoHotkey.dll, BinRun, DynaRun

Examples

DynaRun(CreateScript("
(
Gui:=GuiCreate()
Gui.Add("Button","","Click me to Test Label and Function").OnEvent("Click","Button")
Gui.OnEvent("Close","GuiClose")
Gui.Show()
Return

fun{}
)"),"Dynamic script")
ExitApp
 (button.Gui.Show("Hide"),MsgBox(fun()))
GuiClose(p*) => ExitApp()
ButtonEnd>:
Return
fun(p*){
  Return "test trough pipe"
}