CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products []
CZ | EN | DE
Login or
  Visitors: 9326

CAD tip CAD tip # 14007:

Question CAD 
 %  platform  category 
Q - question

Workaround for the missing (vlax-create-object) in AutoCAD LT (voice, clipboard, etc.)

A - answer One of the limitations of the AutoLISP support in AutoCAD LT (2024 and higher) is the missing function which allows creating external objects - (vlax-create-object) (does not work and always returns nil in LT).

For some add-on applications you can circumvent this limitation by invoking the object creation function through the Windows interpreter for Microsoft HTML Applications - MSHTA.

This is e.g. a LISP code which invokes voice output from AutoCAD LT:

(setq sptext "Hello world")
(startapp (strcat "mshta.exe vbscript:close(CreateObject(\"Sapi.SpVoice\").Speak(\"" sptext "\",0))"))

Or better yet - this code copies the given, e.g. generated/computed text to Windows Clipboard in AutoCAD LT:

(setq cltext "Hello world!")
(startapp (strcat "mshta.exe vbscript:close(CreateObject(\"WScript.Shell\").Exec(\"clip\").stdIn.WriteLine(\"" cltext "\"))"))

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

See also:
Tip 14006:Universal MsgBox in AutoLISP.
Tip 13977:How to publish a PDF to the same folder as a DWG drawing in AutoCAD?
Tip 13960:Fermat's spiral in AutoCAD.
Tip 13784:Export block coordinates to a table. How to use the DATAEXTRACTION command in AutoCAD LT?
Tip 13683:Limitations of the LISP language (AutoLISP, VisualLISP) in AutoCAD LT - what to watch out for

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   

Increase your productivity with our set of add-on functions for AutoCAD Civil 3D
CADstudio Civil Tools 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.