i try to get all #includes with ListIncludes.ahk but only maincode.ahk is returned (msg.ahk is discarded):
Here the (reduced) code i use:
Get_all_includes.ahk:
Code: Select all
#include ListIncludes.ahk
; ListIncludes.ahk from
; https://github.com/Drugoy/Autohotkey-scripts-.ahk/blob/master/Libraries/ListIncludes.ahk
; https://github.com/Ixiko/AHK-libs-and-classes-collection/blob/master/libs/g-n/ListIncludes.ahk
script_mainfilename:="maincode.ahk"
list := ListIncludes(script_mainfilename)
msgbox result:`n%list%
Code: Select all
; ------------------------------ ScriptGuard1 --------------------------------
ScriptGuard1() ; Hides AutoHotkey source in compiled scripts
{ ; By TAC109, Edition: 28Jan2023 ; Include this code in your script at the top
static _:=SubStr(A_AhkVersion,1,1)=1?ScriptGuard1():1 ;Runs when script starts
local ahk:=">AUTOHOTKEY SCRIPT<", pt:=0,sz:=0,d:=0,k,v, rx:=0x7FFFFFFFFFFFFFFF
,rc, ahk1:="~AUTOHOTKEY SCRIPT~",rs:=0x7FFFFFFFFFFFFFFF,rz:=0x7FFFFFFFFFFFFFFF
if A_IsCompiled ;^ Don't alter! ; See bit.ly/ScriptGuard for more details
{ for k,v in [ahk1, ahk, "#1"] ; Works with v1.1 & v2, but not _H
if (rc:=DllCall("FindResource", "Ptr",0, v ~= "^#\d$" ? "Ptr" : "Str", v
~= "^#\d$" ? SubStr(v,2) : v, "Ptr",10, "Ptr"))
&& (sz:=DllCall("SizeofResource","Ptr",0, "Ptr",rc, "Uint"))
&& (pt:=DllCall("LoadResource", "Ptr",0, "Ptr",rc, "Ptr"))
&& (pt:=DllCall("LockResource", "Ptr",pt, "Ptr"))
&& (DllCall("VirtualProtect","Ptr",pt, "Ptr",sz, "UInt",0x04, "UInt*",rc))
DllCall("RtlZeroMemory","Ptr",pt, "Ptr",sz), d:=k ; Wipe script from RAM
(rs=rx)?0:DllCall("VirtualProtect","Ptr",rs,"Ptr",rz,"UInt",0x02,"UInt*",rc)
(d<2)?DllCall("MessageBox","Int",0,"Str","Warning: ScriptGuard1 not active!"
. "`n`nError = " (A_LastError=1814 ? ("Resource Name '" ahk "' not found."
. "`nTo fix, see the 'Example 1' comments at https://bit.ly/BinMod.")
: A_LastError), "Str", A_ScriptName, "Int", 64):0 ; For additional security,
} } (SubStr(A_AhkVersion,1,1) = 1) ? 0 : ScriptGuard1() ; see bit.ly/BinMod
; ------------------------------------------------------------------------------
; ------------------------------------------------------------------------------
#include msg.ahk
Outputfile=C:\temp\out.txt
FileAppend,
(
A line of text.
), %Outputfile%
if ErrorLevel
{
;print some error
}
Code: Select all
msgbox Hello
I suppose line#46 of ListIncludes.ahk is making the problem as it does the cutting of the round brackets "(" ")".
To debug i modfied ListIncludes.ahk and write out the variable script before and after the RegExReplace :
Code: Select all
[...]
Fileappend, %script%, C:\Temp\in.txt ;code to add for debug
; code from Listincludes.ahk #lines43-46
script := RegExReplace(script
, "ms`a)^\s*/\*.*?^\s*\*/\s*" ; multi-line comments
. "|\s*(?<!\S);.*?$" ; single-line comments
. "|^\s*\(.*?^\s*\)\s*") ; continuation sections
Fileappend, %script%, C:\Temp\out.txt ;code to add for debug
[...]
As i am not so firm with RegEx i would be glad for a helpful hand.
Thanks a lot!
Regards
daywalker