muthu123 Posted May 16, 2010 Posted May 16, 2010 Dear friends, I have tried this follwing code in VLISP. But It returns nil in both cases. Please How can use msg box in my Lisp routine which will much help me. Please Provide alternative solution. (vl-load-com) (setq applic (vlax-get-acad-object)) (setq a (vla-eval applic (strcat "MsgBox \"Do you want to Change Length\"" ", " "vbYesNo" ", " "\"VBA Expresso\""))) Quote
alanjt Posted May 16, 2010 Posted May 16, 2010 Works fine in '08. What version are you running? There's always acet-ui-message or rolling your own DCL one. Quote
muthu123 Posted May 16, 2010 Author Posted May 16, 2010 Works fine in '08. What version are you running? There's always acet-ui-message or rolling your own DCL one. Dear ajant, I am using '2007 and it works nicely to show that message box.But the return value will be nil if we press either yes or no button. What is the value you are getting in '08. Let me know. Can you explain that "acet-ui-message" ? What is it? Quote
VVA Posted May 16, 2010 Posted May 16, 2010 Try another version (defun vva-MsgBox (Message Title Flags Timeout / WScript ret) ;;; Message - is the message to display ;;; Title - is the title of the Message Box ;;; Flags - is the bitwise number indicating the MessageBox Options ;;; Timeout - is a number (in seconds) to wait before automatically closing (0 = wait forever) ;;;Return values ;;;-1 Timed Out ;;;0 Error ;;;1 OK ;;;2 Cancel ;;;3 Abort ;;;4 Retry ;;;5 Ignore ;;;6 Yes ;;;7 No ;;;10 TryAgain ;;;11 Continue ;;;================ Flags ====================================== ;;;Flags is a bitwise number indicating the various options. ;;; ;;;Options supported: ;;; ;;;Buttons values ;;;0 OK Only ;;;1 OK Cancel ;;;2 Abort Retry Ignore ;;;3 Yes No Cancel ;;;4 Yes No ;;;5 Retry Cancel ;;;6 Cancel TryAgain Continue ;;; ;;;Icon values ;;;0 No Icon ;;;16 Stop ;;;32 Question ;;;48 Exclamation ;;;64 Information ;;; ;;; ;;;Set Default Button (which button has focus and will return if user presses {enter} or {spc}) ;;;0 First ;;;256 Second (defaults to first if no second button) ;;;512 Third (defaults to first if no third button) ;;; ;;;Message Box Modal Status ;;;0 Application ;;;4096 System (causes message box to remain topmost) ;;; ;;;Message Box Option Flags ;;;65536 Set MessageBox to Foreground ;;;131072 Show on Default Desktop only ;;;262144 Set MessageBox to TopMost ;;;524288 Right Align Text ;;;1048576 Right to Left Reading (think Chinese and Arabic) (setq WScript (vlax-create-object "WScript.Shell")) (setq ret (vlax-invoke WScript 'Popup Message Timeout Title Flags)) (vlax-release-object WScript) ret ) (defun vva-yes-no ( msg title ) ;;; Message - is the message to display ;;; Title - is the title of the Message Box ;;; Return - t - Yes; nil - No ;;; Use: (vva-yes-no "Are you sure?" "Question" ) (= (vva-MsgBox msg title (+ 4 ;;; Yes No button values 32 ;;; Question Icon 256 ;;; No buttom defaults ) 0 ) 6 ) ) Quote
muthu123 Posted May 16, 2010 Author Posted May 16, 2010 Try another version (defun vva-MsgBox (Message Title Flags Timeout / WScript ret) ;;; Message - is the message to display ;;; Title - is the title of the Message Box ;;; Flags - is the bitwise number indicating the MessageBox Options ;;; Timeout - is a number (in seconds) to wait before automatically closing (0 = wait forever) ;;;Return values ;;;-1 Timed Out ;;;0 Error ;;;1 OK ;;;2 Cancel ;;;3 Abort ;;;4 Retry ;;;5 Ignore ;;;6 Yes ;;;7 No ;;;10 TryAgain ;;;11 Continue ;;;================ Flags ====================================== ;;;Flags is a bitwise number indicating the various options. ;;; ;;;Options supported: ;;; ;;;Buttons values ;;;0 OK Only ;;;1 OK Cancel ;;;2 Abort Retry Ignore ;;;3 Yes No Cancel ;;;4 Yes No ;;;5 Retry Cancel ;;;6 Cancel TryAgain Continue ;;; ;;;Icon values ;;;0 No Icon ;;;16 Stop ;;;32 Question ;;;48 Exclamation ;;;64 Information ;;; ;;; ;;;Set Default Button (which button has focus and will return if user presses {enter} or {spc}) ;;;0 First ;;;256 Second (defaults to first if no second button) ;;;512 Third (defaults to first if no third button) ;;; ;;;Message Box Modal Status ;;;0 Application ;;;4096 System (causes message box to remain topmost) ;;; ;;;Message Box Option Flags ;;;65536 Set MessageBox to Foreground ;;;131072 Show on Default Desktop only ;;;262144 Set MessageBox to TopMost ;;;524288 Right Align Text ;;;1048576 Right to Left Reading (think Chinese and Arabic) (setq WScript (vlax-create-object "WScript.Shell")) (setq ret (vlax-invoke WScript 'Popup Message Timeout Title Flags)) (vlax-release-object WScript) ret ) (defun vva-yes-no ( msg title ) ;;; Message - is the message to display ;;; Title - is the title of the Message Box ;;; Return - t - Yes; nil - No ;;; Use: (vva-yes-no "Are you sure?" "Question" ) (= (vva-MsgBox msg title (+ 4 ;;; Yes No button values 32 ;;; Question Icon 256 ;;; No buttom defaults ) 0 ) 6 ) ) Thank you so much and you are great.. Bu t i want to know that what is the technology you used here? Wat is wscript and wscript.shell? Actually what it is doing? How we can use this more effective in out VLisp? Yours, R.Muthu. Quote
VVA Posted May 16, 2010 Posted May 16, 2010 Bu t i want to know that what is the technology you used here? ActiveX Wat is wscript and wscript.shell? Windows Script Host WshShell Object Actually what it is doing? Create wscript.shell object (setq WScript (vlax-create-object "WScript.Shell")) And use it Popup Methods (setq ret (vlax-invoke WScript 'Popup Message Timeout Title Flags)) How we can use this more effective in out VLisp? (setq WScript (vlax-create-object "WScript.Shell"))vlax - Visual Lisp ActiveX functions Quote
Recommended Posts
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.