Configuring scripting buttons in AdminClient
This section details the processes involved in configuring a script button.
Scripting needs to be activated.
To do this, proceed as follows:
Activate scripting
You will require at least one script with the name ScriptButton1. This script needs to be in either_.bat or_.exe (for example, ScriptButton1.bat or ScriptButton1.exe).
- Go to Script management module in the AdminClient.
- Go to Local files and then to the
ScriptButton1.bat
(or theScriptButton1.exe
). Copy this file into the Server scripting directory for automatic update of client - Click on Preview. You can find this button by going to Home > Button scripts and then clicking on Preview
- Click on Preview and the Test dialog will be displayed
- In Test dialog, go to the Test field. In this field, the text Button %1 clicked is displayed
- Confirm changes by clicking on OK and close the preview.
- Click on Apply to activate the script.
Go to the UserClient and click on Extras. In the far right corner of the menu bar, the Script 1 button will be displayed under the function Scripts. Test the script by clicking on the button. The dialog Running script 1 will be displayed and the script will be executed once.
Configure icon
You will require an image file with the name ScriptButton1. This file needs to be PNG, BMP or JPG (for example, ScriptButton1.png
).
- Go to Script management in the AdminClient.
- To use this file as an icon for the button, copy the image file into the Server scripting directory for automatic update of client.
- Click on Preview. You can find this button by going to Home > Button scripts and then clicking on Preview.
- The copied image will be displayed in the dialog Preview for the Script 1 button.
- Click Apply to load the image to the Server scripting directory. By doing this, the button can be used in the UserClient.
Go to UserClient and in Extras click on Update from server. The symbol/image will be displayed for Script1.
Configuring labels and tooltips
You will require an initialization file (ScriptButton1.ini
) with the following entries in the section [ButtonProperties]:
INI key I/O Description
Text I Button label
Tooltip I
Tooltip of the button in the GUI
Text _<Language>
I
Translation of button labels in the GUI (_DE / _EN …)
Tooltip _<Language>
I
Translation of button tooltip in the GUI (_DE / _EN …)
- Go to Script management in the AdminClient
- Copy the
ScriptButton1.ini
file into the Server scripting directory for automatic update of client. - Click on Apply to load the INI file into Server scripting directory for automatic update of client
Switch to the UserClient, click on Update from server and check the German and English names and tooltips. To see the English text, go to Extras and change the language to English and then restart the UserClient.
Determine that you want to execute the script so that it’s component dependent
- In the
ScriptButton.ini
, under [ButtonProperties], insert the line ComponentSpecific=Y - Carry out steps 5. – 8. in the Script management module of the AdminClient
Return to the UserClient and click on Update from server. Select at least one component and click on the scripting button. The dialog Script (name of button) is executed for n components is displayed.
Example of the INI file ScriptButton1.ini
[ButtonProperties]Text=S7-UploadTooltip="This button starts S7 upload job"Text_de="S7 Start"Tooltip_de="Dieser Button startet den S7 Upload-Job"ComponentSpecific=Y
Related Topics
- Scripting interface files for script buttons
- Configuration file for script buttons
- AdminClient -> Module script management
- UserClient -> Updating from server
- Activating scripting