<?xml version="1.0" encoding="utf-8"?>
<hemacroscript name="Macros" desc="Some macro functions that you can use in your HTML pages.">
	<contents><![CDATA[// Macros
// This script contains macro functions that you can use in your HTML pages.
// Syntax : hescript://Macros.[function name]|[param1]|[param2]...
// See the help for further instructions about how to call HEScript functions.

procedure MacroExit;
begin
 ExitPublication;
end;

procedure MacroShowMessage(p1: string);
begin
 MessageBox(ReplaceString(p1, "%20", " "), GetString("SPubTitle"), MB_OK+MB_ICONINFORMATION);
end;

procedure MacroShowAbout;
begin
 ShowAboutBox;   
end;

procedure MacroSearch;
begin
 ShowLeftPanel(1, true);
end;

procedure MacroExportFile(sourcename, prompt: String);
begin
 ExportAFile(sourcename, ReplaceString(prompt, "%20", " "), "*.*");
end;

procedure MacroExecuteProgram(filename: String);
var
 EbookPath, MyProgram: String;
begin
 EbookPath := GetGlobalVar("HEPublicationPath", "");
 MyProgram := EbookPath + ReplaceString(filename, "%20", " ");
 RunAProgram(MyProgram, "", EbookPath, false, SW_SHOWNORMAL);
end;

procedure MacroOpenFile(filename, param: String);
var
 EbookPath, MyFile: String;
begin
 EbookPath := GetGlobalVar("HEPublicationPath", "");
 MyFile := IncludeTrailingPathDelimiter(EbookPath) + filename;
 OpenFile(MyFile, param, SW_SHOWNORMAL);
end;

procedure MacroPrint;
begin
 PrintPages(1, 9999, true);
end;

procedure MacroGoPage(p1: String);
begin
 if p1="GOHOME" then GoToPage(GetGlobalVar("HomePage", ""), "");
 if p1="GOBACK" then NavigateCommand(0);
 if p1="GOFORWARD" then NavigateCommand(1);
end; 
   
]]></contents>
</hemacroscript>
