Author Topic: I'm having a little trouble with a command reactor  (Read 942 times)

0 Members and 1 Guest are viewing this topic.

Rustabout

  • Newt
  • Posts: 135
I'm having a little trouble with a command reactor
« on: February 19, 2022, 12:22:25 PM »
I want to cancel the command then start my own command thereafter. I've gotten this to work (credit to Lee Max and and old forum topic I dug up), but it makes my screen flicker, and thereafter triggers my Number Lock key (and on this particular PC a icon for the number lock appears). I just check and actually the key isn't triggered if numberlock is turned off on my keyboard (just fyi, but not an option given how much I use the numberpad).

I am going to write a code that cancels the EATTEDIT command and starts a custom LISP command when a user double-clicks on certain blocks (I never use the EATTEDIT command anyways). I am also considering using a mouse double-click driven reactor (I'm willing do dodge this problem instead of solve it, but this will be a more challenging approach perhaps?).

Code - Auto/Visual Lisp: [Select]
  1. (vlr-command-reactor "Intercept _eatedit command" '((:vlr-commandWillStart . testCommandReactor)))
  2.  
  3.   (defun testCommandReactor (reactor params / wsh )
  4.  
  5.     (if (= (strcase (car params)) "EATTEDIT")
  6.  
  7.       (if (setq wsh (vlax-create-object "WScript.Shell"))
  8.  
  9.         (progn
  10.  
  11.           (vl-catch-all-apply 'vlax-invoke (list wsh 'sendkeys "{ESC}"))
  12.           (vlax-release-object wsh)
  13.  
  14.          ) ; end progn
  15.         ) ; end if
  16.  
  17.       ); end if
  18.  
  19.     ) ; end testCommandReactor
  20.  

Rustabout

  • Newt
  • Posts: 135
Re: I'm having a little trouble with a command reactor
« Reply #1 on: February 19, 2022, 07:49:36 PM »
Update: This seems to be a bug in the window's script shell. I think they "fixed" it at some point (it used to turn off NUMLOCK) but I think they fixed it by simply restoring Numlock after the script is closed. This means my computer thinks I pressed NUMLOCK and the icon appears... for anyone that's curious...

I found a better solution to above: UNDEFINE EATTEDIT and use a mouse double-click event whenever my blocks are double-clicked on (sort of like double-clicking on a PLINE).

Rustabout

  • Newt
  • Posts: 135
Re: I'm having a little trouble with a command reactor
« Reply #2 on: February 20, 2022, 05:48:45 PM »
Update #2: Had some trouble with the double-click reactor as well but got it working.... smooth as butter actually! Turns out the problem/solution was within the CUI. Disabling the double-click command for attribute blocks worked (see attachment).

stevej

  • Newt
  • Posts: 30
Re: I'm having a little trouble with a command reactor
« Reply #3 on: February 20, 2022, 06:37:09 PM »
Yeah. I killed eattedit a long time ago with one of LeeMac's layer reactor bits modified to suit.
Probably severe overkill, but eattedit never runs.

Code: [Select]
(defun startCommand (startcommandInfo / thecommandstart)
  (command "undefine" "eattedit")   ;eattedit no bueno
  (setq thecommandstart (nth 0 startcommandInfo))
  (cond
    ((= thecommandstart "eattedit") ;if the command is eattedit
     (c:AttEdit)                    ;Run ATTEDIT instead
    ) ; end condition
  ) ; end cond
  (princ)
)

Steve

Rustabout

  • Newt
  • Posts: 135
Re: I'm having a little trouble with a command reactor
« Reply #4 on: February 20, 2022, 10:44:34 PM »
Awesome!

Now we just need one to permanently disable help lol.

stevej

  • Newt
  • Posts: 30
Re: I'm having a little trouble with a command reactor
« Reply #5 on: February 21, 2022, 07:08:43 PM »
That would be a blessing.

Steve