Thanks for your help.
In the function `getSubCode` below, I used this line.
1. When I run the macro `getSubCode_T` in QM, it works successfully!
2. But when I compile `getSubCode_T` into an EXE file and run it, it fails.
I use the `getSubCode` function in many macros, and I’ve tried various solutions but haven’t been able to resolve the issue.
Can you help me? In any case, thank you very much!
Function getSubCode_T
Function getSubCode
Quote:#exe addtextof "<script>"I don’t quite understand what this line of code does.
In the function `getSubCode` below, I used this line.
1. When I run the macro `getSubCode_T` in QM, it works successfully!
2. But when I compile `getSubCode_T` into an EXE file and run it, it fails.
I use the `getSubCode` function in many macros, and I’ve tried various solutions but haven’t been able to resolve the issue.
Can you help me? In any case, thank you very much!
Function getSubCode_T
Function getSubCode
function $subName str&code ;;Get text from the sub-function
#exe addtextof "<script>"
#opt nowarnings 1
opt noerrorshere 1
int iid=+getopt(itemid 1)
code.getmacro(iid)
str m="^#sub sn.*[]"; m.findreplace("sn" subName)
str s; int l i=findrx(code m 0 8 s) ;;
if i!=-1
,s.trim
,;out s
,foreach _s code
,,_s.trim
,,if(_s=s) break
,,l+1
else
,end F"#sub {subName} Not found!"
for _i l+1 numlines(code)
,str s_.getl(code _i)
,if(s_.beg("#sub") or s_.beg(" BEGIN PROJECT"))
,,break
,else
,,str cf.addline(s_ -1)
cf.rtrim;
if(empty(cf)) end F"#sub {subName} content is empty!"
code=cf