The iW+ script language supports many scripts commands and functions. For the notation used to describe each, click here; for a concise list of each, click here; and for details on each, click here.
Functions are described using the following notation:
[Bracketed / Parameters] are used to describe a parameter that must be passed as one item from a given list, where the list is encapsulated in brackets [..], and the items within the list are separated with "/" characters (e.g. [item1/item2/...]). For example, the syntax "Debug [On/Off]" refers to a command that is typed as "Debug On" or "Debug Off".
Italic parameters are to be defined by the user; whereas parameters shown in non-italics are keywords that are to be typed as shown. For example, the Close command is described as follows: Close [fileName /all] This command has one parameter that is either fileName, or the keyword all. When one uses this command to close a specific file, they would refer to that file's name; otherwise, they would use the keyword all to close all open files.
(OptionalParameters) are shown in parenthesis (...). For example, "Loop numCycles (secsPerLoop)" describes a command with one mandatory parameter, numCycles; and one optional parameter, secsPerLoop. One could express this command as "Loop 3" or "Loop 3 0.1", yet not simply as "Loop". If the secsPerLoop parameter in this example is not included, the loop runs as fast as possible, without a secsPerLoop synchronizer.
The math evaluator supports many keywords. For example, "ticks" returns the value of the
computer's internal 1000Hz 64bit counter and "MouseB" returns 1 if the mouse button is down
and 0 otherwise. Some keywords are simply constants. For example,
one all evaluate to a fixed value of 1.
One sometimes needs to enclose a keyword with parenthesis to tell the interpreter to return a number
(e.g. print ticks prints "ticks" whereas print (ticks)
prints the computer's clock value). These keywords are not case sensitive.
For example, "TrUe" and "true" are both read as "1".
For more information on keywords, click here.
A list of all keywords and their meaning is described below.
For more information on working with Boolean constants, click here.
true, on, hi, or one
1, logical true
false, off, low, or zero
0, logical false
maximum integer value = 2 ^ 31 - 1 = 2147483646
Digitize State Keywords
For an example that shows digitize state while digitizing, click here.
1 if currently digitizing, 0 otherwise.
1 if currently waiting for trigger, 0 otherwise.
DigitizeState is equal to one of: not digitizing (0), waiting for trigger (1), waiting for the next scan to begin (2), or currently digitizing a scan (3).
Number of complete scans digitized thus far, base 1.
If running Strip Chart mode: Number of points digitized thus far for the entire digitization. If running Oscilloscope mode: Number of points digitized thus far within the current scan.
Number of points digitized thus far within the current scan. ControlEventCount Number of control events executed since starting the digitization (e.g. press Record page Start button).
Number of user events executed since program launch.
Number of control events missed due to computer being too busy, since starting the digitization. This is calculated by dividing the number of actually executed control events by the amount of time that has passed since the start of the digitization, and comparing this with the expected value.
Milliseconds since launching instruNet World, in milliseconds units, accurate to 1ms, based on the comp uter's clock.
Seconds since launching instruNet World, in seconds units, accurate to 1ms, based on computer's clock.
Seconds since instruNet Reset, in seconds units, accurate to 1us (1e-6), based on the instruNet i2x0/i60x Controller clock. One cannot read this value if the controller processor is busy digitizing at a fast rate (e.g. >1Ks/sec/ch).
Seconds since starting the current digitization, in units of seconds, accurate to 1ms, based on the computer's clock.
This is the number of seconds since the start of the current scan, if running in Oscilloscope mode, or the number of seconds since the start of the digitization if running in Strip Chart mode. If trigger is enabled, DigitizeSecs reflects the seconds since the trigger event. DigitizeSecs time is based on the last digitized point, which is paced by the i2x0/i60x controller clock.
Seconds since midnight, Jan 1, 1904, based on the computer's clock.
Number of seconds between midnight, Jan 1, 1904 and the launching of instruNet World.
Current month, 1 to 12 range, e.g. cMonth is 4 in April.
Current day, 1 to 31 range, e.g. cDay is 21 on April 21.
Current year, e.g. cYear is 2003 during that year.
Current hour, 0 to 23 range, e.g. 72 minutes after midnight, cHour is 1.
Current minute, 0 to 59 range, e.g. 72 minutes after midnight, cMinute is 12.
Current second, 0 to 59 range, e.g. 72.5 minutes after midnight, cSecond is 30.
User Interface Keywords
Returns current mouse button state: 0 if up, 1 if down.
Returns current mouse position. MouseX returns the x coordinate, and MouseY returns the Y coordinate; relative to (0, 0), which is the window upper left corner.
Set to true (1) if the last file i/o operation completed ok, and set to false (0) otherwise. Pressing cancel in a file dialog is considered not ok. Keyword FileOk is always set after executing the following script routines: Close, Create, Flush, Open, SetMasterDir, SetPointer, SetSize, print to file, copy or append to or from file, and execute file.
The highly programmable gen() function generates complex waveforms composed of periodic and non-periodic pulses, ramps, and constant outputs. It outputs a value each time it is executed and is often used to drive an analog or digital output channel from within a Control Calculate field or the Control Script, both of which execute at the Control Rate. Arguments are evaluated left to right, and one can place up the 64 arguments in one gen() function. Gen is controlled by a series of instruction keywords, each of which are followed by several parameters. For example, gen(Flat, 2, 3, Flat, -2, 4, Recycle, 1) repeatedly outputs 2 (e.g. Volts) for 3 seconds, followed by -2 for 4 seconds. The first Flat instruction specifies 2 for 3sec, the second Flat instruction specifies -2 for 4 sec, and the Recycle instruction tells the gen function to recycle to the first Flat instruction, to repeat the process indefinitely.
The Flat instructional keyword is followed by two parameters, value and durationSecs, which specify a constant value to be output for durationSecs. For example Ch3_Vout! = gen(Flat, 2, 1, Flat -4, 3) in the Control Script will, after starting the digitize process, output 2V for 1 second followed by -4V for 3 seconds.
The Recycle instruction is followed by one parameter, argNum_base1, which tells the gen() functions to jump to the instruction specified in argNum_base1, where 1 is the 1st argument in the gen() function, 2 the 2nd, etc. For example Ch3_Vout! = gen(Flat, 2, 1, Flat -4, 3, Recycle, 1) in the Control Script will, after starting the digitize process, continuously output 2V for 1 second followed by -4V for 3 seconds, followed by another round of 2V/-4V, until the digitizing stops. The Recycle, 1 instruction tells the gen() function to jump to the 1st argument.
The Ramp instruction is followed by two parameters, newValue and durationSecs, which specify that the output is to ramp from its current value to newValue in durationSecs. For example Ch3_Vout! = gen(Flat, 0, .001, Ramp, 4, 10, Recycle, 1) in the Control Script will, after starting the digitize process, ramp from 0V to 4V over a 10 second period, and then repeats the process until digitizing stops.
The WaitTrigger instruction tells the gen() function to continue outputting its last output value until the digitize trigger occurs; in which case, it should jump to the instruction. For example Ch3_Vout! = gen(WaitTrigger, Flat, 0, .001, Ramp, 4, 10) in the Control Script will, after the digitize trigger is received, ramp from 0V to 4V over a 10 second period, and then stop (i.e. stay at 4V).
The WaitScan instruction is similar to WaitTrigger, except it waits for a scan to begin, instead of a trigger.
The PauseControl instructional keyword is followed by one parameter, controlValue. When the gen() hits this instruction, it will continue to output the same value until controlValue is TRUE (i.e. < -0.5 or > +0.5). One often uses a mathematical expression for controlValue. For example Ch3_Vout! = gen(PauseControl, (Ch1_Vin+! > 2), Flat, 0, .001, Ramp, 4, 10) in the Control Script will wait for channel Ch1 Vin+ to go above 2V before outputting its 10 second 0V to 4V ramp.
One can substitute a mathematical expression that includes variables!, strings$, channel values, and front panel objects (e.g. Edit Fields) for any of the numerical arguments used in the gen() function. For example, Ch3_Vout! = gen(Flat, abs(ch1_vin+! * ch2_vin-!), 0.001) will output from Ch3 V out the absolute value of Ch1 V in multiplied by Ch2 V in.
Returns 1 (e.g. true) if value is between lowerThreshold and upperThreshold; and returns 0 (e.g. false) otherwise.
OnOff( value, lowerThreshold, upperThreshold )
Returns 0 (e.g. false) when value goes above the upperThreshold; and returns 1 (e.g. true) when value falls below the lowerThreshold. If value is above lowerThreshold when we start digitizing, we output 0 until value goes above the upperThreshold.
Limit( value, lowerThreshold, upperThreshold )
Returns upperThreshold if value is greater than upperThreshold ; returns lowerThreshold if value is less than lowerThreshold; and returns value if value resides between the lower and upper thresholds.
PID( value, setPoint, P, I, D )
PIDL( value, setPoint, P, I, D, minOutput, maxOutput )
PID is a common algorithm used to control temperatures, pressures and velocities. The value parameter is the current value of the quantity being controlled, setPoint is the target quantity, P is the proportional term, I is the integration term, and D is the derivative term. The derivative term uses a 3 point filter, described below, to reduce susceptibility to noise. PIDL() contains two additional parameters, minOutput and maxOutput, which limit the output term. PID and PIDL must be placed within a Control Calculate field or Control Script in order to operate correctly. Mathematically, these functions are defined as follows:
Appends the text in the specified source object [e.g. string$, variable!, define#, "quotedText", (math expression), or numerical constant] to the destination string$, variable!, page or open file. For example, Append Script Test would append the text in the Script page onto the end of the text in the Test page. Append "abc" str$ would append "abc" onto the end of the existing text in string str$.
Clears the data from the specified object. Clear Variables clears all variables (strings$, vars!, defines#) of their data, Clear userPages clears the text in the pages created with the NewPage command, Clear Buttons deletes the buttons created with the NewButton command, Clear files sets the file size of all open files to 0 and in effect clears them of data, Clear pageName clears the specified text editor (e.g. Test, Script, user-defined-page1), Clear fileName clears the specified open file, and Clear All clears all previously mentioned items.
Copies the text in the specified source object [e.g. string$, variable!, define#, "quotedText", (math expression), or numerical constant] to the destination page, string$, or open file. For example, Copy Script Test would copy the text in the Script page into the Test page. Copy "abc" str$ would copy "abc" onto string str$. String Copy is very similar to string Append, yet replaces the destination text with the source text, instead of appending it.
Define name# (=) substitutionText
This command substitutes substitutionText for name# every time name# appears in the program code. Defined names must end in a "#" character. Substitution text can be of any length yet must be enclosed in quotes " " if it contains spaces or capital letters. Also, the substitution text can appear on multiple lines within the text file, in the event it is lengthy. Defines are similar to strings$, except they are typically set once, and possibly read multiple times; whereas strings$ are typically set multiple times. The "=" character after the define name is optional (e.g. define x# = "abc" is identical to define x# "abc"). For details on creating lists of channels with a define statement, and for example uses of Define, click here.
This command deletes the specified set of objects from memory. Delete Variables deletes all variables!, strings$ and defines# from memory; Delete Buttons deletes all user created buttons from memory, Delete pages deletes user created pages, and Delete All deletes all previously mentioned items. Related Topics: Script Engine States.
This command copies a concatenated list of text items to the specified string. This is the same as the Print command, except the destination string is first cleared before text is concatenated onto it. For example, a! = 9.8, b$ = "abc", Str$ = a! + "--" + b$ + " " (3 + a!) + b$[2, 3] causes Str$ to be loaded with "9.8--abc 12.8bc". For details on the various options, please see the Print command.
Variable! = math expression
A command which loads the specified variable with the result of the math expression. For example, a! = 2, s$ = "3.2", v! = abs(a! + s$) + 3 causes v! to be loaded with 8.2. Related Topics: Math Expressions.
Debug [ on / off ]
This command toggles debugging on or off. If on, diagnostics are printed to the Test page each time a line of script code is executed, as noted here. This can be useful when debugging code that is not working properly. Also, adding additional Print statements to your code (e.g. Print Script ..., Print Test ...) can aid in debugging as well. Related Topics: Debugging your Scripts.
Stops execution of the current script. All variables!, defines#, and strings$ remain alive and well, until one does Delete Variables, Clear Variables,
Resets the Script Engine, or exits instruNet World.
Executes the text in the specified open file or string$. With files, one must first use the Open command to open an existing file, or the Create command to create a new file, and then close the file with the Close command when done. Related Topics: Scripts That Run Other Scripts.
For variable! = Start To Stop ...body...
This is the traditional For loop, which facilitates a loop with a control variable that increment by 1 each time through the loop, starting at Start, and going until Stop. For example, the code below prints Channel#1 three times.
For c! = 1 to 3
Print "Cycle=" c! ", Ch1 Vin=" ch1_Vin+! "\r"
Goto ... label:
Labels are unique words by themselves on one line with a ":" suffix (e.g. StageTwo:). They are ignored when executed directly, and are used as targets for a Goto label statement. For example, the code below continuously prints Channel#1.
The If/Elseif/Else/Endif commands facilitate executing specific fragments of code, depending on a mathematical test. The ElseIf components can be repeated many times, providing a means by which one can include many different cases. EndIf must be placed at the end of the decision tree. Below is an example of an "If" based decision tree.
if (x! == 0)
print "x! is 0"
elseif (x! == 1)
print "x! is 1"
print "x! is not 0 and not 1"
If (mathExpression) then commandToExecuteIfMathExpressionIsTrue
This is a one line version of the traditional "If (mathExp) ... EndIf", where only one line of code is executed if the math expression is true. There is no body of code and no EndIf command in this one-line version. For example, If (a! < 2) then Beep sounds a beep if variable a! is less than 2.
Registers a 13 digit instruNet World+ license for your computer, in the same manner as that done by selecting Install iW+ License in the Script menu.
Executes the code between Loop and EndLoop numCycles times. If the secsPerLoop parameter is
not specified, the loop executes as fast as possible; otherwise, it executes the body of the loop once
every secsPerLoop seconds. If keyword mouseStop is included, it falls
out of the loop if the mouse button is pressed. One can also stop by pressing the Stop button at the top
of the Script page, or pressing CONTROL 'S'.
When placed inside a loop (e.g. While, For, Loop), the synchronizer causes the loop to execute once every secsPerLoop seconds.
While ( mathExpression ) ...body...
This is the traditional While loop, which executes the body for as long as the math expression evaluates as true. For example, the code below prints Channel#1 three times.
Shows an alert with the specified alert text, which could be in the form of "quoted text", a string$, or a define#. For example, Alert "Hello" would show an alert with "Hello" in the body of the dialog.
Sounds a short beep.
Implements a delay that is seconds long. For example, Delay (1 + 2) would implement a 3 second delay. One can stop the delay only by pressing the Stop button at the top of the Script page, or by pressing CONTROL 'S'.
Erase pageName, numOfLines
Erases the last numOfLines lines from the specified page. For example, Erase Test 1 would erase the last line of text from the Test text editor page.
Prints a list of items to the specified destination text editor page (e.g. Test), or open file. Recall that pages are specified by their tab name, as shown at the bottom of the window. If the first parameter after Print is not a file or page, the printing is directed to the current page.
The current time is substituted for keyword time, the current date is substituted for keyword date, a list of variables are substituted for keyword variables, and the list of channels enabled for digitizing are substituted for keyword digitizeList (e.g. "1/1/1/4, 1/1/1/7"). Keywords are not case sensitive.
Text in quotes is printed exactly as is. The list of items (i.e. quoted text, time, date, variables!, strings$, defines#) can appear in any order and be of any length. "\r" and "\t" within quoted text is interpreted as a carriage return or tab character, respectively. Items within parenthesis ( ) are first evaluated mathematically (e.g. (3 + abs(a! - 3)) in the item list would be evaluated mathematically and its numerical result would be printed). For many examples of the print command, please see file "...\ program files \ instruNet \ instruNet World+ \ Example Scripts (.iBs) \ Demonstrate Printing Functions.iBs".
To print a range of a string, supply the start and stop indices into the string array, base 0, within square brackets. For example, print str$[3, 5] prints the 3rd, 4th and 5th characters of string str$ (we assume the string beings with its 0th character). One can separate the items in the print list with a space character, or the + plus symbol. For example, Print "ab" "cd" and Print "ab" + "cd" are identical.
To print a value in the floating point format (from a variable!, string$ or define#); prefix %x.yf: to the object name, where x is the number of digits to the left of the decimal, and y is the number of digits to the right of the decimal (e.g. Print %1.3f:var! would print var! in a x.yyy numerical format). To force scientific notation, use %x.ye:. To allow the compiler to decide floating point or scientific notation, use %x.yg:. To force an integer printout, use %xd:. The script language uses the same numerical formatting conventions as ANSI C/C++. To learn more about this, please consult a book on the ANSI C library, and focus on the printf() function and the general topic of "printing numbers". Related Topics: Referencing Segments within a String$ or Define#, and Working with Files and Text Editor Text.
This command will shows a dialog box that displays messageText, an optional edit field for the user to type a response, and two buttons (e.g. OK and Cancel). The response is placed into string responseStr$ and variable pressedRightBtnVariable! is set to true (1) if the user pressed the right button to exit the dialog; and is set to false (0) otherwise. Optionally, the response field can contain defaultResponseText, which appears when the dialog is first opened. Also one can optionally specify the labeling of the two buttons via the leftBtnText via and rightBtnText arguments. For example, Question "How old are you?", response$, "20", userPressedRightBtn!, "Cancel", "OK" would show an alert with a "How old are you?" message, a default response of 20, and Cancel/OK exit dialog buttons.
Button and Page Commands
This command will create a new tab at the bottom of the instruNet World window that selects a new text editor region. For example, "NewPage Data" creates a new tab named "Data" and a new text editor region that appears when this Data tab is pressed. Subsequent code can then reference this region with the pageName "Data". For example, Print Data "Hello\r", would print the word "Hello" to the Data page. One can also create a page manually by selecting Create Panel Item > Page in the Setup menu. Related Topics: User Defined Pages, File I/O example, Print Digitized Channels example, and Simple Tutorial Example
These commands enable one to create a new button that executes the code between NewButton and EndButton when pressed. pageName specifies the page that the button is to reside in, and buttonName specifies the text that appears inside the button at the top of the window. Button names are typically less than 9 characters in length. Subsequent commands refer to this button by its buttonName. One can also create a button manually by selecting Create Panel Item > Button in the Setup menu. Related Topics: User Defined Buttons.
Press pageName, buttonName
This command automatically presses buttonName in page pageName. For example, Press Network Open causes the Network File Open dialog to appear. If we created a new page called "Data", and placed a new button into this page called "Calibrate", then executing Press Data Calibrate would be the same as if the user had pressed that button themself.
Selects page pageName, and displays its contents. This is similar to pressing a tab at the base of the window. For example, Select Record causes the Record page to appear. For a more complete example, click here.
[ Show / Hide ] [ Menubar / Pages / Buttons ]
Shows or hides the entire menubar, entire tab bar at bottom of window, or entire button bar at top of window. To show hidden menu bar & pages, press keys CONTROL SHIFT 'M'. For an example, click here. Related Topics: Window Options Dialog.
[ Show / Hide ] pageName
Shows or hides a tab at the base of the window, along with its corresponding page. For example, Hide Network hides the Network tab at the base of the window, and prevents the user from selecting it. For a more complete example, click here.
[ Show / Hide ] pageName, buttonName
Shows or hides a button at the top of the window. For example, Hide Script Execute hides the Execute button in the Script page, preventing the user from pressing it. For a more complete example, click here.
Data Acquisition Commands
This will implements a full instruNet hardware calibration. This takes several seconds and is used primarily to correct for minute measurement errors caused by temperature drifts. For more details, see Calibration.
This does a 0.000 µStrain calibration for all channels that are set up as strain gages & load cells by reading the voltage across the bridges, and placing it into the Constants Vinit field, for each strain gage and load cell channel.
This balances all channels that are set up with a Bridge wiring type (e.g. strain gage, load cell, potentiometer) by reading the voltage across the bridge, and placing it into the Constants Vinit field, for each bridge channel.
This balances all channels that are set up with Voltage Divider wiring by reading the voltage across the sense resistor, and placing it into the Constants Vinit field, for each voltage divider channel.
Calibrate chList, Vinit
For each channel in the chList; the Vinit fields are loaded with the measured voltage.
Calibrate chList, [ Int1 / Int2 ]
For each channel in the chList; the Mapping Internal1 or Internal2 fields are loaded with the measured engineering units value, as determined by the last Int1/Int2 parameter. For example, Calibrate Ch1_Vin+ Int1 measures the value at Ch1 Vin+, and places it into its Mapping Internal1 field. This facilitates doing two point calibration via the Mapping Setting area. For details, please see the Working With Calibration, Different Scales, & Mapping.
Calibrate [ BeepOn / BeepOff ]
Calibrate BeepOn (or BeepOff) enables (or disables) a beep sound after calibrating a device.
Calibrate [ CjcBeepOn / CjcBeepOff ]
Calibrate CjcBeepOn (or CjcBeepOff) enables (or disables) a beep sound after calibrating the cold junction compensation for thermocouples.
Calibrate [ CheckOn / CheckOff ]
Calibrate CheckOn (or CheckOff) enables (or disables) additional error checking when the next reset occurs.
Calibrate [ RecoveryOn / RecoveryOff ]
Calibrate RecoveryOn (or RecoveryOff) causes (or not) device simulation to be turned on in the event of a calibration failure.
Calibrate [ ReportOn / ReportOff ]
Calibrate ReportOn (or ReportOff) enables (or disables) the printing of a list of channels when the SEARCH button is pressed, after one has pressed the START (and then STOP) button in the RECORD page. This list includes channels that have been enabled for offset drift error correction while digitizing, as described at in Calibration. The list is printed to the TEST page.
instruNet Hardware Functions
ChReadback( channelName )
This function reads an output channel with input measurement hardware. For example, ChReadBack(Ch3_Vout!) reads Ch3 voltage output (i.e. a D/A channel) with the A/D converter. For details, see Reading back Output Channels.
CopySettings sourceChannel, destChanList
CopySettings copies the setup of one channel (e.g. Strain Gage, Thermocouple, etc) to multiple other channels. The first argument is the source channel user name, and the 2nd argument is a list of channels to receive the source channel's settings. The destination is often done with a define# which is set to a potentially long (e.g. 16 to 128) list of channels. For details on defining a long list of channels, click here. For an example of CopySettings, click here.
The function digitizes the channels in the chListchannel list at the specified samples-per-second-per-channel (sRate) and number-of-points-per-channel (nPts). Data is printed to the specified page, open file or string; with each channel in its own column. If keyword mouseStop is included in the command line, a mouse down aborts the data taking (also, pressing Stop in the Script pages stops execution). If keyword time is included in the command line, then the point time is placed in the left-most column of the resulting printed table. For a description of the separator, lastRowChar, and charPerCol parameters, please see the "Table" description, below. For an example of the Digitize command, click here.
Sets field fieldName in settingsGroup to newFieldValue for every channel in the chListchannel list. Please see file "...\ program files \ instruNet \ instruNet World+ \ Example Scripts (.iBs) \ Examples of setting up channels.iBs" for examples of SetField (which can be abbreviated "SetF"). Also, for more information, please see the Channel Setup and Calibration example.
SetTrigger triggerSource_chList, threshold, ( rising / falling ), ( off / auto / norm )
This function sets the digitize trigger source channel (e.g. 1/1/1/4), threshold, slope (keywords rising or falling) and mode (keywords off, auto, or norm). For example, SetTrigger 1/1/1/1, 2.0, rising auto would tell the Digitize command to not digitize until the voltage at Channel #1 rises above 2.0.
Simulate [ on / off / engage ]
Simulate devModelNum, netNum, firstDevNum, lastDevNum
Simulate enables the simulation of instruNet hardware, when no instruNet hardware exists on the computer (provided you are working with instruNet iNet32.dll
version ≥ 126.96.36.199).
This can be used to develop or test software on a computer without instruNet hardware. In addition, this can help one read instruNet World data when no hardware is present, since instruNet World wants to see hardware channels when it loads their data. For a summary of different simulation strategies, click here.
When simulating, disconnect or power off the real instruNet hardware to avoid confusing real with simulated.
Another application of Simulate is to specify that an instruNet device is to be simulated in the event that the real device hits a calibration error (e.g. broken unit, over voltage input) via the Calibrate RecoveryOn command. This can be helpful in recovering from a hardware failure with a large system, where one wants their software to not fail in the event that one device, out of many, fails.
To see if a device is being simulated, one select "Installed Hardware Report" under the Hardware menu and note
that simulated devices and networks include a "Sim" on their description line.
Simulate On sets up the simulation of one i555 at address net #1 dev #1 when Simulate Engage is next executed or at the next instruNet Reset. Simulate Off turns OFF the simulation of this one i555 when simulate engage is next executed or at the next instruNet Reset.
Simulate devModelNumnetNumfirstDevNumlastDevNum specifies that on the next Simulate Engage or next instruNet Reset, that instruNet devModelNum device (e.g. "430"
is model number for the i430 card) on network netNum between deviceNum firstDevNum and lastDevNum be simulated. For example, if one types the following code into the Script page, presses the Execute button, and then presses the Network tab (or select INSTALLED HARDWARE REPORT under HARDWARE menu), they would see ten i100's on network #1, and three on network #2, (simulated of course).
The Table function prints the value of the specified field for every channel in the chList
on one row of text. If a destination page, string, or open file is not specified, then it prints
to the current page. The channel list is stated
explicitly (e.g. "1/1/1/7, 1/1/1/10"), or through a define name#. The settingGroup parameter
refers to a settings area (e.g. Hardware, General, Mapping) and the fieldName parameter
refers to the name of a field (e.g. scale, wiring, sensor). For a list of these, please see:
The optional separator parameter is text that is placed between each data point (e.g. "\t" is a tab), and the optional lastRowChar parameter is text that is placed at the end of each row (e.g. "\r" is a carriage return). The optional charPerCol parameter specifies the number of characters dedicated to each point, padding with spaces (" ") when necessary. For an example that uses the Table function, click here or here.
All file commands write success/failure information to the FileOk variable. For comments on how to work with files, click here.
Close [ fileName / all ]
Closes the specified open file; or, if keyword all is specified, closes all open instruNet files.
This function will create a file with the specified file name in the specified directory. Keyword showDialog invokes the File Save dialog which allows the user to specify the OS file name (which is different from fileName used by the code to keep track of the new file) and file save location; keyword lastDialog causes the new file to be placed in the same directory as the last file I/O operation; keyword osDir causes the file to be placed in the operating system directory (i.e. "Windows\System32\")
; keyword appDir causes the new file to be placed in the same directory as the currently executing application program; keyword masterDir causes the file be placed at an internal pathname called the "Master Directory"; and keyword prodDir causes the new file to be placed in "..\program files\instruNet\" (i.e. the instruNet Product Directory).
One can set the Master Directory with the "SetMasterDir" command, which is described below. The fileName optionally includes a directory prefix. For example, if you create a folder called "End_User_Data" in the "..\program files\instruNet\" directory, and then create a file with prodDir keyword and "\\End_User_Data\\xyz.txt" filename, the file will be created at "..\program files\instruNet\End_User_Data\xyz.txt". We use "\\" in the fileName to represent a "\" character instead of a control character indicated by the "\". If the user presses Cancel in the File I/O dialog, this routine does not return an error, yet keyword FileOk is set to FALSE. Related Topics: File I/O Example.
Flush [ fileName / all ]
Writes pending data to disk for the specified open file. This is not a necessary function, since data is flushed periodically automatically, yet is here to allow additional control over internal file buffers.
Sets the master directory pathname via a file open dialog ('showDialog') or to the last used pathname ('lastDialog'). Keyword newFolder causes a new folder to be created. After being set, this global pathname can be used to direct other file I/O operations.
All open files have an internal pointer that refers to the last written to, or last read from, byte location (starting with 0). The SetPointer command moves this pointer a relative amount forward or backward from the 1st byte of the file ('fromStart'), the end of the file ('fromEOF') or from the current position ('fromPos'). If the byteIncrement value is positive, the pointer is moved forward; otherwise, it is moved backward.
Sets the size of the specified open file to a specific number of bytes; or if keyword toPointerPosition is used, to the location that was last read from or written to. Before spooling a large amount of data to disk, it is often helpful to preset the file size, so that new space on the disk is not constantly being allocated during data acquisition time.