Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
160
Добавлен:
11.10.2020
Размер:
2.81 Mб
Скачать

Appendix F: - Command Line-/Command File

Appendix F: Command Line-/Command File

10.23 Command Line Commands

When CoDeSys is started, you can add commands in the command line which will be asserted during execution of the program. These commands start with a "/". Capitalization/Use of small letters is not regarded. The commands will be executed sequentially from the left to the right.

/online

Immediately after start CoDeSys tries to go online with the current project.

/run

/show ...

/show hide

/show icon /show max /show normal

/out <outfile>

/noinfo

/cmd <cmdfile>

After login CoDeSys starts the application program.

Only valid in combination with /online.

Settings for the CoDeSys frame window can be made.

The window will not be displayed, it also will not be represented in the task menu. The window will be minimized in display.

The window will be maximized in display.

The window will be displayed in the same status as it was during the last closing.

All messages are displayed in the message window and additionally are written in the file <outfile>.

No splash screen at start of CoDeSys

After starting the commands of the <cmdfile> get executed.

Example for a command line:

The project ampel.pro gets opened, but no window opens. The commands included in the command file command.cmd will be executed.

"D:\dir1\codesys" "C:\projects\ampel.pro" /show hide /cmd command.cmd

10.24 Command File (cmdfile) Commands

See the following table for a list of commands, which can be used in a command file (<cmdfile>). The command file you then can call by a command line (see above). There is no case sensitivity. The command line will be displayed as a message in the message window and can be given out in a message file (see below) except the command is prefixed by a "@".

All signs after a semicolon (;) will be ignored (comment). Parameters containing blanks must be embraced by quotation marks. Umlauts only may be used if the command file is created in ANSI code. Keywords can be used in the command parameters. A list of the keywords you find subsequent to the following tables of command descriptions.

Commands for controlling the subsequent commands:

onerror continue

The subsequent commands will be executed even if an error occurs.

onerror break

The subsequent commands will not be executed any more if an error

 

has been detected.

Commands of the online menu:

online login

Login with the loaded project ('Online Login')

CoDeSys V2.3

10-67

Appendix F: - Command Line-/Command File

online logout

Logout ('Online' 'Logout')

online run

Start of the application program ('Online' 'Run')

online stop

Stop application program ('Online' 'Stop')

online sourcecodedownload

Download of the source code of the project to the PLC ('Online'

 

'Sourcecode download')

online sim

Switch on of simulation mode 'Online' 'Simulation')

online sim off

Switch off of simulation mode ('Online' 'Simulation')

Commands of the file menu:

 

file new

A new project is created ('File' 'New')

file open <projectfile>

The project <projectfile> will be loaded ('File' 'Open')

possible additions:

 

/readpwd:<readpassword>

The password for read access is given here so that no dialog asking

 

for the password will appear when the read-protected project is

 

opened.

/writepwd:<writepassword>

The password for full access is given here, so that no dialog asking

 

for the password will appear when the project is opened.

file close file save

file saveas <projectfile> optionally add: <type><version>

The current project will be closed ('File' 'Close')

The current project will be stored ('File' 'Save')

The current project will be saved with the file name <projectfile> ('File' 'Save as')

Default: Project will be saved as <projectfile>.pro under the current CoDeSys version. If you want to save the project as an internal or external library or as project for an older CoDeSys version, add the respective command:

Possible entries for <type>:

"internallib" Save as internal library: "externallib" Save as external library: "pro" Save as project for older version:

 

valid entries for <Version>: 15, 20, 21, 22 (product versions 1.5, 2.0,

 

2.1, 2.2)

 

Example: "file save as lib_xy internallib22" -> The project "project

 

xy.pro", which is created in the current CoDeSys Version will be

 

saved as "lib_xy.lib" for V2.2.

file saveas <projectfile>

The current project will be saved with the file name <projectfile> ('File'

 

'Save as')

file printersetup <filename>.dfr

optionally add: pageperobject or

pagepersubject

file archive <filename>.zip

