CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]
CZ | EN | DE
Login or
registration
  Visitors: 8823

CAD tip CAD tip # 14006:

   
Question CAD 
 %  platform  category 
Q - question

Universal MsgBox in AutoLISP.

A - answer Using hybrid scripting, you can prepare a universal MsgBox function for AutoLISP, with optional buttons, icons and auto-dismiss feature (after N seconds). This function will work in both full AutoCAD and in AutoCAD LT (2024+).

;Universal MessageBox - see www.cadforum.cz ;(msgbox "Message" "Title" Mode[0..5 + icon 16/23/48/64] AutoDismiss[secs or 0]) (defun MsgBox (message title options time / WshShell) (if (not title)(setq title "AutoCAD")) (if (not options)(setq options 0)) ; plain msgbox, OK (if (not time)(setq time 0)) ; no auto-dismiss (if (setq WshShell (vlax-create-object "WScript.Shell")) ; full ACAD: (vlax-invoke WshShell 'Run (strcat "mshta.exe vbscript:close(CreateObject(\"WScript.Shell\").Popup(\"" message "\"," (itoa time) ",\"" title "\"," (itoa options) "))") ) ; else LT: (startapp (strcat "mshta.exe vbscript:close(CreateObject(\"WScript.Shell\").Popup(\"" message "\"," (itoa time) ",\"" title "\"," (itoa options) "))")) ) (if WshShell (vlax-release-object WshShell)) )

Then use e.g.:

(MsgBox "Hello world! Are you ready?" nil 33 4)

ACADACLT2024
100% *  CAD 
26.1.2024    24605×  
Prices - CAD eShop:
applies to: AutoCAD · AutoCAD LT 2024 ·

See also:
Tip 14063:How to get week day and week number from a given date.
Tip 14027:3D heart from the heart.
Tip 13960:Fermat's spiral in AutoCAD.
Tip 13847:Pringles in AutoCAD - a hyperbolic paraboloid.
Tip 13822:Fast layer visibility toggle ON/OFF.


Back   All CAD Tips



Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   



Featuring:
Save your floating licenses (NLS) consumed by inactive users - free unused licenses with
LogOff 2006 More info


Please use these tips at your own risk.
Arkance Systems is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist