How do you open a Word, Excel or PDF document with a Comfort Panel?
-
Entry
-
Associated product(s)
Syntax of the "StartProgram" function
StartProgram Program name, Program parameter, Display, Wait for the end
Description of the parameters
- Program name
For the "Program name" parameter you specify the path and name of the program to be started.
- Program parameter
For the "Program parameter" parameter you specify the path and name of the document to be opened.
- Display
Defines how the program window is displayed on the operator panel:
hmiShowNormal = Normal
hmiShowMinimized = Minimized
hmiShowMaximized = Maximized
hmiShowMinimizedAndInactive = Minimized and inactive
Note
The display on 7", 9" and 12" Comfort Panels depends on the display always being set as maximized, but not full screen.
- Wait for the end
Defines whether there is to be return to the project after the called program has ended:
hmiNo = No (there is no return to the project)
hmiYes = Yes (there is return to the project)
Possible storage locations for the documents:
- Memory card: "\Storage Card SD\"
- USB stick: "\Storage Card USB\"
- Network release: "\\Network\" (example: "\\computer_name\release_name\...")
The following file formats are supported:
- .doc (Word 97-2003)
- .docx (Word 2007 and Word 2010)
- .rtf (Rich Text Format)
- .xls (Excel 97-2003)
- .xlsx (Excel 2007 and Excel 2010)
1. When using the system function "StartProgram" on a button on a Comfort Panel, you have the following options for opening a document
For this you enter the following parameters:
Program name | Program parameter | Result |
---|---|---|
\Storage Card SD\MaschineData_01.doc (*.docx) | The specified document is opened. | |
\Storage Card SD\MaschineData_01.pdf | The specified document is opened. | |
\Storage Card SD\MaschineData_01.xls (*.xlsx) | The specified document is opened. | |
WinCC V13 and higher \flash\AddOn\wt6explr.exe Up to WinCC V12 | The viewer starts with the "Open" dialog opened. Here you select your PDF, Excel or Text document on your storage medium. | |
/d wt6pdf*.dfr | The viewer starts with the "Open" dialog opened. Here you select your PDF document on your storage medium. | |
/d wt6xls*.dfr | The viewer starts with the "Open" dialog opened. Here you select your Excel document (.xls, .xlsx) on your storage medium. | |
/d wt6xlsx*.dfr | The viewer starts with the "Open" dialog opened. Here you select your Excel document (.xlsx) on your storage medium. | |
/d wt6doc*.dfr | The viewer starts with the "Open" dialog opened. Here you select your Text document (.docx, .doc, .rtf) on your storage medium. | |
/d wt6docx*.dfr | The viewer starts with the "Open" dialog opened. Here you select your Text document (.docx) on your storage medium. | |
\Storage Card SD\MaschineData_01.doc (*.docx) | The specified document is opened. | |
\Storage Card SD\MaschineData_01.pdf | The specified document is opened. | |
\Storage Card SD\MaschineData_01.xls (*.xlsx) | The specified document is opened. |
Note
MachineData_01.doc, MachineData_01.pdf and MachineData_01.xls are sample documents.
2. When using the system function "StartProgram" in a script on a Comfort Panel, you have the options below for opening a document
- Using the function list
Select the "StartProgram" function from the function list and enter the parameters according to the table at the lowest table.
In the Script Editor, you place the cursor on the required point and click "Apply". - Manual input of the script
Write the function directly in the Script Editor. Take the syntax from the lowest table.
You can predefine the parameters of the "StartProgram" function (as string) or provide them through tags (of the WString type).
The tags include the path specification. Make sure that the length of the tags is sufficient for the path specification. There are two types of path specification in the tags:
- Without quotation marks (for example: \Storage Card USB\Document_name.Document_ending) - this type is referred to in the following as the "FilePath" wildcard.
- With quotation marks (for example: "\Storage Card USB\Document_name.Document_ending") - this type is referred to in the following as the "FilePath_AZ" wildcard.
An example for a path specification without quotation marks is the return value of the "OpenFileBrowser" function. This function saves the path of a selected file in a tag. To be able to use this path in the "StartProgram" function, the tag must be used like the "FilePath" wildcard.
If the path specification transferred to the "Program name" parameter includes spaces, the path specification has to be given in quotation marks.
This can be done before transfer to the designated tag or in the script itself. In the script, this is done by inserting the ASCII code character (34), which corresponds to a quotation mark, before and after the string.
With the "Program parameter" parameter it does not matter whether or not the path specification contains spaces.
Type of input | Program name (fixed) | Variable path specification via the parameter "Program parameter" | Syntax in the Script Editor |
---|---|---|---|
Via function list | WinCC V13 and higher \flash\AddOn\wt6explr.exe | FilePath | StartProgram "\flash\AddOn\wt6explr.exe", SmartTags("FilePath"), hmiShowNormal, hmiNo |
FilePath_AZ | StartProgram "\flash\AddOn\wt6explr.exe", SmartTags("FilePath_AZ"), hmiShowNormal, hmiNo | ||
Up to WinCC V12 \windows\wt6explr.exe | FilePath | StartProgram "\windows\wt6explr.exe", SmartTags("FilePath"), hmiShowNormal, hmiNo | |
FilePath_AZ | StartProgram "\windows\wt6explr.exe", SmartTags("FilePath_AZ"), hmiShowNormal, hmiNo | ||
Manual input | WinCC V13 and higher "\flash\AddOn\wt6explr.exe" | FilePath | StartProgram "\flash\AddOn\wt6explr.exe", FilePath, hmiShowNormal, hmiNo |
FilePath_AZ | StartProgram "\flash\AddOn\wt6explr.exe", FilePath_AZ, hmiShowNormal, hmiNo | ||
Up to WinCC V12 "\windows\wt6explr.exe" | FilePath | StartProgram "\windows\wt6explr.exe", FilePath, hmiShowNormal, hmiNo | |
FilePath_AZ | StartProgram "\windows\wt6explr.exe", FilePath_AZ, hmiShowNormal, hmiNo |
Table 02
Type of input | Variable path specification via the parameter "Program name" | Program parameter (not required) | Syntax in the Script Editor |
---|---|---|---|
Via function list | FilePath_AZ | StartProgram SmartTags("FilePath_AZ"), "",hmiShowNormal, hmiNo | |
Manual input | FilePath_AZ | "" | StartProgram FilePath_AZ, "",hmiShowNormal, hmiNo |
Chr(34) & FilePath & Chr(34) | "" | StartProgram Chr(34) & FilePath_AZ & Chr(34), "",hmiShowNormal, hmiNo |
Table 03
Type of input | Program name (fixed) | Program parameter (fixed) | Syntax in the Script Editor |
---|---|---|---|
Via function list | WinCC V13 and higher \flash\AddOn\wt6explr.exe | /d wt6doc*.dfr (*.pdf, *.docx, *.xls, *.xlsx) | StartProgram "\flash\AddOn\wt6explr.exe", "/d wt6doc*.dfr", hmiShowNormal, hmiNo |
Up to WinCC V12 \windows\wt6explr.exe | StartProgram "\windows\wt6explr.exe", "/d wt6doc*.dfr", hmiShowNormal, hmiNo | ||
Manual input | WinCC V13 and higher "\flash\AddOn\wt6explr.exe" | "/d wt6doc*.dfr" (*.pdf, *.docx, *.xls, *.xlsx) | StartProgram "\flash\AddOn\wt6explr.exe", "/d wt6doc*.dfr", hmiShowNormal, hmiNo |
Up to WinCC V12 "\windows\wt6explr.exe" | StartProgram "\windows\wt6explr.exe", "/d wt6doc*.dfr", hmiShowNormal, hmiNo |
Before calling the "StartProgram" function it is recommended to check whether there is a path specification:
If FilePath <> "" Then
StartProgram Program name, Program parameter, Display, Wait for the end
End If
Note
When upgrading to WinCC V13, you must change the path of the File Viewer accordingly. The compiler does not recognize incorrect paths.
Additional Keywords
Office, Viewer, File viewer, Adobe Reader, Acrobat Reader, Document viewer, File, Storage, Storage path
- German
- French
- Italian
- Spanish
- Chinese
Entry belongs to product tree folder(s):
- Automation Technology Industry software Automation software TIA Portal Visualization SIMATIC WinCC (TIA Portal) SIMATIC WinCC (TIA Portal) Engineering
- Automation Technology Products for specific requirements Automatision technology for extreme conditions Operator Control and Monitoring Systems SIPLUS Operator Control and Monitoring Devices SIPLUS Comfort Panels
- Automation Technology Operator control and monitoring systems Operator devices Advanced HMI Panel-based Comfort Panels Comfort Panels Standard
- Automation Technology Industry software Automation software TIA Portal Visualization SIMATIC WinCC (TIA Portal) SIMATIC WinCC (TIA Portal) Runtime
- You have a technical question / problem: Ask the Technical Support
- You want to discuss in our forum and exchange experiences with other users
- You want to create CAx data for one or more products
- You would like to send us feedback on this Entry