CADMonkey92 Posted November 7, 2017 Share Posted November 7, 2017 I have a routine that is used to batch run a scr on a directory of dwgs, via a toolbar button/macro. After clicking the button the user selects the first file in the target directory, clicks "OPEN", the dialog box re-opens and then the user clicks "CANCEL". At this point the specified script named in the macro is run on all of the dwgs in the directory not including the sub folders. The problem I'm having is that the lsp was functional with 2012 and 2014 but will not open and process any dwgs with 2018. Any help would be greatly appreciated. Macro text ^C^C(LOAD"GSCRIPT") GSCRIPT MS-BUTTON N '_SCRIPT "C:/XXXXXX/XXXXX/AppData/Roaming/Autodesk/AutoCAD 2018/R22.0/enu/Support/MS-BUTTON.scr" ;script file generator for multiple automated editing of drawings ;by Clint Moore ;; ;; ;;Revision:2.0 ;; (defun c:gscript() (setq templ (getstring "\nName of Template script file :")) (initget 1 "Yes No") (setq ans (getkword "\nSave Changes made to drawings Yes/No: ")) (if (= ans "Yes") (setq ans "No") (setq ans "Yes") ) (setq str nil) (if (setq addscr (findfile (strcat templ ".scr"))) (progn (setq dwglist nil) (while (setq dwg (getfiled "Select a Drawing File" "" "dwg" 0)) (progn (setq cnt (strlen dwg) str nil ) (while (and (> cnt 0) (/= str "\\")) (setq str (substr dwg cnt 1)) (setq cnt (1- cnt)) ) (if (= str "\\") (setq su 2) (setq su 1) ) (setq s3 (substr dwg (+ su cnt))) (setq dpth (substr dwg 1 (- (strlen dwg) (strlen s3)))) (setq s3 (substr s3 1 (- (strlen s3) 4))) (setq dwglist (append dwglist (list (list s3 dpth)))) (command "shell" (strcat "dir /b " dpth "*.dwg >" s3 ".lst" "")) ) ) (setq wlst "dwgprp.lst" wname "begin.scr" fnwl (open wlst "r") fnw (open wname "w") ) (foreach dwgnm dwglist (setq rname (strcat (nth 0 dwgnm) ".lst")) (setq fnr (open rname "r")) (while (setq dwg (read-line fnr)) (write-line "Open" fnw) (write-line (strcat (nth 1 dwgnm) dwg) fnw) (setq tscr (open addscr "r")) (while (setq outline (read-line tscr)) (write-line outline fnw) ) (close tscr) ) (close fnr) ) (if (= ans "Yes") (write-line "exit " fnw) (write-line "QSAVE" fnw) ) (close fnw) ) (prompt "Template script file not found") ) ; (command "script" "begin") ) Quote Link to comment Share on other sites More sharing options...
BIGAL Posted November 8, 2017 Share Posted November 8, 2017 It may be the "trusted paths" is not set for the deep deep path for the SCR 2nd why not have a directory like c:\Myprogs which has all your lisps and scripts etc. so much easier to find. Quote Link to comment Share on other sites More sharing options...
CADMonkey92 Posted November 8, 2017 Author Share Posted November 8, 2017 It may be the "trusted paths" is not set for the deep deep path for the SCR 2nd why not have a directory like c:\Myprogs which has all your lisps and scripts etc. so much easier to find. GSCRIPT and MS-BUTTON.SCR reside in the same place.I have always used the support folder to house all of my SCRs and LSPs in the past, but I can try moving the template script file. The macro code used to look like the line below, but for some reason it doesn't work. ^C^C(LOAD"GSCRIPT") GSCRIPT MS-BUTTON N SCRIPT BEGIN Which returns this. Command: (LOAD"GSCRIPT") C:GSCRIPT Command: GSCRIPT Name of Template script file :MS-BUTTON Save Changes made to drawings Yes/No: N shell OS Command: dir /b X:\Working\Drawings\11-6-2017\*.dwg >A-M-EP-0021-SH-1.lst Command: nil Command: SCRIPT Enter script file name : BEGIN To be honest I don't fully understand how this lisp functions and the original author isn't around anymore for me to seek his help. Quote Link to comment Share on other sites More sharing options...
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.