This example explains how to create a basic dialog box and display it using AutoLISP.
This DCL defines a dialog box labeled Sample Dialog Box that contains a text tile and a single OK button. The DCL resides in a file named hello.dcl.

Highlight the DCL code and press Ctrl+C, or right-click and click Copy.
hello : dialog
{
label = "Sample Dialog Box";
: text {
label = "Hello, world.";
}
ok_only;
}
New File.
Save As. In the Save-as dialog box, Save As Type drop-down list, select DCL Source Files. In the File Name field, enter hello.dcl. Browse to a location to store the DCL file and click Save. (defun C:HELLO ( / dcl_id )
(setq dcl_id (load_dialog "hello.dcl")) ; Load the DCL file.
(if (not (new_dialog "hello" dcl_id)) ; Initialize the dialog.
(exit) ; Exit if this does not work.
)
(start_dialog) ; Display the dialog box.
(unload_dialog dcl_id) ; Unload the DCL file.
(princ)
)
New File.
Save As. In the Save-as dialog box, Save As Type drop-down list, select Lisp Source Files. In the File Name field, enter hello.lsp. Browse to a location to store the LSP file and click Save.
Load Text in Editor. The following explains line by line what the AutoLISP program does:
With other dialog boxes, you would also set up tile values, lists, and images. This DCL example above uses a predefined tile named ok_only, so you do not have to initialize the tile unless you want to override its default values. The ok_only tile also has an action named done_dialog assigned to it. If the user presses the OK button, AutoCAD passes the done_dialog call to your AutoLISP application and ends the dialog.
For the sake of simplicity, no error processing is included in this example.
Note that the start_dialog call remains active until the user selects a tile (usually a button) whose associated action expression calls done_dialog. The done_dialog call can be issued explicitly by the tile. The done_dialog call is also issued by the selected tile if its is_cancel attribute is set to true.