RunAProgram to execute a program. We only need to know the path to the program file we want to launch. Fortunately ExeOutput for PHP has a global variable named HEPublicationPath pointing to the path of the folder that contains the application's exe file.
procedure RunTutor; var EbookPath, MyProgram: String; begin EbookPath := GetGlobalVar("HEPublicationPath", ""); MyProgram := EbookPath + "hehvdemo.exe"; RunAProgram(MyProgram, "", EbookPath, false, SW_SHOWNORMAL); end;
First we get the path to our application stored into the EbookPath variable. Then we add the filename of our executable program and we pass the result to the RunAProgram function.
You can include the program file directly into your application .exe. In that case you need to extract the program file before running it: use the heopenit special protocol, or the following code:
procedure RunACompiledProgram; var MyProgram: String; begin MyProgram := UnpackTemporaryResource("programfilename.exe"); RunAProgram(MyProgram, "", ExtractFilePath(MyProgram), false, SW_SHOWNORMAL); end;
This code uses the UnpackTemporaryResource internal function that extracts a compiled file from the publication to a temporary location. Then you just need to execute the file.
Introduction to Scripting
Using the Script Manager
Script Function Reference