# Non Visuals

Nonvisual components

Non visual components provide functionality that does not necessarily have a visual component. They are not visible in OI runtime.

# Tag Copy

Nonvisual components

Left: Tag copy demo application. Right top: Tag copy demo app running in OI. Right bottom: Tag values change after triggering a tag copy.

Download the Tag Copy sample application

The tag copy component copies the values of one tag to another tag. The list of tags is specified in the tagList and allows multiple tag copy expressions separated by a semi-colon.

An example of multiple tag copy expressions showing different possible expressions:

sourceTag1 > dstTag1;
dstTag2 < sourceTag2;
sourceTag3 <> dstTag3
Value Description
sourceTag# The source-tag that will be copied.
dstTag# Destination tag.
> Specifies direction tag copy will execute.
< OIB will change this to a > and reverse the tags to be functionally equivalent.
<> Specifies bi-directional copy. When triggered, the tags will exchange with each other. If not using a triggerTag, the values will be synchronized on changes to either.

Tag copy is triggered in one of three ways:

  • when no triggerTag is specified, any change in the value of one of the source tags will trigger a change in the corresponding destination tag.
  • when triggerTag is specified, changes in the source tags are ignored until triggerTag is triggered.
  • when indexTag is set and indexChangeUpdatesDst is true, then whenever the indexTag changes values the tag copy at the new index location is executed.

# CSV File Read, CSV File Write

File read/write

Left: File read/write demo application. Right: File read/write demo app running in OI.

Download the File Read/Write sample application

The File Read and File Write components provide the ability to read and write from the filesystem. Data is stored in a limited CSV file format:

tagValue, tagName
tagValue, tagName
tagValue, tagName

Tags are specified in the tagList property. Multiple tags separated by semicolon are supported:

tagName1; tagName2, tagName3

Files can be written to or read from 3 different hardware locations:

Location Description
USB_Flash USB storage device (not the Data card used for OI applications). If no USB device is found, then an error is displayed.
HardDrive Internal harddrive (must be formatted for OI usage).
InternalFlash The USB data card used for application storage (in older OI versions this was a compact flash card - newer OI terminals use a specially formatted USB stick. See OI Runtime > Terminal Setup > Hardware Status and Configuration for more information.)

File locations are stored within an "appdata" directory.

TIP

If you want the file to be saved outside the "appdata" directory, prepend your filename with "../"

Note

OI supports only up to 65,535 lines in the file.

# File Write

This component supports writing tags. Multiple tags can be written at once, each tag is given its own line in the file.

Files can be overwritten or appended to.

Note

OI will create the appdata directory and the file if either does not exist and the hardware device is accessible.

# isDoneTag

If triggerOnEvent is ZeroToNonZero:

  • isDoneTag is set to 0 at the moment triggerTag is set to zero from nonzero
  • isDoneTag is set to 1 at the moment the script has been completed

If triggerOnEvent is AnyChange:

  • isDoneTag alternates between 0 and 1 at the moment the script has been completed.

# File Read

This component supports reading tags from the file specified. Multiple tags can be read.

The read component also supports reading sets of tags from a file that has been appended to using the indexGroupToReadTag to specify which group to read from the file.

Example

When we have 6 tags in the tagList and we ask for index 0 it will read first 6 rows in a file. When we ask for index 2 it will read rows 7-12, etc...

DANGER

The read operation using the index feature does not verify if there are empty or bad formatted lines in the file.

Empty or bad formatted lines are read as zeros.

Tags for which the data cannot be read because there are not enough rows in the file are zeroed.

# isDoneTag

If triggerOnEvent is ZeroToNonZero:

  • isDoneTag is set to 0 at the moment triggerTag is set to zero from nonzero
  • isDoneTag is set to 1 at the moment the script has been completed

If triggerOnEvent is AnyChange:

  • isDoneTag alternates between 0 and 1 at the moment the script has been completed.

# HTTP Script

The HTTP Script component allows execution of any script running on a remote or local HTTP server. Only one script at a time can run, and the previously executed script has to be finished.

The script is executed by HTTP POST request.

Any response other than 200 from the script is considered an error.

TIP

While the HTTP Script is intended to run scripts included with the application, it can interact with remote scripts on other screens or servers.

# isDoneTag

If triggerOnEvent is ZeroToNonZero:

  • isDoneTag is set to 0 at the moment triggerTag is set to zero from nonzero
  • isDoneTag is set to 1 at the moment the script has been completed

If triggerOnEvent is AnyChange:

  • isDoneTag alternates between 0 and 1 at the moment the script has been completed.

# Shell Script

The Shell Script component allows any executable program to run. The component is intended to function with only shell scripts (php and bash have been tested). Components can launch only one script at the time, the previously launched script has to be finished.

The script executed is terminated in case of OI application reload or OI exit.

The script is executed using POSIX function popen which internally runs 'sh -c' and waits for finish. The popen call is in separate OI thread so it doesn't block OI main loop.

WARNING

Scripts can be written that call other scripts in the background. Those scripts will not be terminated and care should be taken with any such arrangement.

# isDoneTag

If triggerOnEvent is ZeroToNonZero:

  • isDoneTag is set to 0 at the moment triggerTag is set to zero from nonzero
  • isDoneTag is set to 1 at the moment the script has been completed

If triggerOnEvent is AnyChange:

  • isDoneTag alternates between 0 and 1 at the moment the script has been completed.

# Generic Run

The Generic Run component provides the ability to run any arbitrary Windows programs.

If the external program is still running, triggering this component again will send the OI application to the bottom of Window's application stack.

TIP

A use case for this behavior is launching a browser to log into an MRP system. Once logged in, the operator can switch back to OI. Then, later switching back to the MRP system the operator will not need to log in again.

To prevent this type of use start the browser in kiosk mode (-k argument for iexplore.exe) and set hasCloseButton to true.

WARNING

Generic Run will only execute on OIWindows installations.

Last Updated: 11/11/2020, 10:31:44 AM