Jump to content

Lisp to Save dwg file to specific folder with date


gmmdinesh

Recommended Posts

Hi Everyone

I have a folder on (E:\Orders 22-Aug-2017) this path.This folder will be created daily for respective date by Excel.

Need lisp to automatically find the folder with today date on that path and saved it automatically.

Anyone help me to this.

Thanks in advance.

Link to comment
Share on other sites

(defun c:SaveToDateFolder ( / doc fld fnm)
 (setq doc (vla-get-activedocument (vlax-get-acad-object)))
 (setq fld
   (strcat
     "E:\\Orders "
     ;; Change DD to D for 'E:\Orders 1-Aug-2017' instead of 'E:\Orders 01-Aug-2017'.
     (menucmd (strcat "M=$(edtime,$(getvar,date),DD-MON-YYYY)"))
     "\\"
   )
 )
 (cond
   ((not (findfile fld))
     (prompt (strcat "\nError: Date folder '" fld "' not found "))
   )
   (
     (and
       (= 1 (getvar 'dwgtitled))
       (= (strcase fld) (strcase (getvar 'dwgprefix)))
     )
     (vla-save doc)
   )
   ((setq fnm (getfiled "Save as" fld "dwg" 1))
     (vla-saveas doc fnm)
   )
 )
 (princ)
)

Edited by Roy_043
Link to comment
Share on other sites

Hi Roy

Thanks for your code. I have checked your code. Unfortunately i got error while running the lisp as shown below.

 

Error: Date folder 'E:\22-Aug-2017\ ' not found

 

But i have created the Orders 22-Aug-2017 folder in E drive before run the lisp.

 

Please give me the suggestion to solve the Error.

 

Thanks in Advance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...