HotKeyIt wrote:
Hi fincs, can we please add following so also standard library of A_AhkExe is used
That's already handled by A_ScriptDir "\..\Lib" (you're not supposed to move the compiler around). In fact, that's the behaviour of the original Ahk2Exe.
If what you want is just to automate script compilation and you somehow need to copy the compiler around, don't worry, because something to do that cleanly is in the works

Anonymous wrote:
Add a checkbox for "Use Mpress.exe" and remembering the last user choice. If it can not find Mpress gray out the the control.
There's already a checkbox for that, and it also remembers the last user choice ("Use MPRESS (if present) to compress resulting exe").
Anonymous wrote:
As it is a FAQ, perhaps add a note below the (c) notices saying something like "Note: Compiling a script does not guarantee protection of your source code."
That might be a good idea.
EDIT: look at this sneak-peak:
Code:
q := ComObjCreate("AutoHotkey.Compiler")
; You can directly compile the script via this function:
q.Compile(A_ScriptFullPath, A_ScriptDir "\wowsimple.exe", "", "", true)
; ... or have more control over the compilation process.
q.Open(A_ScriptDir "\wow.exe")
;q.AddScriptFile(A_ScriptFullPath) ; you can set the script to compile using this function...
q.CustomIcon("someIcon.ico")
q.AddScriptText("MsgBox Hello, world! This script was dynamically compiled :9", true) ; or use dynamic script text instead.
; This function allows you to add/modify/delete a custom resource.
test = Hello, world!
q.UpdateResource(10, "OhMyData", BinarySafeArray(test, VarSetCapacity(test))) ;RCDATA=10
; Remove unused icons
list = 4,5,6,7,8,9,10
Loop, Parse, list, `,
q.UpdateResource(3, A_LoopField)
; Remove unused icon groups
list = 160,206,207,208,228,229,230
Loop, Parse, list, `,
q.UpdateResource(14, A_LoopField)
q.UpdateResource(4, 211) ; Remove main menu
q.UpdateResource(5, 205) ; Remove InputBox dialog
q.UpdateResource(9, 212) ; Remove accelerators
q.Flush()
for t in q.EnumResourceTypes()
{
line := ""
for r in q.EnumResources(t)
line .= r ", "
StringTrimRight, line, line, 2
text .= t ": " line "`n"
}
StringTrimRight, text, text, 1
MsgBox %text%
q.Close()
Run, "%A_ScriptDir%\wow.exe"
; This function creates a VT_UI1 SafeArray from a variable.
BinarySafeArray(ByRef data, size)
{
arr := ComObjArray(0x11, size), pArray := ComObjValue(arr)
DllCall("oleaut32\SafeArrayAccessData", "ptr", pArray, "ptr*", pData)
DllCall("msvcrt\memcpy", "ptr", pData, "ptr", &data, "uptr", size, "cdecl")
DllCall("oleaut32\SafeArrayUnaccessData", "ptr", pArray)
return arr
}