How to Send Data to a Device

TWedge V2

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);

TWedge V3

Solution: For this purpose TWedge provides the Javascript member function WriteData (). This functon exists in two variants with different parameters.:

Why Are All Commands Ignored by the Device

Solution: When using the function WriteToDevice () (or WriteData ()) 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:

\" 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).

How Can I Append a Carriage Return to my Data?

You have to modify the script in the OnData or processData 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.

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".

Open the registry editor (Start -> Run -> “regedit”) and look for the following registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TWedge.

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!

Open the properties of the new TWedge service which you can find in the Control Panel -> Administrative Tools -> Services.

Go to the “Log On” tab and make assure that the checkbox “Allow service to Interact with desktop” is activated.

Run the TWedge service.

TEC-IT Datenverarbeitung GmbH

High quality software is what you are looking for - TEC-IT from Steyr (Austria) supplies this quality successfully.