PDA

View Full Version : script file


parkerfeldman
2009-04-13, 03:35 PM
hi i wrote a code most that is not launching properly. it writes to a script file then launches the script file. the code worked last time i used it and today it is acting funny. at the start of the code it prompts for a file to "Extract Field Members From" then writes that to the script. then launches the script after writing the script the issue is that the filename for the "Extract Field Members From" is being inserted after the (command "script") expression so no script is launching my command window looks like this...

Field Member Schedule
script
Enter script file name <S:\Projects\27122 Epstein Building A\APT
Drawings\APT_Level-D-IntPanels.scr>: S:\\Templates\\Express-APT\\fmschedule.scr

where the second file is the script that should be launching. a lot of this code goes to other codes but all that works it is only the launching of the script file that is not working.


(if (= 1 localpoppick)
(progn
(setq filepat
(getfiled "Extract Field Members From" "" "DWG" 8)
)
(setq fmfile (strcat (chr 34) filepat (chr 34)))
(setq scrfile
(open "S:\\Templates\\Express-APT\\fmschedule.scr"
"w"
)
)
(princ "open\n" scrfile)
(princ (strcat fmfile "\n") scrfile)
(princ "(load \"OUT\")\n" scrfile)
(princ "(writeschedule (getfms))\n" scrfile)
(princ "_.qsave\n" scrfile)
(princ "_.close\n" scrfile)
;(close scrfile)
(setq scrfile (close scrfile))
(command "script" "S:\\Templates\\Express-APT\\fmschedule.scr")
(setq csvlst (CSVFiletoList))
(setq k (- 1))
(repeat (length csvlst)
(setq clist (nth (setq k (1+ k)) csvlst))
(princ k)
(terpri)
(setq title (car (nth k tabletitles)))
(ListtoTable clist title "B.O.M.")
) ;_end repeat
) ;_end progn
) ;_end if pick - 1

David Bethel
2009-04-14, 01:19 PM
Once you turn control over to the SCRIPT command, Autolisp stops evaluating the expressions. So in short (command "_.SCRIPT"...) must be the last expression in the routine. -David