Note: You need an open project in order to add or edit a report macro.
To associate a report macro with a report :
w Select the Result tab.
w Select the appropriate report in the viewer. (right-click on it)
w Click on the JS speedbutton from the report toolbar so that the JoPPS-Script macro dropdown menu appears.
(click on the down arrow instead of on the button itself)
w Select the option "Define new macro script" from the dropdown menu.
w The JScripter window opens. Enter your script in the source pane.
w Close the JScripter window when done. JoPPS asks to save the changes you made.
Reply yes to confirm the script source you entered.
To run a report macro :
w Press the JS button when viewing the results of a report. If a script is defined it is executed immediately.
(if no script is defined the JScripter window opens enabling you to enter one..)
If the script execution terminates premature due to a run-time error the JScripter window opens and the cursor is positioned at the sourceline causing the error.
7 Report macro example :
IF GetActiveProjectIndex() < 0 THEN
Fatal("No project loaded !");
IF !ResultsValid() THEN
Fatal("Results not up-to-date !");
slot := ReportInViewer();
IF slot < 0 THEN
Fatal("No result in viewer !");
IF !ReportHasResult(slot) THEN
Fatal("Report has no result !");
fn := InterpreteString("%SYSTEM_TMP%\")+ExtractFileName(InterpreteString("%REPORTDOC%"));
IF FileExists(fn) THEN DeleteFile(fn);
StrToFile(GetResultStr(slot),fn);
IF !FileExists(fn) THEN Halt; /* Oops, StrToFile failed? */
RunProgram(InterpreteString("%SYSTEM_ROOT%\notepad.exe"),fn);