- Posts: 731
- Thank you received: 0
Invoking "halcmd -s" within TCL script
4 years 11 months ago #225217
by HansU
Invoking "halcmd -s" within TCL script was created by HansU
Hi,
I want to use something like “halcmd -s show ...” with a library call in a TCL script. In halshow.tcl, the function hal seems to be the halcmd equivalent. But except the “-s” parameter. This isn’t accepted here.
My further investigation led to the definition of hal in linuxcnc.tcl.in.
I want to use something like “halcmd -s show ...” with a library call in a TCL script. In halshow.tcl, the function hal seems to be the halcmd equivalent. But except the “-s” parameter. This isn’t accepted here.
My further investigation led to the definition of hal in linuxcnc.tcl.in.
Code:
proc hal {args} {
load $::linuxcnc::TCL_LIB_DIR/hal.so eval hal $args
}
Please Log in to join the conversation.
4 years 11 months ago #227317
by HansU
Replied by HansU on topic Invoking "halcmd -s" within TCL script
That is not possible because the hal library provides only the functions like "show" and so on defined in halcmd.c:
But the command line option "-s" for scriptmode is only set in halcmd_main.c, so not accessible in the lib.
And of course it is also possible to invoke a subprocess with 'exec':
Maybe not so performant as the library call.
Code:
{"show", FUNCT(do_show_cmd), A_ONE | A_OPTIONAL | A_PLUS},
But the command line option "-s" for scriptmode is only set in halcmd_main.c, so not accessible in the lib.
And of course it is also possible to invoke a subprocess with 'exec':
Code:
exec halcmd -s
Please Log in to join the conversation.
Time to create page: 0.067 seconds
