I created a script to modify autocad, but should close autocad first
I created this part to save all files, but can not close files without saving
(defun c:MyOpen (/ ansr target shell result)
(vl-load-com)
(if (< 5 (setq ansr (LM:Popup "Close all files" "Do you want to SAVE ALL opened files ?" (+ 3 32))))
(progn
(cond
( (= 6 ansr) (command "_.saveall" ) )
( (= 7 ansr) (progn ) )
) ; cons
(rnscrpt)
)
)
)
;;------------------------=={ Open }==------------------------;;
;; ;;
;; Uses the 'Open' method of the Shell Object to open the ;;
;; specified file or folder. ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; target - file, folder or ShellSpecialFolderConstants enum ;;
;;------------------------------------------------------------;;
;; Returns: T if successful, else nil ;;
;;------------------------------------------------------------;;
(defun rnscrpt (/ target shell result) ; LEE with modify
(if
(and
(or
(eq 'INT (type (setq target "C:\\MyApp.exe")))
(setq target (findfile target)))
(setq shell (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application")))
(progn
(setq result (vl-catch-all-apply 'vlax-invoke (list shell 'open target)))
(vlax-release-object shell)
(not (vl-catch-all-error-p result)))
))
;;-------------------------=={ Popup }==----------------------;;
;; ;;
;; Displays a pop-up message box prompting the user. ;;
;;------------------------------------------------------------;;
;; Author: Lee Mac, Copyright © 2012 - www.lee-mac.com ;;
;;------------------------------------------------------------;;
;; Arguments: ;;
;; title - Text to be displayed in the pop-up title bar ;;
;; msg - Text content of the pop-up message box ;;
;; flags - Integer indicating icon & button appearance ;;
;; Reference: http://lee-mac.com/popup.html ;;
;;------------------------------------------------------------;;
;; Returns: Integer indicating the button pressed to exit ;;
;;------------------------------------------------------------;;
(defun LM:Popup ( title msg flags / wsh res )
(if (setq wsh (vlax-create-object "wscript.shell"))
(progn
(setq res (vl-catch-all-apply 'vlax-invoke-method (list wsh 'popup msg 0 title flags)))
(vlax-release-object wsh)
(if (null (vl-catch-all-error-p res)) res))))