Introduction | Quick References | How Do I ... Topics | Built-in Tools | Scripting and Programming
Hpmbcalc Scripting Host Console is a normal dialog box. With the console, you can edit, load, run, and debug your scripts. To display the console, you can choose Run Scripts... item From the Script menu.
Hpmbcalc supports both VBScript and JScript scripting engines. When Hpmbcalc starts, it searches Windows registry entries to determine which scripting engines can be used. If either scripting engine is useless, the script type will be disabled. So, before you can run a script under Hpmbcalc Scripting Host, you need install one of the scripting engines in your system.
With the Input Script box of the console, you can edit your script. You can also load a script file into the box by clicking the Browse... button of the console.
You can set the language that your script uses by selecting the VBScript button or the JScript button of the console.
After you have entered or loaded your script, you can click the Execute button of the console to run it. When a script is being run, its output and error information will be routed to the Script Output box. Your script can invoke object method Output to output any text.
You can click the Terminate button of the console to terminate a running script. It is used to cause current script executing thread to exit and should only be used in the most extreme cases.

The following console options exist:
Here are the general guides to write a script for running under Hpmbcalc Scripting Host:
The following JScript code checks the primality of argument strHex for 4 times using Fermat Primality Test.
///////////////////////////////////////////////////////////
// Probabilistic Primality Test Script
// -----------------------------------
// This JScript code checks the primality of strHex for 4
// times using Fermat Primality Test.
//
// strHex = "10 9f e4 57 14 86 6e 56 " +
// "fd d4 ad 9b 6b 68 6d f2 " +
// "72 24 af b7 86 8c f4 f0 " +
// "cb b7 94 52 69 32 85 3c " +
// "bf 0b ee a6 15 94 16 66 " +
// "54 d1 3c d9 fe 0d 9d a5 " +
// "94 a9 7e e2 02 30 f1 2f " +
// "b5 43 4d e7 3f b4 f8 10 " +
// "27 25 a0 16 22 b3 1b 1e " +
// "a4 2e 3a 26 50 19 03 9a " +
// "c1 df 31 86 9b d9 79 30 " +
// "d7 92 fb 72 cd aa 97 1d " +
// "8a 80 15 af"
// is a known 800-bit prime.
///////////////////////////////////////////////////////////
var strHex, nPrime
strHex = "10 9f e4 57 14 86 6e 56 " +
"fd d4 ad 9b 6b 68 6d f2 " +
"72 24 af b7 86 8c f4 f0 " +
"cb b7 94 52 69 32 85 3c " +
"bf 0b ee a6 15 94 16 66 " +
"54 d1 3c d9 fe 0d 9d a5 " +
"94 a9 7e e2 02 30 f1 2f " +
"b5 43 4d e7 3f b4 f8 10 " +
"27 25 a0 16 22 b3 1b 1e " +
"a4 2e 3a 26 50 19 03 9a " +
"c1 df 31 86 9b d9 79 30 " +
"d7 92 fb 72 cd aa 97 1d " +
"8a 80 15 af"
nPrime = Hpmbmath.FermatTest(strHex, 4)
if (nPrime == 1) {
Hpmbmath.Output("strHex is a prime.")
}
else if (nPrime == 0) {
Hpmbmath.Output("strHex is not a prime.")
}
else {
Hpmbmath.Output("internal error.")
}
Here are the general steps to run a script under Hpmbcalc Scripting Host: