Execute packed .exe on startup

Status
Not open for further replies.

hurrican19

New member
I’m trying to find a way to execute an .exe file on startup that is packed in my publication. I can call the .exe to run in an html file, but I can’t figure out how to get it to run before the actual html pages show.

The .exe file queries the local computer for the number of active displays, and I store that number for use in some of my javascript code in the program.

As mentioned, calling the script from an html file works, but I want it to launch try to get the number of active monitors before it loads the first .html page. Any help is greatly appreciated.
 
Thanks for the reply support.
I’m running 3.6, do the same functions apply? I tried to enter the following under the UserMain scripts:

Code:
function OnPubLoaded: Boolean;
begin
// When the publication is starting.
// Set Result to True if you want to exit immediately without any warning.
Result := False;
// MonitorCount
procedure RunTutor;
var
EbookPath, MyProgram: String;
begin
EbookPath := GetGlobalVar(“HEPublicationPath”, “”);
MyProgram := EbookPath + “displaycount.exe”;
RunAProgram(MyProgram, “”, EbookPath, false, SW_SHOWNORMAL);

end;

but I run into a compile error. The error states:

Error in Script Line 7, column 1: Identifier expected Fatal Error: script not compiled.

Any thoughts?
 
Thanks support,
That fixed the compile error, but it is not running the .exe to create a registry entry.
Code:
function OnPubLoaded: Boolean;
begin
 // When the publication is starting.
 // Set Result to True if you want to exit immediately without any warning.
// Result := False;
end;
// MonitorCount
procedure RunACompiledProgram;
var
MyProgram: String;
begin
MyProgram := UnpackTemporaryResource("displaycount.exe");
RunAProgram(MyProgram, "", ExtractFilePath(MyProgram), false, SW_SHOWNORMAL);
end;
I’ve tried moving it to several different functions, such as OnBeforeNavigate, OnDisplayWindow and OnStartMainWindow, but none of which will end up executing the .exe file. I’m sure that I am missing something simple.
 
It’s because you are not calling the RunACompiledProgram procedure.

Modify your script like this:
Code:
procedure RunACompiledProgram;
var
MyProgram: String;
begin
MyProgram := UnpackTemporaryResource("displaycount.exe");
RunAProgram(MyProgram, "", ExtractFilePath(MyProgram), false, SW_SHOWNORMAL);
end;

function OnPubLoaded: Boolean;
begin
 // When the publication is starting.
 // Set Result to True if you want to exit immediately without any warning.
RunACompiledProgram;
// Result := False;
end;
 
Now I understand how to make it work, this is why I love this product - the support is awesome! Thank you very much for the assistance!!
 
Status
Not open for further replies.
Back
Top