Message 1 of 2
How to display or read the text file just created by a script in same lisp

Not applicable
01-21-2016
07:38 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Good Morning, Glad to meet you all.
I am a newbie here, this is my first post.
please consider my knowledge in writing lisp routines are at basic level. Please help me in this issue.
1) prepare list of all drawings in the selected drawing folder.
2)creates a script file to open, run another "process.lsp", close for each drawing of list.
3) run script
4) while running, the script file throws up "errorlog.txt" in the same folder of drawings.
NOW WE NEED TO SEE THAT "ERRORLOG.TXT".... RIGHT NOW.
(defun c:sample () (if (and (setq scrfile "D:\\lisp\\SCRIPT.scr") ; path of script file (setq dwgloc (getfiled "\nSelect Any One DRAWING from Required Folder: " "" "dwg" 8)) ;full path of drawing ) ; End and (progn (setq afile (open scrfile "w")) ;to create a text (script) file (foreach x (vl-directory-files (setq dir (vl-filename-directory dwgloc)) "*.dwg" 1) ;for each drawing file in same directory (write-line (strcat "open " "\"" dir "\\" x " " "\" (load \"d:/lisp/process.lsp\") zoom extents (c:process) qsave close") afile) ; script line to open drawing, load process.lsp, run, save, and close drawing. ) ; End foreach (close afile) ) ; End progn (princ "\n<!> File Selection Error <!>") ) ; End if (command "script" scrfile) ; run the script file ;===============================================================; ; until here everything is working fine. ; ; Here in the back ground this script file creates ; ; an ERRORLOG.TXT in the same folder of drawings dwgloc ; ;===============================================================; (setq lg (strlen dwgloc) lg1 (- lg 10) dwgpath (substr dwgloc 1 lg1)) ;strips off drawing name (10 characters), retains only path in the string dwgloc (setq fn (strcat dwgpath "Errorlog.txt")) ;this is the location of error.log.txt which was created by running script file (if (setq ff (findfile fn)) (startapp "notepad" fn)) ;ff returning nil, i dont know why??? )