Jump to content

React on close save


ripuz

Recommended Posts

Hi!

 

I want to run some code when the dwg file is being saved.

A command reactor make this happen but it doesn´t fire if the X (close) is pressed and the user chooses to save.

 

Like this:

(setq saveReactor (vlr-command-reactor nil '((:vlr-CommandWillStart . cbFunction))))

(defun cbFunction (reactor commandNameList)
(if (wcmatch (car commandNameList) "SAVE,SAVEAS,QSAVE")
 (alert "SAVED!")
)
)

 

Is it possible to do something when the user chooses to save?

Autopublish manages to do this...

 

Thanks in advance

Link to comment
Share on other sites

(defun cbFunction (reactor commandNameList / commandName)
 (cond
   ((wcmatch (setq commandName (car commandNameList)) "CLOSE")
    (alert (strcat "Closing \"" (getvar 'dwgname) "\""))
   )
   ((wcmatch commandName "*SAVE*")
    (alert (strcat "Saving \"" (getvar 'dwgname) "\""))
   )
 )
 (princ)
)

Link to comment
Share on other sites

Autopublish manages to do this...

 

Autopublish is coded in either .NET, or ObjectARX (C++ for AutoCAD) API... There's a lot more that can be done using those in lieu of LISP. :thumbsup:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...