TNCcmd -- Brief Description 
===========================

Version 5.8

Contents
========

1. Intro
2. TNCcmd operating modes
3. Program call
4. Exit codes
5. TNCcmd commands
6. Examples

7. What's new?


1. Intro
========

TNCcmd is a command line client for HEIDENHAIN TNC controls.
TNCcmd allows file transfer and other remote commands between
TNC and PC for Windows 95, 98, Me and Windows NT, 2000, XP.
TNCcmd uses Ethernet (TNC 426/430: as of 280476 01) or 
serial ports.

Enter ? in command shell mode for a list of all important commands.
Enter ?? in command shell mode for a list of rarely used commands.
Enter HELP <command> for more detailed information about the commands.

Sample:

TNC:\> HELP cd

CD <directory path>

Changes the active directory on the TNC
In local mode: Changes the active directory on PC


2. TNCcmd operating modes
=========================

There are three TNCcmd operationg modes:

- Command line mode
  You enter the command complete with parameters in the command line.
  It's recommended practice to enter the command with parameters
  in Semicolon (")

- Command shell mode
  You call TNCcmd (with or without switches). TNCcmd tries to
  establish a connection and waits for commands that
  you can enter at the command prompt. TNCcmd asks for 
  necessary parameters depending on the command. You end
  TNCcmd with the command "exit".

- Batch operation
  You call TNCcmd with a command file name as command line 
  parameter (@<command file name>. 
  You can omit the prefix @ if the file name has the extension 
  .tnccmd.
  TNCcmd automatically executes the commands in the command file 
  line by line.
  At command PAUSE the execution halts and by pressing key 
  'S' you can switch to single step execution


3. Program call
===============

TNCcmd [switch(es)] ["command [parameter(s)"] | @command file]

Switches:
-I<IP-address|host> : Connection over TCP/IP (Ethernet) 
                      only NC Software > 280476 03!
-P<port number>     : LSV-2 connection over serial port (default 1: COM1)
-B<baud rate>       : Baud rate (default: Auto detect)
-F[<drive>]<passwd> : Extended file access
                      Default drive: PLC:
-C "<caption>"      : Description of the connection (window title)
-L<x>               : Error messages in  0:    Englisch (default)
                                         1, D: German
                                         2, I: Italian    
                                         3, E: Spanish
                                         4:    French
                                         5:    Swedish
                                         6:    Finnish
                                         7:    Czech
                                         8:    Polish
                                         9:    Danish
                                         10:   Hungarian
                                         11:   Dutch

-W                  : Wait with command file execution after error
-S                  : Single step execution of command files

@<command file>     : Commands from command file


4. Exit codes
=============

The following exit codes are transmitted to the calling program/batch by default:

0 : No error
1 : At least one error
3 : Command parameter error
5 : No connection could be established
6 : Wrong password for extended file access

See also command EXIT to set your own specific exit codes in batch mode



5. TNCcmd commands
==================

The following is an overview of commands that are available in TNCcmd.
If you need detailed information on a command, use the HELP command.

File commands
-------------                
DEL        Delete file         
PUT        Transmit file(s)
GET        Receive file(s)    
RENAME     Rename file         
FILEINFO   File information  
UPLOAD     Transmit all files listed in a TPJ file
UPDATE     Update all files listed in a TPJ file
DOWNLOAD   Receive all files listed in a TPJ file
PROTECT    Protect file (readonly)
UNPROTECT  Clear file protection

Backup commands
---------------
SCAN       Receive a list of TNC file names into a LST file
BACKUP     Backup TNC files
RESTORE    Restore one file from a backup on the TNC
EXTRACT    Extract one file from a backup
SETUP      Restore all files listed in a LST file from a backup
SCANFILTER Setup of file types not to take in account

Transfer control
----------------
BIN         Switch transfer mode between text and binary 
MERGE       Switch transfer mode between text and table merge
BLOCKSIZE   Adjust block size
INSTALL     Install HEIDENHAIN online converter
STAT        Protocol statistic
REGBINTYPES Registers additional file extensions as binary file types

Directory commands:
-------------------
DIR        Show directory
DRIVEINFO  Information about current drive
CD         Change directory
MKDIR      Create directory
RMDIR      Remove directory

Connection control
------------------
CONNECT    Connect to the control (if TNCcmd is offline)
DISCONNECT Disconnect the control (if TNCcmd is online)
ACCESS     Extended file access
LOCAL      Switch to local (PC) view
REMOTE     Switch to remote (TNC) view 

Start Applications
------------------
LAUNCH     Start an application or batch
CALL       Start an application or batch and wait for termination

Other commands:
---------------  
SCREEN     Receive screen dump
LOG        Receive log file
KEY        Keystroke simulation
KEYSTR     Keystrokes simulation character sequence
KEYACTION  Extended key simulation
KEYPRESS   Extended key simulation
KEYRELEASE Extended key simulation
MOUSE      Mouse simulation 
VERSION    Receive versions
SIK        Show SIK ID
OPTION     Check if a specific SIK option is set
TIME       Receive date/time
SYNCTIME   Set date/time
SERVER     Start mini file server (LSV-2)
RESET      Reset control
REPLAY     Keystroke/mouse simulation from a log file

MPGET      Get machine parameter
MPSET      Set machine parameter

PSGET      Get active preset
PSSET      Calculate and write preset entry

RUNINFO    Get run information:
           Axes information
           Execution mode
           Execution point
           Overrides info 
           Program status
           Error information
           Operation times

MESSAGE    Display a message on the control screen

START      Start execution of a TNCcmd command file

HELP       Help on a specific command
EXIT       Exit the program


Commands for batch operation:
-----------------------------
*                           Comment line
:<label>                    Label 
>, >>                       Redirect output into file
@                           Suppress command display
PAUSE                       Waiting for keystroke,
                            switch to single step execution 
SLEEP                       Waiting for specified time (seconds)
QUERY <string>              Requests for an answer
                            You can test the answer with ON OUTPUT 1
                            (see below)
ECHO <string>               Outputs echo
ECHO.                       Outputs blank line

ON <condition> <action>     Conditional jump / conditional end:
 <condition>:
  ALWAYS                     : Always
  ERROR <number>             : If error <number> occurs 
  ERROR ALWAYS               : If any error occurs
  VALUE <env> [<comp>] <str> : If an environment variable compared with a 
                               specific string is TRUE
  VALUE <env> <comp> <val>   : If a environment variable compared with 
                               value <val> is true
  OUTPUT <l> [<comp>] <str>  : If output line / character sequence
                               compared with string <str> is true
  OUTPUT <l> <comp> <val>    : If number in output line / character sequence
                               compared with value <val> is true

   <l>:
          <line>             : Output line number of previous command 
          <line>.<token>     : Number of the character sequence (part of
                               output line separated by space characters)
          <line>.<token>.<substr>
    <substr>:
            <count>          : Count of the characters in the token
            l<left>          : Leading <left> characters in the token
            r<right>         : Trailing <right> characters in the token
            m<start>.<count> : <count> characters starting with <start> in 
                               the token

   Examples: 
   2.3.4     First 4 characters of the 3rd token in the 2. line 
             (same as 2.3.l4)
   2.3.m4.5  5 characters starting  with the 4th character of the 3rd token
             in the 2nd line

  <comp>: 
   String compare operators  : lt, gt, eq, ge, le, ne
   Value compare operators   : <, >, =, ==, <=, >=, !=, <>

 <action>:
  GOTO <label>               : Jump to line indicated with :<label>
  EXIT [<exit code>]         : Immediately terminate the batch  

WAIT UNTIL <m> <comp> <val>  : Wait until a PLC memory changes to a specified 
                               value
                               Allowed are M, B, W, D, I, O, T, C memory types.

                               Example: WAIT UNTIL B8934 > 100
    
WAIT TIMEOUT <time in sec>   : After the specified timeout the command WAIT UNTIL
                               and RESET terminates with error code 2.
                               The default value for the timeout is 0 (infinite).

ENVGET                      Reads contents of an environment variable
ENVSET                      Creates/changes an environment variable
ENVINC                      Increments a numeric environment variable
ENVDEC                      Decrements a numeric environment variable


6. Samples
==========

Samples command line calls:
---------------------------
  TNCCMD -p1 -b19200 "GET TEST.A C:\TEMP\TEST.A"
  
  TNCCMD -i160.1.247.22 "DELETE PLC:\TEST.A"

  TNCCMD -i180.0.10.22 "PUT TEST.BMP TNC:\TEMP\TEST.BMP /b"

Sample command shell mode:
--------------------------

  C:\JH\PROGRAMS> TNCCMD -i160.1.247.22
  TNCcmd - Version 4.00 - Connecting with IP address 160.1.247.23
  Connection established with TNC 430PA, Software ID 280476 03
  TNC:\> VER
  NC Model:            TNC 430PA
  NC Software Version: 280476 03
  NC PLC Version:      PLC42630_5
  NC Options:
  TNC:\> get pocket.h pocket.h
  Source File Name: pocket.h
  Target File Name: pocket.h
  ........................................................................
  ........................................................................
  ........................................................................
  ....................
  TNC:\> exit

  C:\JH\PROGRAMS>



Sample command file:
--------------------

  * Special handling starting with NC Software 280474 08
  @ECHO OFF
  ECHO "Version numbers:" > %Protocolfile%
  VER >> %Protocolfile%
  * Erase trash directory at TNC430
  ON VALUE %REMOVE_TRASH_DIR% NE "Yes" GOTO END
  VER
  ON OUTPUT 2 "280474" GOTO TNC280474
  ON ALWAYS GOTO OTHER
  :TNC280474
  VER
  ON OUTPUT 2.2 < 8 GOTO OTHER
  RMDIR TNC:\SCRATCH
  ON ALWAYS EXIT
  :OTHER
  RMDIR TNC:\OLD
  ON ERROR GOTO ERR
  ECHO "Old directories removed"
  ECHO "Directories removed" > %Protocolfile%
  ON ALWAYS GOTO END
  :ERR
  ECHO "Couldn't remove directory TNC:\OLD"
  :END
  PAUSE
   


7. What's new?
==============

The new SIK command shows the SIK ID number. Contrary to the VERSION command, 
the control type is not included in the output on NCK controls.

The new OPTION command offers a simple possibility to check whether 
a specific SIK option is currently set.


Version 5.7
===========
With the CONNECT command it is assumed now that a new connection setup 
(Reconnect) is desired if there was a connection before.

Support of the new password of the day

Support of .iocp and .iocl as binary types

The environmental variable CONNECTION (or SERIALPORT and BAUDRATE for 
serial connections) is/are initialized only if they don't already exist.

The behavior that the connection parameters were interrogated automatically 
and interactively if TNCcmd was called with the command file but without 
connection parameters (introduced as of v4.9) was removed again (Call 81529).

Now the exit code 8 is returned when a connection setup is canceled while 
waiting for confirmation from the control.
(Only on NCK-based controls with activated access control).


Version 5.6
===========
A note is displayed if access restriction is active on NCK-based controls and 
a confirmation dialog on the control therefore delays connection setup.
Attempts to establish a connection can be canceled with the ESC key.
The standard waiting time until cancelation of the attempt to establish a 
connection was increased to 60 seconds (can be changed with LSV2CONNECTTIMEOUT).
Connection establishment improved: connection is attempted every three seconds 
with a new socket.

After the control was reset, the "PLC login failed" error message could appear 
when reestablishing the connection if access to the system partition had been 
granted previously without access to the PLC also being granted explicitly. 
This is only possible if the setting REMOTE.PLCPASSWORDFORCED = YES is not 
set the control.
Reconnect did not work after transmission of the system files if the OEM.SYS 
entry REMOTE.PLCPASSWORDFORCED = YES was set on a current iTNC 530.
Errors occurring during RESTORE are now logged correctly in an .err file.

Correct support of the operation system files from the HEROS: drive in 
Machine Backup and Full Backup
If the file PLC:\_mpupdate\PLCE.SYS was contained in the backup, the file 
PLC:\OEM.SYS was not transmitted (in advance) upon SETUP or RESTORE S.

The PLC code number can now be given directly as third parameter (as expected)
during the BACKUP function in mode F or M.

Support for additional standard binary types .XML and .S

Environmental variable CONNECTION (or SERIALPORT and BAUDRATE for serial 
connection) automatically filled if connection is established successfully.


Version 5.5
===========
A note is displayed if access restriction is active on NCK-based controls 
and a confirmation dialog on the control therefore delays connection setup.

The standard waiting time until cancelation of the attempt to establish 
connection has been increased to 60 seconds.
It can be canceled with ESC. The waiting time can be changed with the 
environment variable LSV2CONNECTTIMEOUT

Errors occurring during restoring are now recorded in an .err file

Correct restoring of HEROS files in a full backup supported
(setting of Unix attributes)


Version 5.4
===========
The MESSAGE command can now also be used without the DNC option
(as of iTNC530 34040x 08/60642x 03)

In the UPLOAD/UPDATE function the PC file names can now also be entered in 
UNC notation (\\<server name>\<public folder>) in the TPJ file list.

Environment variables are now also resolved with interactive parameter entry

The SPLC software version (SPLCSOFTVERS token in OEM.SYS) is displayed if 
available (Call 74073)

TIME command: For batch execution a combined date/time string is available 
in output buffer 3
Format: DD.MM.YYYY;HH:MM:SS

New RESET parameter:
If SYNCRECONNECT is indicated, TNCcmd waits until the control has shut down
before the reconnecting time starts

With RUNINFO I the data of all axes are now sent to the output buffer

New MOUSE action value D for clicking Decoration

The software status (release, test, develop) is now shown with the 
VERSION command if the control supports this.

Improved the aid for KEYACTION; introduced further key identifiers (PC keys)

A daily password is now required to run the EXECUTE command (ACCESS S or 
command-line switch -f)

CMD 36 <nc sequence file (.tab)>,<tool sequence file (.csv)> 
"Show tool sequence" supported

Additional HEROS: system files are now included in the machine backup and 
full backup.

Single and double quotation marks are now permitted as string quotation marks.
This makes it possible to define environment strings containing ", 
e.g. envset EnvA S 'test "0" ok'


Version 5.3
===========
If several errors occur with the RESTORE function, they are saved in an 
.err file.
With the -I switch you can suppress a "Remove error / Repeat?" question 
in the RESTORE function.

With the new SETUP switch -s you can now define that restored files on 
the control are to receive the original file date.
For this purpose, the file date is now also saved in the .LST Backup List file.

With the SETUP switch -k you can now specify whether the "Keep the file 
if it already exists on the control" identifier from the GENSETUP function 
should be considered.

EXTRACT *: Extract all files from a BCK file.


Version 5.2
===========
The DOWNLOAD function now also supports LST files for selection

The EXTRACT function can now also be run if connection is established

The CONNECT function can now also be used in the batch mode

Files with the extensions .PDF, .XLS, and .MAP are detected as binary


Version 5.1
===========
The RESTORE/SETUP functions now recall in the .BCK file created by
BACKUP/GENSETUP whether a file was saved as binary

MOUSE function extended for special scroll actions

The reading of command files was optimized 

Repeated attempts are now supported in the SETUP function 
if a file cannot be transferred onto the control

The RUNINFO function now supports "First/Next Edit Error" as "Info type" 
parameter


Version 5.0
===========
Extension .STR and .PYC as binary file recognized

New function REGBINTYPES

Offline functions are now listed with ? function completely

RUNINFO extended with "Call Stack" information

Backup/Scan includes now version informationen

Secure table merge mode in PUT function supported

Maschine-/full backup: Additional HEROS 5 system files are saved

Additional vertical soft-keys for 19'' screen supported

LOG Function now also with NCK based controls (MLST 5) supported


Version 4.9
===========
New function KEYACTION with variants KEYPRESS and KEYRELEASE
(as of NC Software iTNC 530 34049x 06)

New functions ENVINC and ENVDEC

You need no @ prefix in the command line call if you use command file 
names with extension .tnccmd



Version 4.8
===========
New LAUNCH and CALL functions for application execution.

New function START to start a TNCcmd command file.

Switch /A with PUT und GET functions for automatic binary file type recognition.
Files with extensions .DMP, .MO, .JPG, .JPEG and .GIF are now also recognized as 
binary file types.
Support of environmental variable LSV2BINTYPES, in order to register additional 
file extensions as binary file types.
The list of the binary file types currently supported can be found on the
HEIDENHAIN FileBase.

The new soft-key buttons of the 19'' control screen are now supported by 
the KEY and REPLAY functions.

Single step execution of command files (command line switch -S; option S in function PAUSE)


Version 4.7
===========
GETDATA und OBSERVE interpret now also logical PLC operand values with  
iTNC 530 NC Software as of 34049x 05 correctly.


Version 4.6
===========
In the SETUP function the file PLC:\plce.bin, like the other system files, 
is transmitted before the control reset. 
Note: You have to unmount PLCE: before transmitting this file!


Version 4.5
===========
As of NC software 340 49x-04 for the iTNC 530, the DRIVEINFO function shows all 
available drives

The ACCESS function now also supports the PLCE: partition
(encrypted PLC area)

Program call switch -f extended for all available drives

New ENVGET and ENVSET functions

The output buffer is now only cleared before commands that generate an 
output themselves

The KEY and REPLAY functions support the simulation of soft keys via 
identifiers

The KEY function supports the entry of key names (KEY IDENT <name>)

RUNINFO function: New ToolInfo info type

New GETVALUE, SETVALUE, SUBSCRIBE, OBSERVE functions

New EXTRACT function

Mode X (ToolInfo) added to RUNINFO function. 
(As of NC software 340 49x-04)

PUT function with wildcards improved:
- Directories may now appear in Source/Target
- A directory may also be entered as a target

SETUP function: NC-Kernel configuration files (*.CFG) are now transmitted 
before the automatic reset.


Version 4.4
===========
RMDIR mode S: Deletes a directory with files and subdirectories

Funktion RESTORE mode C (Complete restore) extended: 
If you answer the confirmation dialog 
"All files of the backup will be recovered without confirmation" 
with P instead of Y, also write protected files are overwritten 
without notice.

With the function SCANFILTER you configure file types, which are 
commented out in the scan list file generated by the SCAN function.

UPLOAD: Files are not erased anymore, if source and target are identical


Version 4.3
===========
Command ON supports now different string compares
Command ON extended with mode ON VALUE

Attention! Incompatible change:
ON OUTPUT uses only the text output of the function immediately before 
the ON function!

Function ECHO extended with mode ECHO OUTPUT

Command UPLOAD extended with "keep if exist" functionality 
(flag /k in transfer file list)
Such files are not transmitted if they already exist on the control 

Function MOUSE


Version 4.2
===========
#include instruction to include additional TNCcmd command batch files

New command KEYSTR sends all characters of a string as key simulation 
to the control 

New command RUNINFO

New commands PSSET and PSGET for accessing preset entries

UPLOAD command checks/creates target directory only once and not
at every file entry

Path syntax for NC Kern based controls also supported

Wait time at SLEEP command can be entered in floating point format
(max. resolution 1/10 second, e.g. SLEEP 1.5)


Version 4.1
===========
Parameters can be max. 260 characters long (<= v4.0: 80 characters)

New command KEYSTR

Check for error code in ON function now also with E<hex number> possible 
(<= v4.0: 0x<hexnummer>)
Example: ON ERROR E20001739 GOTO LBL1

New SmarT.NC keys supported

GENSETUP (Generating  of a backup file) and SETUP or RESTORE S 
support now also files with blank space in the name


Version 4.0
===========
Command PUT supports now wildcards (*,?)
You can now enter also the host name instead of the IP-address 
as connection parameter.

Redirection of output into file with '>'  or '>>':
'>': Create file, '>>': Append to file

New commands MPGET and MPSET: Read/Write machine parameter
New command RUNINFO: Get program execution information

New batch command SLEEP: Waiting for specified time (seconds)
New batch command WAIT UNTIL: Waiting for PLC memory change.

Help overview splitted (? / ??)


Version 3.8
===========
PROTECT/UNPROTECT function added

ON ERROR now always refers to the error state of the last executed command


Version 3.5
===========
Backup-Scan: Switch -h for scanning of hidden files


Version 3.4
===========
The new Log Book entries of iTNC530 are now supported

Transmission speed optimized


Version 3.3
===========
SYNCTIME function: you can set date and time on the TNC 426/430 controls
to the same value as is on the PC.

DEL improved: You can also use a directory path with wildcard (*,?) 
file names.

GENSETUP function: You can create a backup file for setup purposes from
files which are located local on your PC. 


Version 3.0
=========== 
SETUP function: You get now a success message if the setup 
finished without errors

Environment variables are supported in the command parameters

Sample: ACCESS P %PLCPASSWORD%


Version 2.9
=========== 
If you have started TNCcmd with connection command line parameters, and TNCcmd 
cannot connect successfully, TNCcmd exits with exit code 5. 
(TNCcmd exits with exit code 1 at normal execution errors and with exit code 3 
 at call parameter errors)

Now are new backup modes available, which create password-protected backup 
files.

It's now possible to access the system partition with the "password of the day".

Before you can execute a setup, which transmits files onto the system partition,
you are asked for the PLC access password.


Version 2.8
=========== 
Also in command line mode TNCcmd ends the execution with an error code
if it cannot connect to the control. In older versions TNCcmd switched 
into the command shell mode.
It's now possible to use commands with switch parameters in command line mode.
Therefore it's necessary to enter the command with parameters
in semicolon characters(").
Sample: TNCcmd "PUT Test.h TNC:\TEST.H /c"


Version 2.5
=========== 
In Batch operation TNCcmd ends the execution with an error code
if it cannot connect to the control. In older versions switched 
TNCcmd into the command shell mode
At the same time a new switch was introduced:
Switch -W : Wait for key input after error

With the RESET Command you can optionally enter a wait time. It tells
how long to wait before TNCcmd tries to reconnect after control reset.


Version 2.3
===========
Access
------
You can now access to the private TNC files, if you enter the
correct password with the ACCESS command. If the OEM-Password 
for the PLC: access is forced, you can access with this 
password.

Transfer
--------
A protocol problem was solved concerning the SETUP command


Version 2.1
===========
Change view
-----------
You change the active view with the commands REMOTE and LOCAL between
actual TNC directory and actual PC directory.
The DIR and CD commands are working in the active view.


Version 2.0
===========
Start TNCcmd
------------
If you don't enter any connection command line parameters, TNCcmd starts in 
offline mode. With the CONNECT command you can then connect to the control.
With the DISCONNECT command you can change back to the offline mode.

Scan/Backup/Restore/Setup:
--------------------------
These commands implement the backup functions for Win32, which are also 
implemented in the DOS program TNCBACK.EXE.

Upload/Update:
--------------
These commands implement the data transfer of listed files (in a .TPJ file).
The same function is also implemented in the DOS program PLCLSV2.EXE.

Screendump:
-----------
The Screen command saves the TNC screen as a BMP file or places 
it directly into the clipboard.

Online conversion:
------------------
If you call PUT with the parameter /c, NC programs (.H and .I) 
will be converted in the PC to binary during transmission to 
the control.
During the first call, the conversion function takes the required 
files directly from the control and copies them into a subdirectory 
(the name is made from the IP address) of the program directory.
If you use the command INSTALL before the first call, you can 
declare the directory in which the configuration data is to be saved. 
If the subdirectory already exists, the program checks whether the files 
already exist in the correct version.

Block size:
-----------
If the TNC has an entirely new Ethernet card (LAN91C96 controller chip), 
you can attain a higher transmission rate with BLOCKSIZE 4. 
(Default as of 280476 04 :   3k Blocksize)

Parameter calling convention:
-----------------------------
Write parameters which contain blanks with enclosing " characters.
Sample: ECHO "This will start a PLC update". 



