I want to embed HTML and/or PDF doicumentation files into a project and then access them from a visualization screen using the HTML browser component. Is there a global variable or system function that contains/returns the project's root directory on the tagret runtime? I know I can poke around with a file manager and emperically find the path but thios is different for simulation builds than for live PLC builds and I suspect it could vary from one vendor PLC to another. I would like to find a solution that is independent of these variations.
Thanks in advance for any help.
$PlcLogic$/$visu$ is the placeholder to use.
How to get the contents of the placeholders? Placing them in the visu browser element's URL doesn't seem to work. Does this only work when executing shell command via windows/linux OS? I wish to display documents on a visualization screen using the html brwser element.
Is there a way to get the placeholder contents into a PLC stgring variable?
If you are using the webvisu and want to display a file located in $PlcLogic$/$visu$ (same folder where e.g. the webvisu.htm is located), you can simply use the file name.
SysFile should be able to resolve the placeholder.
Thanks Marcel. I still haven't figured out how to use the placeholder $PlcLogic$/$visu$ but you have given a very helpful about SysFile. If I embed an external file I can use SysFileGetPath('/App/Filename',Path,80) to get the path where it's stored. I can then compose a string containing the full path+filename for tyher browser. For anyone else interested a code snippet below:
// Path will contain full path minus file name
Path : STRING;
// Application - name of application in object tree
// index.html - name of embedded file
Filename : STRING:='Application/index.html';
SysFile.SysFileGetPath(Filename, Path, 80);
The webserver will only serve files located in $PlcLogic$/$visu$.
You cannot access any other files apart from this folder and its subfolder.
Path : STRING;
// Returns Path ='%ProgramData%/CODESYS/Simulation/PlcLogic/visu/'
Placing "file://%ProgramData%/CODESYS/Simulation/PlcLogic/visu/" into codesys embedded browser URL field displays the following:
Codesys Embeded Browser:
Can’t reach this page
•Make sure the web address is correct
•Search for this site on Bing
•Refresh the page
Placing "file://C:/ProgramData/CODESYS/Simulation/PlcLogic/visu/" into codesys embedded browser URL field displays a directory listign as expected.
So I am still unable to resolve the placeholder you suggest into a form that can be usaed in the embedded codesys browser. I don't see how the webserve plays into this at all, since I'm only wishing to display static html files located in the same file sapce as the runtime project.
Can you show some example of how to use the placeholder or how to resolve it to a form useable by the embedded browser?
I think you misunderstand me.
Only files located in $PlcLogic$/$visu$ will be served by the webserver (I dont know what happens if you use the Runtime Simulation inside CODESYS..)
If you want to display your custom PDF documentation inside the webvisualization, make sure that you copy this file into $PlcLogic$/$visu$.
The url for the browser element inside the webvisu should be something like this:
Log in to post a comment.