Search code examples
lispcadautolisp

AutoLisp - Prompt User Save As Text File


I'm trying to write some code to prompt the user on where to save a document. I've run across getfiled, which prompts for the user to open an exsisting file, but I'm not finding a command that will show a window as seen below.

DraftSight Save External File


Solution

  • Well, the answer is a bit more obvious than anticipated. The last argument that can be passed into getfiled will change the File Explorer from "Open" to "Save As."

    ;; Opens exsisting file
    (getfiled "Title" "test.txt" "" 0)
    
    ;; Saves file
    (getfiled "Title" "test.txt" "" 1)
    

    Reference 1: help.solidworks.com

    Reference 2: help.autodesk.com

    Reference 3: docs.autodesk.com