AutoLISP is an interpretive language, so it can be stored in a text file, loaded, and then executed directly within AutoCAD.
AutoLISP files typically have an .lsp file extension, but they can also have the .mnl file extension. Both LSP and MNL files can be edited with a text editor, such as Notepad on Windows and TextEdit on Mac OS.
MNL files are associated with user interface customization and they are automatically loaded into AutoCAD when a customization (CUI/CUIx) file of the same name is loaded. For example, the acad.mnl is automatically loaded into AutoCAD when the acad.cuix file is loaded.
Here is how to create a file with the .lsp extension and add the C:HELLO function defined in the Creating a New Command and Working with System Variables tutorial.
All Apps
Windows Accessories
Notepad.
Save As.
Folder. Enter the name
LSP Files for the name of the new folder and press Enter. Double-click the new folder
LSP Files to make sure it is the current folder.
(defun c:hello ( / msg) (setq msg (getstring T "\nEnter a message: ")) (alert msg) ) (prompt "\nAutoLISP Tutorial file loaded.") (princ) ; Suppress the return value of the prompt function
Save.
Applications.
Preferences.
Save As.
(defun c:hello ( / msg) (setq msg (getstring T "\nEnter a message: ")) (alert msg) ) (prompt "\nAutoLISP Tutorial file loaded.") (princ) ; Suppress the return value of the prompt function
Save.
Here is how to load the Create-LSP-Tutorial.lsp file created under the Creating an AutoLISP (LSP) File section.
Applications panel
Load Application.
Load Application.
LSP Files folder or the folder in which you stored the
Create-LSP-Tutorial.lsp file.
AutoLISP Tutorial file loaded.
A message box displays the text string that you entered.
Here is how to open the Create-LSP-Tutorial.lsp file that you created under the Creating an AutoLISP (LSP) File section.
Do one of the following:
Open. From the Save As Type drop-down list, select All Files (*.*). Browse to and select the
Create-LSP-Tutorial.lsp file, and click Open.
All Apps
Windows Accessories
Notepad. Click File menu
Open. From the Save As Type drop-down list, select All Files (*.*). Browse to and select the
Create-LSP-Tutorial.lsp file, and click Open.
Applications. In the Applications window, double-click TextEdit. In TextEdit, on the Mac OS menu bar, click File menu
Open. Browse to and select the
Create-LSP-Tutorial.lsp file, and click Open.