Define a document frame file ('File' Printer setup') and optionally define one of the print options 'New page per object' or 'New page per subobject' ; these settings affect the printing of the document (project documentation, see below)

The project will be archived in a zip-file with the given filename ('File' Save/Mail Archive')

file quit

CoDeSys will be closed ('File' 'Exit')

Commands of the project menu:

project build

The project that is loaded will be incrementally compiled ('Project'

 

'Build')

10-68

CoDeSys V2.3

 

Appendix F: - Command Line-/Command File

project rebuild or

The project that is loaded will be compiled in full ('Project' 'Rebuild')

project compile

 

project clean

Compilation information and Online Change information in the current

 

project will be deleted ('Project' 'Clean Project')

project check

The project that is loaded will be checked ('Project' 'Check all')

project compile

The current project will be compiled by "Rebuild all" ('Project' 'Rebuild

 

all')

project check

The current project will be checked ('Project' 'Check')

project build

The current project will be built ('Projekt' 'Build')

project import <file1> ...

The files <file1> ... <fileN> get imported into the current project

<fileN>

('Project' 'Import'). Regard: Wildcards can be used, e.g. "project

 

import C:\projects\*.exp" will import all files with extension *.exp found

 

in directory C:\projects.

project export <expfile>

The current project will be exported in the file <expfile> ('Project'

 

'Export')

project expmul

Each object of the current project will be exported in an own file,

 

which gets the name of the object.

project documentation

The entire project will be printed on the default printer ('Project'

 

'Documentation', see also above "file printersetup")

Commands for the control of the message file:

out open <msgfile>

The file <msgfile> opens as message file. New messages will be

 

appended

out close

The currently shown message file will be closed.

out clear

All messages of the currently opened message file will be deleted.

Commands for the control of messages:

echo on

The command lines will be displayed as messages.

echo off

The command lines will not be displayed as messages.

echo <text>

<text> will be displayed in the message window.

Commands for the control of replace of objects respectively for the control of files for import, export, copy:

replace yesall

Replace all (any 'query on' command will be ignored; no dialogs will

 

open)

replace noall

Replace none (any 'query on' command will be ignored; no dialogs

 

will open)

replace query

If a 'query on' command is set, then a dialog will open regarding the

 

replacing of the objects even if there is a 'replace yesall' or 'replace

 

noall' command

Commands for the control of the default parameters of CoDeSys dialogs:

query on

Dialogs are displayed and need user input

query off ok

All dialogs respond as if the user had clicked on the 'OK' button

query off no

All dialogs respond as if the user had clicked on the 'No' button

CoDeSys V2.3

10-69

Appendix F: - Command Line-/Command File

query off cancel

All dialogs respond as if the user had clicked on the 'Cancel' button

Command for calling command files as subprograms:

call <parameter1> ...

<parameter10>

call <parameter1> ...

<parameter10>

Command files will be called as subprograms. Up to 10 parameters may be passed. In the file that is called, the parameters can be accessed with $0 - $9.

Command files are called as subroutines. Up to ten parameters can be consigned. In the subroutine called you can access the parameters using $0 - $9.

Setting of directories used by CoDeSys:

dir lib <libdir>

Sets <libdir> as the library directory

dir compile <compiledir>

Sets <compiledir> as the directory for the compilation files

dir config <configdir>

Sets < configdir > as the directory for the configuration files

dir upload <uploaddir>

Sets < uploaddir > as the directory for the upload files

Delaying processing of the CMDFILE:

delay 5000

Waits 5 seconds

Controlling the Watch and Receipt Manager:

watchlist load <file>

Loads the Watchlist saved as <file> and opens the corresponding

 

window ('Extras' 'Load Watchlist')

watchlist save <file>

Saves the current Watchlist as <file> ('Extras' 'Save Watchlist')

watchlist set <text>

The watchlist is set active (corresponds to the selection of a list in the

 

left part of the watch and receipt manager window)

watchlist read

Updates the values of the Watch variables ('Extras' 'Read receipt')

watchlist write

Fills the Watch variables with the values found in the Watchlist

 

('Extras' 'Write receipt')

Linking libraries:

 

library add <library file1>

Attaches the specified library file to the library list of the currently

<library file2> .. <library fileN>

open project. If the file path is a relative path, the library directory

 

entered in the project is used as the root of the path.

library delete [<library1>

Deletes the specified library, or (if no library name is specified) all

<library2> .. <libraryN>]

libraries from the library list of the currently open project.

Copying objects:

object copy <source project file> <source path> <target path>

Copies objects from the specified path of the source project file to the target path of the already opened project.

If the source path is the name of an object, this will be copied. If it is a folder, all objects below this folder will be copied. In this case, the folder structure below the source folder will be duplicated.

If the target path does not yet exist, it will be created.

Read-only access for particular objects :

object setreadonly <TRUE|FALSE> <object type> | <object name>

Sets read-only access to a object; Define the object type and in case of object types pou, dut, gvl, vis also the name of the object.

Possible object types: pou, dut (data type), gvl (global variables list),

10-70

CoDeSys V2.3

Appendix F: - Command Line-/Command File

 

vis (visualization), cnc (CNC object), liblist (Libraries), targetsettings,

 

toolinstanceobject (particular Tools instance), toolmanagerobject (all

 

instances in the Tools tree), customplconfig (PLC configuration),

 

projectinfo (Project information), taskconfig (task configuration),

 

trace, watchentrylist (Watchand Recipe Manager), alarmconfig

 

(Alarm configuration)

 

e.g. "object setreadonly TRUE pou plc_prg" will set the PLC_PRG to

 

read-only access

Entering communications parameters (gateway, device):

gateway local

Sets the gateway on the local computer as the current gateway.

gateway tcpip <Address>

Sets the gateway in the specified remote computer as the current

<Port>

gateway.

 

<Address>: TCP/IP address or hostname of the remote computer

 

<Port>: TCP/IP port of the remote gateway

 

Important: Only gateways that have no password set can be reached!

device guid <guid>

Sets the device with the specified GUID as the current device.

 

GUID must have the following format:

 

{01234567-0123-0123-0123-0123456789ABC}

 

The curly brackets and the hyphens must appear at the specified

 

positions.

device instance <Instance

Sets the instance name for the current device to the name specified

name>

 

device parameter <Id> <Value> Assigns the specified value, which will then be interpreted by the device, to the parameter with the specified ID.

System call:

 

system <command>

Carries out the specified operating system command.

Select target system:

 

target <Id>

Sets the target platform for the current project.

Commands concerning managing the project in the ENI project data base: In the following in the description of the commands placeholders are used:

<category>: Replace by "project" or "shared" or "compile" depending on which of the following data base categories is concerned: Project Objects, Shared Objects, Compile Files

<POUname>: Name of the object, corresponds to the object name which is used in CoDeSys.

<Objecttype>: Replace by the shortcut, which is appended as an extension to the POU name of the object in the data base, and which reflects the object type (defined by the list of object types, see ENI Administration, 'Object Types').

Example: Object "GLOBAL_1.GVL" -> the POU name is "GLOBAL_1", the object type is "GVL" (global variables list)

<comment>: Replace by a comment text (embraced by single quotation marks), which will be stored in the version history with the particular action.

Commands to configurate the project data base link via the ENI Server:

eni on

The option 'Use source control (ENI)' will be activated resp. deactivated

eni off

(Dialog 'Project' 'Options' 'Project source control')

CoDeSys V2.3

10-71

Appendix F: - Command Line-/Command File

eni project readonly on The option 'Read only' for the data base category 'Project objects' will be eni project readonly off activated resp. deactivated

(Dialog 'Project' 'Options' 'Project objects')

eni shared readonly on The option 'Read only' für die Datenbank-for the data base category eni shared readonly off 'Shard objects' will be activated resp. deactivated

(Dialog 'Project' 'Options' 'Shared objects')

eni set local <POUname> The object will be assigned to category 'Local', i.e. it will not be stored in the project data base

(Dialog 'Project' 'Object' 'Properties' 'Data base-connection')

eni set shared <POUname> The object will be assigned to category 'Shared objects' (Dialog 'Project' 'Object' 'Properties' 'Data base-connection')

eni set project <POUname> The object will be assigned to category 'Project objects' (Dialog 'Project' 'Object' 'Properties' 'Data base-connection')

eni <category> server <TCP/IP_Address> <Port> <Projectname> <Username> <Password>

eni compile sym on eni compile sym off

Configures the connection to the ENI Server for the category 'Project objects'

(Dialog 'Project' 'Options' 'Project data base');

Example:

eni project server localhost 80 batchtest\project EniBatch Batch

(TCP/IP-Address = localhost, Port = 80, Project name = batchtest\project, User name = EniBatch, Password = Batch)

The option 'Create ASCII symbol information (.sym)' for the objects of category 'Compile files' will be activated/deactivated

(Dialog 'Project' 'Options' 'Project source control' 'ENI settings' for 'Compile files')

eni compile sdb on eni compile sdb off

eni compile prg on eni compile prg off

The option 'Create binary symbol information (.sym)' for the objects of category 'Compile files' will be activated/deactivated

(Dialog 'Project' 'Options' 'Project source control' 'ENI settings' for 'Compile files')

The option 'Create boot project' for the objects of category 'Compile files' will be activated/deactivated

(Dialog 'Project' 'Options' 'Project source control' 'ENI settings' for 'Compile files')

Commands of the menu 'Project' 'Data Base Link' for working with the data base:

eni set <category>

'eni set <category>set <Objecttype>:<POUname> <Objecttype>:<POUname>

eni <category> getall

'eni <category>get <Objecttype>:<POUname> <Objecttype>:<POUname>

The object gets assigned to the named data base category ('Define')

The objects which are listed separated by spaces will be assigned to the named data base category. ('Multiple Define')

Example:

"eni set project pou:as_fub pou:st_prg"

-> the objects (pou) as_fub and st_prg get assigned to category 'Project objects'

The latest version of all objects of the named category will be called from the data base ('Get All Latest Versions')

The objects of the named category, which are listed separated by spaces will be called from the data base. ('Multiple Define'). ('Get latest version')

Example:

"eni project get pou:as_fub gvl:global_1"

10-72

CoDeSys V2.3

Appendix F: - Command Line-/Command File

eni <category> checkoutall "<comment>"

-> the POU as_fub.pou and the global variables list global_1.gvl will be called from the data base

All objects of the named category will be checked out from the data base. The defined comment will be stored with the check-out-action in the version history.

eni <category> checkout "<comment>" <Objecttype>:<POUname> <Objecttype>:<POUname>

eni <category>checkinall "<comment>"

All objects (Objecttype:POUname) which are listed separated by spaces will be checked out from the data base. The defined comment will be stored with the check-out-action in the version history for each particular object.

Example:

"eni project checkout "for working on xy" pou:as_fub gvl:global_1"

-> The POU as_fub and the global variables list global_1 will be checked out and the comment "for working on xy" will be stored with this action

All objects of the project, which are under source control in the project data base, will be checked in. The defined comment will be stored with the check-in-action.

eni <category> checkin "<comment>" <Objecttype>:<POUname> <Objecttype>:<POUname>

All objects (Objecttype:POUname) which are listed separated by spaces will be checked in to the data base. The defined comment will be stored with the check-in-action in the version history for each particular object. (see above: check out)

The defined comment will be stored with the check-in-action in the version history for each particular object.

Keywords for the command parameters:

The following keywords, enclosed in "$", can be used in command parameters:

$PROJECT_NAME$

Name of the current CoDeSys project (file name without extension ".pro",

 

e.g. "project_2.pro")

 

 

$PROJECT_PATH$

Path of the directory, where the current CoDeSys project file is (without

 

indication of the drive and without a backslash at the end, e.g.

 

"projects\sub1").

 

 

$PROJECT_DRIVE$

Drive, where the current CoDeSys project is (without backslash at the end,

 

e.g. "D:")

 

 

$COMPILE_DIR$

Compile directory of the current CoDeSys project (with indiciation of the drive

 

and without backslash at the end, e.g. "D:\codesys\compile")

 

 

$EXE_DIR$

Directory where the codesys.exe file is (with indication of the drive and

 

without backslash at the end, e.g. D:\codesys)

 

 

Example of a command file:

A command file like shown below will open the project file ampel.pro, will then load a watch list, which was stored as w.wtc, will then start the application program and write – after 1 second delay - the values of the variables into the watch list watch.wtc (which will be saved) and will finally close the project.

file open C:\projects\CoDeSys_test\ampel.pro query off ok

watchlist load c:\work\w.wtc online login

online run delay 1000 watchlist read

watchlist save $PROJECT_DRIVE$\$PROJECT_PATH$\w_update.wtc

CoDeSys V2.3

10-73

Appendix F: - Command Line-/Command File

online logout file close

This command file will open the project ampel.pro, will load an existing watchlist w.wtc, will start the application program, after 1 second will write the variables values to the watch list w_update.wtc, which will be saved in the directory "C:\projects\CoDeSys_test" and then will close the project again.

A command file is called in a command line like shown here:

"<path of codesys.exe>" /cmd "<path of cmd file>"

10-74

CoDeSys V2.3

Соседние файлы в папке 759-333