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

Version 4.5

Contents
========

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

6. 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>). 
  TNCcmd automatically executes the commands listed in the 
  command file.


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<key number>      : PLC: file access (only for TNC 426/430)
-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

@<command file>  : Commands from command file



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

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 

Other commands:
---------------  
SCREEN     Receive screen dump
LOG        Receive log file
KEY        Keystroke simulation
KEYSTR     Keystrokes simulation character sequence
MOUSE      Mouse simulation 
VER        Receive versions
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

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
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 [<exitnr>]            : 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 environment variables
ENVSET                      Creates/changes environment variables

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


6. What's new?
==============

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)

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



