TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Andrea on October 16, 2006, 10:17:06 AM

Title: reactor on QUIT.
Post by: Andrea on October 16, 2006, 10:17:06 AM
Good morning All.. 8-)

I'm playing with reactor..
and trying do to something like this..

Code: [Select]
(vl-load-com)
(vlr-command-reactor nil '((:vlr-commandEnded . endQCommand)))

(defun endQCommand (calling-reactor endquitInfo / EQP)
  (setq EQP (nth 0 endquitdInfo))
  (if (= EQP "QUIT") (alert "QUIT ended"))
)

But AutoCAD QUIT before showing the alert box...
same thing with commandCancelled and failed.

What i'm trying to do is to put some cad user information on a network drive before leaving AutoCAD.

Any help will be appreciated.

thanks. :-)
Title: Re: reactor on QUIT.
Post by: Patrick_35 on October 16, 2006, 10:39:37 AM
Hi

Code: [Select]
(vl-load-com)
(vlr-command-reactor nil (list (cons :vlr-CommandWillStart (function endQCommand))))

(defun endQCommand (calling-reactor endquitInfo)
  (if (= (car endquitInfo) "QUIT") (alert "QUIT ended"))
)

@+
Title: Re: reactor on QUIT.
Post by: MP on October 16, 2006, 10:47:05 AM
Code: [Select]
(vlr-command-reactor nil
   '( 
        (:vlr-commandWillStart . _CommandWillStart)
    )
)

(defun _CommandWillStart ( reactor args  )
    (if (member (car args) '("QUIT" "END"))
        (alert "I'm about to die!")
    )
)
Title: Re: reactor on QUIT.
Post by: Andrea on October 16, 2006, 01:22:31 PM
woo !  :roll:

thanks guys...but not working !  :-)

I think that's using vlr-commandWillStart is not the solution...

because autocad do not detect if user press Cancel in the dialog box when drawing wasn't save

by the way...MP....Nice avatar !  :wink:
Title: Re: reactor on QUIT.
Post by: MP on October 16, 2006, 01:42:15 PM
My guess is you're not talking about the AutoCAD application being killed, you're talking about a document being closed. Perhaps --

(vlr-docmanager-reactor nil
   '( 
        (:vlr-documentToBeDestroyed . _DocumentToBeDestroyed)
    )
)

(defun _DocumentToBeDestroyed ( reactor args  )
    (alert "Document about to die!")
)
Title: Re: reactor on QUIT.
Post by: Andrea on October 16, 2006, 02:37:53 PM
vlr-documentToBeDestroyed !!

thats the way !

thanks MP.
Title: Re: reactor on QUIT.
Post by: Andrea on October 16, 2006, 03:16:51 PM
oops...!!

was enjoying to earlier..
The routine work well only if we close a drawing....
but not when closing AutoCAD without any drawing...

so that create another question..
Is it possible to run any lisp without any drawing open ?

The program i'm trying to create is to send a message only when AutoCAD is closing.
is this possible in lisp ?
Title: Re: reactor on QUIT.
Post by: T.Willey on October 16, 2006, 03:24:11 PM
so that create another question..
Is it possible to run any lisp without any drawing open ?

The program i'm trying to create is to send a message only when AutoCAD is closing.
is this possible in lisp ?

Not that I know of.  You may have to look at another language.
Title: Re: reactor on QUIT.
Post by: Andrea on October 16, 2006, 04:13:19 PM
ok ...thank you. :kewl: