Is it psossible to break previous command in a "dcl_sendstring"

Started by cbaCAD, June 02, 2015, 11:13:49 PM

Previous topic - Next topic

cbaCAD

Is it psossible to break previous command in a "dcl_sendstring", like ^C^C in mnu-method?
Rainer Bous
Dipl.-Ing. (FH)

roy_043

Code (autolisp) Select
(progn (dcl_sendstring (strcat (chr 27) (chr 27))) (princ))

Fred Tomke

Hm, not bad, roy! Didn't know that yet. Thanks!
Regards, Fred
Fred Tomke
Dipl.-Ing. (FH) Landespflege

[ landscaper - landscape developer - digital landscape and urban design]

cbaCAD

Thanks a lot, roy.
It works very well.
for example my code to use old mnu-commands:

(defun SUB:cba_sendstring (cmdstr)
  (cond   ((vl-string-search "^C^C^P" cmdstr)
    (dcl_sendstring (strcat (chr 27) (chr 27)))
    (setq cmdstr (vl-string-subst " " ";" cmdstr))
    (dcl_sendstring (substr cmdstr 7))
   )
   ((vl-string-search "^C^C" cmdstr)
    (dcl_sendstring (strcat (chr 27) (chr 27)))
    (setq cmdstr (vl-string-subst " " ";" cmdstr))
    (dcl_sendstring (substr cmdstr 5))
   )
   (T (dcl_sendstring cmdstr))
  )
;;; Ende SUB:cba_sendstring
)
Rainer Bous
Dipl.-Ing. (FH)

cbaCAD

It is a part of my Tablett-Emulator "cbaCAD TabEmu" powered by OpenDCL.
!!! I love OpenDCL !!!
Rainer Bous
Dipl.-Ing. (FH)

roy_043

@ cbaCAD:
I do not know the source of the cmdstr arguments. If you read them from a CUI you should be aware that not all macros end with a semicolon.
Example:
^c^c_line
Just using
Code (autolisp) Select
(dcl_sendstring "_line")
will not start the command. You will need to append a space (or any other white space character).

Some other considerations:
1.
(vl-string-search) is case-sensitive.
2.
Some macros begin with:
*^c^c
3.
Macros may look like this:
^c^c_line;\\^c_circle
4.
You should trim away trailing ^p and ^P portions.
5.
Use
Code (autolisp) Select
(progn (dcl_sendstring ...) (princ))
to suppress the T return value.