TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: GDF on March 19, 2019, 03:29:49 PM
-
I am trying to make the function ARCH:NOZ work between switching open drawing with files opened in different directories.
What type of funtion what I need when swiching from a directory F:\\ to a Z:\\ drawing and getting the warning message popup?
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Special Alert Boxes VLAX ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;Error-> (ARCH:MsgBox2 "Arch Program : Error" 16 "This is an Error Test" 4)
;;;Info-> (ARCH:MsgBox2 "Arch Program : Info" 48 "This is an Information Test" 4)
;;;Question-> (ARCH:MsgBox2 "Arch Program : Yes No" 4 "This is a Question Test\nplease make a selection" 0)
;;;QKeys-> (ARCH:MsgBox2 "Arch Program : Quick Keys" 64 "This is Quick Keys Test" 4)
;;;
;;; http://www.theswamp.org/index.php?topic=29537.0
;;; Patrick_35, GILE
;;; MsgBox
(defun ARCH:MsgBox2 (title buttons message time / return WshShell)
(setq WshShell (vlax-create-object "WScript.Shell"))
(setq return (vlax-invoke WshShell 'Popup message time title (itoa buttons)))
(vlax-release-object WshShell)
return)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Strip Folder Name ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;str2list by John Uhden, as posted to the adesk customization newsgroup
;;;renamed to Split to mimic VB(A) function
(defun ARCH:Split (str pat / i j n lst)
(cond ((/= (type str) (type pat) 'STR))
((= str pat) '(""))
(T
(setq i 0
n (strlen pat))
(while (setq j (vl-string-search pat str i))
(setq lst (cons (substr str (1+ i) (- j i)) lst)
i (+ j n)))
(reverse (cons (substr str (1+ i)) lst)))))
;;Example: (setq 2nd (nth 3 (ARCH:Split (getvar "dwgprefix") "\\")))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ARCH:NOZ Warning Function ;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun ARCH:NOZ ()
(if (= (nth 0 (ARCH:Split (getvar "dwgprefix") "\\")) "Z:")
(ARCH:MsgBox2
" Arch Program : Info"
48
"
Arch Program© Alert
---------------------------------------------------------------------------
You are in the \"Z:\" Directory! GET OUT!!!"
4)
)
(princ))
(ARCH:NOZ)
-
I did the warning at the menu level.
Adding the following to the Arch Menu file:
[$(eval,Current Directory is ''$(getvar,dwgprefix)'')]
[$(eval,Warning ''$(getvar,users5)'')]
[Activate Directory ''Alert Message''](ARCH:NOZ);
(defun ARCH:NOZ ()
(setvar "users5" "Get Out of Z:\\ Directory")
(if (= (nth 0 (ARCH:Split (getvar "dwgprefix") "\\")) "Z:")
(ARCH:MsgBox2
" Arch Program : Info"
48
"
Arch Program© Alert
---------------------------------------------------------------------------
You are in the \"Z:\" Directory! GET OUT!!!"
4)
)
(princ))
(ARCH:NOZ)
-
[$(eval,Current Directory is ''$(getvar,dwgprefix)'')]
[$(eval,Message : $(getvar,users5))]
[Activate Directory ''Alert Message''](ARCH:NOZ);
Update the routine:
(defun ARCH:NOZ ()
(cond
((= (nth 0 (ARCH:Split (getvar "dwgprefix") "\\")) "Z:")
(setvar "users5" "Get Out of Z:\\ Directory")
(ARCH:MsgBox2
" Arch Program : Info"
48
"
Arch Program© Alert
---------------------------------------------------------------------------
You are in the \"Z:\" Directory! GET OUT!!!"
4)
)
((/= (nth 0 (ARCH:Split (getvar "dwgprefix") "\\")) "Z:")(setvar "users5" "This Directory is OK")))
(princ))