The UniScript interpreter can be used as a stand alone program with UniPlot 3.3.0.
Open a Windows command window cmd.exe.
Start UniScript. Type in the command us and press Enter to start the program us.exe located in the c:\Program Files\UniPlot\Program directory. UniScript displays a prompt with an asterix and is ready for input.
You can use UniScript as a powerful pocket calculator. To quit UniScript, type quit or use the Ctrl+C key.
You can also write programs with UniScript. The following program ncdir.ice displays the channel names of all NC files found in the given directory. Example: us ncdir.ice d:\*.nc.
Under Windows 2000 the function can be called like this: ncdir d:\*.nc
// ncdir.ice
def ncdir(sv)
{
nold = nc_seterror_options(0);
for (i in 1:len(sv)) {
ncid = nc_open(sv[i], NC_NOWRITE);
if (ncid == -1) continue;
print sv[i];
nvars = nc_inquire_nvars(ncid)
if (nvars == 0) continue;
for (j in 0:nvars-1) {
print "\t" + nc_varinq_name(ncid, j);
}
nc_close(ncid);
}
nc_seterror_options(nold);
}
args = getargs();
if (len(args) >= 3) {
loadlib("rs_ncdf.dll");
for (i in 1:len(args)-2) {
sv = GetDirectory(args[i+2])
ncdir(sv)
}
} else {
print "usage: ncdir filename(s)";
}
The program usserv.exe located in the c:\Program Files\UniPlot\Program directory can be used as an ActiveX-Server.
Example (VBA-Program in Excel):
Public Sub Test()
Set us = CreateObject("UniScript32")
MsgBox us.Call2("sin", 1)
End Sub
The UniScript-Server provides the following functions: UniScript.Call, UniScript.Call2, UniScript.Load.
It can be used by UniPlot as well.
During the UniScript start a startup file will be loaded. The file names of the startup files are usstart.ic for us.exe and usserv.ic for usserv.exe.
In the startup files DLLs, UniScript files (.ic) and UniScript librarys (.icl) are loaded:
loadlib("rs_lib.dll");
loadlib("rs_lib2.dll");
loadlib("rs_obj.dll");
loadlib("rs_auto.dll");
loadlib("rs_map.dll");
loadlib("rs_date.dll");
load(GetRootDirectory() + "script\alias.ic");
load(GetRootDirectory() + "script\Register.ic");
loadiclib(GetRootDirectory() + "Program\rs_sl.icl");
Not all functions available in UniPlot can be used. All functions which access UniPlot objects (Documents, Layers, datasets etc.) are not available.
If the script files have the extension .ice, they can be started by just typing the file name in the Windows command window.
id-1936455