I’m trying to pass parameters a project in applet mode, I’m using the code of a previuos posts:
from javax.swing import JApplet
from javax.swing import SwingUtilities
applet = SwingUtilities.getAncestorOfClass(JApplet, event.source)
value=applet.getParameter(“paramName”)
and I get the instance of the applet without problems but when I try to get the parameter I have None.
I try to use the function applet.getParameterInfo() to check that I have parameters and I’m getting None too.
I’m using Ignition version 7.6.4.
Any suggestions?
Try using the parent window instead of the event source:
from javax.swing import JApplet
from javax.swing import SwingUtilities
applet = SwingUtilities.getAncestorOfClass(JApplet, system.gui.getParentWindow(event))
value=applet.getParameter("javaws.sr.project")
system.gui.messageBox(value)
I try using the parent window but get the same result.
I pass in the URL the parameter named ‘User’ and I try to get this value like this:
from javax.swing import JApplet
from javax.swing import SwingUtilities
applet = SwingUtilities.getAncestorOfClass(JApplet, system.gui.getParentWindow(event))
user=applet.getParameter(“User”)
Is this correct? or I have to use another name for the parameter? I ask this because when I use “javaws.sr.project” as the parameter I get the correct name of my project.
Thanks
You need to post the HTML or fix it there.
I try using the parent window but get the same result.
I pass in the URL the parameter named ‘User’ and I try to get this value like this:
from javax.swing import JApplet
from javax.swing import SwingUtilities
applet = SwingUtilities.getAncestorOfClass(JApplet, system.gui.getParentWindow(event))
user=applet.getParameter("User")
Is this correct? or I have to use another name for the parameter? I ask this because when I use “javaws.sr.project” as the parameter I get the correct name of my project.
Thanks
Applet parameters come from the HTML:
<div class="applet">
<script>
var attributes = {
"codebase":"http://localhost:8088/main/system/launchbin/",
"archive":"launchclient.jar",
"code":"com.inductiveautomation.ignition.client.launch.BootstrapApplet",
"width":"800",
"height":"600"};
var parameters = { "classloader_cache":"false",
"javaws.sr.gateway.addr.0":"localhost:8088:8043/main",
"javaws.sr.scope":"C",
"javaws.sr.project":"TestProject",
"javaws.sr.launchts":"1396974861926",
"javaws.sr.main":"com.inductiveautomation.factorypmi.application.runtime.ClientLaunchHook"};
deployJava.runApplet(attributes,parameters,'1.6');
</script>
</div>
I have this HTML:
[code]
<script>
var attributes = {
"codebase":"http://192.168.111.165:8088/main/system/launchbin/",
"archive":"launchclient.jar",
"code":"com.inductiveautomation.ignition.client.launch.BootstrapApplet",
"width":"800",
"height":"600"};
var parameters = { "classloader_cache":"false",
"javaws.sr.gateway.addr.0":"192.168.111.165:8088:8043/main",
"javaws.sr.scope":"C",
"javaws.sr.project":"SentinelIPG",
"javaws.sr.launchts":"1396979112158",
"javaws.sr.main":"com.inductiveautomation.factorypmi.application.runtime.ClientLaunchHook"};
deployJava.runApplet(attributes,parameters,'1.6');
[/code]
I don’t see my parameter anywhere. How can I set a parameter in the HTML?