Hello everyone,
I want to show/ open pdf file in citect scada by pressing a dedicated button. Can anyone please guide me how can I do it.
Detailed answer is highly appreciated.
Thanks in advance.
Hello everyone,
I want to show/ open pdf file in citect scada by pressing a dedicated button. Can anyone please guide me how can I do it.
Detailed answer is highly appreciated.
Thanks in advance.
You could display a web browser on a page in your project. Just set the web browser URL to the path/filename of the PDF file and it will use whatever PDF viewer it has to display it. The exact method depends on the version of Citect/PlantSCADA you're using.
Another option is to open the PDF viewer as a separate app. See the ExecEx() Cicode function in knowledge base article TN28950. You'll have to search for it. The link keeps getting deleted from my message.
You just tell it the path/filename and Windows will open the registered PDF viewer.
Here's the Cicode function since this forum is blocking the link:
INT mhShellExecute = -1; // Run an application or opens a file, folder, shortcut, email, or web page with the associated application // // Arguments: // // sFile Name of the file, folder, or web page. May contain path substitutions // sParameters List of parameters if running an application (default = "") // sOperation Action verb for file associations. Right-click on the file in // Windows Explorer to see the available options. For example: // "edit" Launch the editor for the document // "explore" Open Windows Explorer for the specified folder // "find" Open Windows Find dialog // "open" Open the file, folder, or application (default) // "print" Print the document // sDefaultFolder Default folder for the application to use. May contain path substitutions // iMode Request that the application window opens in a specific state: // 0 Hidden // 1 Normal (default) // 2 Minimized // 3 Maximized // 4 Recent size & position // 5 Current size & position // 7 Minimized (active window remains active) // 10 Default state // // Return Value: // // 0 No error // 2 File not found // 3 Path not found // 5 Access denied // 8 Out of memory // 11 Corrupt exe file // 26 Sharing violation // 27 File association invalid // 28 DDE timeout // 29 DDE failed // 30 DDE busy // 31 No application associated with the file or operation // 32 DLL not found // // Examples: // // Open Windows' Find dialog: ExecEx("", "", "find"); // Open Windows Explorer for c:\windows: ExecEx("c:\windows"); // Open a document: ExecEx("[data]:report.xls"); // Print a document: ExecEx("c:\doc\report.doc", "", "print"); // Open an application: ExecEx("notepad.exe"); // Open a web page: ExecEx("">http://www.citect.com"); // Create an email message: ExecEx("mailto:test@microsoft.com"); // Open a shortcut: ExecEx("c:\documents and settings\all users\start menu\My Application.lnk"); // Run a DOS command: ExecEx("cmd.exe", "/c "); // INT FUNCTION ExecEx(STRING sFile, STRING sParameters = "", STRING sOperation = "", STRING sDefaultFolder = "", INT iMode = 1) INT hWindow = WinGetWndHnd(); INT iError; IF mhShellExecute = -1 THEN mhShellExecute = DLLOpen("shell32.dll", "ShellExecuteA", "JJCCCCJ"); END sFile = PathToStr(sFile); sDefaultFolder = PathToStr(sDefaultFolder); iError = DLLCallEx(mhShellExecute, hWindow, sOperation, sFile, sParameters, sDefaultFolder, iMode); IF iError > 32 THEN // Any value over 32 means success iError = 0; END RETURN iError; END
If you are using v8.40 or later, you can use the built-in Web Content control.
DspWebContentSetURL(INT nAN, STRING sURL)
nAN:
The AN where the Web Content control is displayed.
sURL:
A valid URL (maximum 255 characters).
You can manipulate sURL with your code to select different pdf files.
Dear Experts Jacky Lang Eric Black
Related to this subject. I need to open a PDF file using DspWebContentSetURL. But I need the user to navigate the PDF files on the system starting from a dedicated path and select a file to be viewed on the SCADA using DspWebContentSetURL.
Is that achievable and if it is not do you suggest any other method to navigate the PDF files on a certain path and view it on plant SCADA?
Please note that I am using the latest version of Plant SCADA.
Thank you in advance
Hi Mohannad Naser ,
Please refer to Cicode function FormOpenFile
https://docs.aveva.com/bundle/plant-scada/page/1106093.html
The sample code is also available in Example.CI of Example project.
You can create a button on the web content page calling FormOpenFile and assign the returned string to to sURL.
Hope it would help.
Jacky Lang
It works as intended. Thanks
Dear Jacky Lang ,
As per the help of the FormOpenFile function the parameter "bResetToDefault" is used to define the start location of the search to be from the latest location (false) or from the a specified default path (true).
I tried both true and false and the function always go back to the latest path not to a default path.
It is also not mentioned how to define a default path.
I need to configure the function to start the navigation always from a default path.
I hope it can be done.
HiMohannad Naser ,
Yes, it can be done but you need to successfully open a pdf file from any location via FormOpenFile at runtime. The location will be cached by Windows. FormOpenFile will use this location as default for any following file open operation.
I believe that the behavior of FormOpenFile is the same as some Windows applications, such as NodePad, always remembering the location of the last successful operation.
Parameter "bResetToDefault" becomes obsolete and had no impact on the behavior. We will update the help accordingly.
Regards,
Jacky