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.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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 would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
Best regards,
Marcel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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:
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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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:
http://<ip-addr>:8080/<pdf-filename></pdf-filename></ip-addr>
Best regards,
Marcel
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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.
Hey,
$PlcLogic$/$visu$ is the placeholder to use.
Best regards,
Marcel
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.
Best regards,
Marcel
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:
Last edit: rickj 2021-06-10
The webserver will only serve files located in $PlcLogic$/$visu$.
You cannot access any other files apart from this folder and its subfolder.
Best regards,
Marcel
Hi Marcel,
Placing "file://%ProgramData%/CODESYS/Simulation/PlcLogic/visu/" into codesys embedded browser URL field displays the following:
Codesys Embeded Browser:
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?
Hi Marcel,
Placing "file://%ProgramData%/CODESYS/Simulation/PlcLogic/visu/" into codesys embedded browser URL field displays the following:
Codesys Embeded Browser:
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?
Hello @rickj,
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:
http://<ip-addr>:8080/<pdf-filename></pdf-filename></ip-addr>
Best regards,
Marcel