Loading and Running Compiled Programs

AutoCAD AutoLISP & Visual LISP

 
Loading and Running Compiled Programs
 
 
 

Compiled AutoLISP programs can be loaded and run from either the VLISP Console window or the AutoCAD Command prompt, or by choosing Tools Load Application from the AutoCAD menu. This is true of both .fas files and .vlx files, which may contain multiple compiled programs. (See Making Application Modules for information on creating .vlx files.)

To run a compiled program from the Visual LISP Console window

  1. Load the program by invoking the load function from the Console prompt. For example, to load the compiled yinyang program created in Walking through a Compile Example, enter the following command:
     (load "c:/program files/<AutoCAD installation
    directory> /sample/visuallisp/yinyang.fas")

    If you specify a file name without a path or extension, LOAD looks in the current directory for a matching file name with a .vlx, .fas, or .lsp extension. If LOAD does not find a match, it continues to search the rest of the AutoCAD search path for a matching file name. The search stops in the first directory that contains a matching file name with any of the valid extensions. In that directory, if there are multiple matching files with valid extensions, the file with the most recent timestamp is loaded. If there are multiple files with the same timestamp, the preference order is VLX, FAS, LSP.

    If you specify a path to LOAD but omit the file type, the function looks for VLX, FAS, or LSP files with a matching name in the specified directory, and loads the one with the most recent timestamp.

    If you prefer less typing and more clicking, choose File Load File from the VLISP menu, and use the Load Lisp File dialog box to select the file you want to load. Remember to use the Files of Type pull-down list in this dialog box to specify the type of file you want to load, otherwise VLISP lists only .lsp files in the dialog box. You can select from the following types:

    • Lisp Source Files (.lsp files)
    • Compiled AutoLISP Files (.fas files)
    • VL Packed Application (.vlx files)
    • All files (lists all files in the specified directory)

    Choose Open to load the selected files.

  2. At the VLISP Console prompt, enter the name of the function you want to run, enclosing the name in parentheses. For example:
     (yinyang)

    VLISP transfers control to AutoCAD to display program prompts and accept user input.

Once you load a program, you can run it from either the AutoCAD Command prompt or the VLISP Console window prompt. Note that if the name of the function you are running begins with c:, you can invoke it from the AutoCAD Command prompt as if it were an AutoCAD command, that is, without enclosing the name in parentheses. See for more information on this feature.

Refer to the AutoLISP Reference for more information on the load function.