Create QR-Code!

TWedge as Service

How to install the Software Wedge TWedge as Windows Service?

  1. Install the Windows Resource Toolkit. You can download it from Microsoft's Website.
  2. Open the Command Line (Start -> Run -> “cmd”), go to the installation directory of the Windows Resource Toolkit and enter the following command:
    Instsrv TWedge "C:\Program Files (x86)\Windows Resource Kits\Tools\srvany.exe".
    Command Line: Installation of Windows Resource Toolkit
  3. Open the registry editor (Start -> Run -> “regedit”) and look for the following registry key:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TWedge. Registry Editor: TWedge Registry Key
  4. Now add a "Parameters" key with a value called "Application". It contains the path to the executable of TWedge (default: C:\Program Files (x86)\TEC-IT\TWedge2\Bin\TWedge.exe C:\TWedge.twi). The twedge.twi file opens TWedge with the predefined settings!
  5. Registry Editor: Add new key Parameters
  6. Open the properties of the new TWedge service which you can find in the Control Panel -> Administrative Tools -> Services.
  7. Go to the “Log On” tab and make assure that the checkbox “Allow service to Interact with desktop” is activated.
    Services:  TWedge Properties
  8. Run the TWedge service.

Citrix

COM Ports on Citrix/Terminal Server

TWedge connects to the server, not to the client

Solution: You need to assign (or route) the COM port on the client to a virtual COM port on the server. This is called COM port redirection.

Use the links below to find more information about this issue:

Bi-Directional Communication

How to Send Data to a Device

How can I send data to my Device?

Solution: TWedge provides the function WriteToDevice () for this purpose. WriteToDevice () accepts two parameters:

  • The first one specifies the data which should be sent to the device.
  • The second parameter specifies the timeout (in milliseconds) for this operation.

The following example sends two lines of text: The first line prompts the device for accepting the username, the second line sends the username. Each line is terminated by a newline character (\n line feed):

WriteToDevice ("user\n", 1000);
WriteToDevice ("sysadmin\n", 1000);

Bi-Directional Communication

The Device Ignores All Commands

Why are all commands ignored by the device?

Solution: When using the function WriteToDevice () to send device configuration or initiation commands, please check if a newline or carriage return character is required. This is especially important if the device uses a protocol like TELNET. A newline character is specified by \n.

The following example sends the text "user" followed by a newline to the device:

WriteToDevice ("user\n", 1000);

Here is a list of common escape sequences:

  • \' Single quotation mark.
  • \" Double quotation mark. Use this escape sequence if you need to specify a " as part of a string.
  • \\ A single backslash character.
  • \b Backspace.
  • \n New-line (line-feed).
  • \r Carriage return. \r in combination with \n is used in DOS systems as sequence for a carriage return and new line. Most likely \n can be used instead.
  • \t Horizontal tab.
  • \f Form feed (for printers).

Keyboard Emulation

How Can I Append a Carriage Return to my Data?

You have to modify the script in the OnData event code. Carriage Return can be added via the escape sequence \r (Carriage Return) or \n (Line Feed). In Javascript string concatenation is done with the + operator.

Menu Configuration - Script Editor - Edit Code: OnData

Change the following code line and add the + "\n" as shown below:

SendKeyStrokes(DATA.replace (/\x00/g, " ") + "\n");

See the FAQ above for a list of common escape sequences.

Data Manipulation

How Can I Convert a Decimal (Float) to Integer?

My device sends 123.4 but I need only 123

Modify the script in the OnData event code: Menu Configuration - Script Editor - Edit Code: OnData. Replace the code lines with the following:

var myData = Math.round(DATA).toFixed();
SendKeyStrokes(myData);

This code will perform rounding. If you don't need rounding, replace the Math.round with Math.floor.

My balance sends grams but I need kilograms

Change your OnData event code to the following:

var myData = (parseInt(DATA)/1000).toFixed(3);
SendKeyStrokes(myData);

© TEC-IT Datenverarbeitung GmbH, Austria  |  Site Map  |  RSS  |  Imprint  |  Legal Conditions and Privacy  |  Contact