LosGirk Posted March 12, 2018 Posted March 12, 2018 I'm looking for a way to automate this process using AutoLISP: Copy an existing PDF file from a network location to a different specified directory,save it under a new name, and then open it. Any help with this is appreciated, and I thank you folks in advance for your time and knowledge. Quote
Lee Mac Posted March 12, 2018 Posted March 12, 2018 I would suggest using the vl-file-copy function, followed perhaps by my Open function. Quote
LosGirk Posted March 12, 2018 Author Posted March 12, 2018 Thanks Lee, I this works for me- (defun c:test1 (/ ) (vl-file-copy "c:/pdf/something.pdf" "c:/workarea/somethingelse.pdf") (vl-cmdf "start" "c:\\workarea\\somethingelse.pdf") (princ))(princ) -as long as there is no spacing in the directory or file names. You gave me this a while back to fix the spacing problem when opening a file, do you have something similar that allows spacing when using vl-file-copy? (defun c:test2 (/ ) (lm:open "C:\\2018 Standards\\2018 PDF\\name with spaces.pdf") (princ))(princ) (defun lm:open ( target / rtn shl ) (vl-load-com) (if (and (or (= 'int (type target)) (setq target (findfile target))) (setq shl (vla-getinterfaceobject (vlax-get-acad-object) "shell.application"))) (progn (setq rtn (vl-catch-all-apply 'vlax-invoke (list shl 'open target))) (vlax-release-object shl) (if (vl-catch-all-error-p rtn) (prompt (vl-catch-all-error-message rtn)) t)))(princ))(princ) Quote
LosGirk Posted March 13, 2018 Author Posted March 13, 2018 (vl-file-copy (findfile "something.pdf") "c:\\directory with spaces\\somethingelse.pdf") (princ))(princ) Quote
Recommended Posts
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.