Hi,
I'm working on a plugin developpement and I was wondering if it's possible to call specific programs via JavaScript. Similarly with the OPEN/CLOSE button in the Fanuc Manual, I wish to call certain programs onClick (instead of setting some I/O) on the config Screen. I saw it's possible to RUNPROG via the autocfg.csv, so I hope there's way to run a program via JavaScript too.
CALL_PROG but for Plugin dev in JavaScript
- Exorcisme
- Thread is Unresolved
-
-
I'm not sure about that, but you could write a value to a register. Then use that register to start and run a program by monitoring it in BG logic.
-
Hey thanks for your suggestion
Do you have any idea how can I start and run a Program in BG Logic within the Plugin? (So the user doesn't need to set it up manually) -
You can't. That setup would have to be done on the robot. At least initially.
-
I imagine this thread is pretty well dead, but I figured I'd add my two cents...
Can use XMLHTTPRequest to start programs from within your plugin...
----Create Callback in Javascript----
window.onload = function(){
document.getElementById("elementID").setCallback(callbackFunction);
}
----XMLHTTPRequest in the callback----
function callbackFunction(){
var prg_req = new XMLHttpRequest();
prg_req.open("GET", "/KARELCMD/IPL_yourProgramName", true);
prg_req.send();
}
This should work for both Karel and TP programs.
-
Hi,
...
. In fact, the only difference between
using /KAREL/ and /KARELCMD/ is that /KAREL/ will store the URL in the history and /KARELCMD/ will not.
...
-
I imagine this thread is pretty well dead, but I figured I'd add my two cents...
Can use XMLHTTPRequest to start programs from within your plugin...
----Create Callback in Javascript----
window.onload = function(){
document.getElementById("elementID").setCallback(callbackFunction);
}
----XMLHTTPRequest in the callback----
function callbackFunction(){
var prg_req = new XMLHttpRequest();
prg_req.open("GET", "/KARELCMD/IPL_yourProgramName", true);
prg_req.send();
}
This should work for both Karel and TP programs.
How to process parameters in Karel program?
example:
prg_req.open("GET", "/KARELCMD/IPL_yourProgramName?param1=" + vparam1 + "¶m2="vparam2, true); -
From my notes when I did this:
CodePassing variables to KAREL program from URL: http://localhost/KAREL/URL_PARAM_TEST?chVar1="Hello"&chVar2="World" variables must be strings. chVar1 and chVar2 had to be decl'd in the KAREL file as String variables, with those exact names. The '?' is the separator between program name and variable list, '&' is separator between variables. Max 10 variables. URL_PARAM_TEST is KAREL program name. Replace "localhost" with robot IP address.
-
From my notes when I did this:
CodePassing variables to KAREL program from URL: http://localhost/KAREL/URL_PARAM_TEST?chVar1="Hello"&chVar2="World" variables must be strings. chVar1 and chVar2 had to be decl'd in the KAREL file as String variables, with those exact names. The '?' is the separator between program name and variable list, '&' is separator between variables. Max 10 variables. URL_PARAM_TEST is KAREL program name. Replace "localhost" with robot IP address.
Thanks work perfectly. Also with relative path from /KAREL
Create an account or sign in to comment
You need to be a member in order to leave a comment