Open EXE with Scripting

Way back in V1.7 created a EXE (with secret) which can only be opened from within another EXE.

It is placed in “Data” folder and still works great with V2019. What I wish to do is move from Data folder and compile directly into EXE.

Using below hescript. But, if compile into EXE no longer opens using toolbar button:

procedure MacroExecuteProgram(filename: String);
var
 EbookPath, MyProgram: String;
begin
 EbookPath := GetGlobalVar("HEPublicationPath", "");
 MyProgram := EbookPath + "currentmathanswers.exe";
 RunAProgram(MyProgram, "mysecret", EbookPath, false, SW_SHOWNORMAL);
end;

Toolbar button is simply using “Execute an HEScript Function” to start it.

Also tried “Unpack to virtual memory at startup” and no success.

Is there something else I should do to make work when compiling into final EXE?

Can you try this if this works for you?
https://www.exeoutput.com/help/samplescriptrunexe#run-a-program-that-was-compiled-in-the-application

As happens many times, I was WAY over thinking the process. Changed the hescript to the sample, added my info and it works.

Thank you!