gsc Posted December 7, 2022 Posted December 7, 2022 Hi, In my LISP routine 4 (large) lists needs to be written to 4 CSV files. Is it possible to run 4 write actions at the same time? If this is not possible how do I run them after each other, where one write action is finished before the next starts? Quote
Steven P Posted December 7, 2022 Posted December 7, 2022 (edited) Try it and see - best way to learn what works! Remembering to call each a unique name and reference within the LISP By way of example, from Lee Mac - commenting out some of the nice stuff he puts in (defun c:writetextfile ( / des txt ) ;; Define function, declare local variables ;; (if (setq txt (getfiled "Create Text File" "" "txt" 1)) ;; Prompt user for filename/filepath ;; (progn (setq txt1 (getfiled "Create Text File" "" "txt" 1)) (setq txt2 (getfiled "Create Text File" "" "txt" 1)) (setq txt3 (getfiled "Create Text File" "" "txt" 1)) ;; (if (setq des (open txt "w")) ;; Attempt to create text file with given filename/filepath (progn ;; Evaluate the enclose expressions as the 'then' expression for the IF statement (setq des1 (open txt1 "w")) ;; Attempt to create text file with given filename/filepath (setq des2 (open txt2 "w")) ;; Attempt to create text file with given filename/filepath (setq des3 (open txt3 "w")) ;; Attempt to create text file with given filename/filepath (write-line "This is a test 1." des1) ;; Write line of text to text file (write-line "This is a test 2." des2) ;; Write line of text to text file (write-line "This is a test 3." des3) ;; Write line of text to text file (close des3) ;; Close file descriptor (close des2) ;; Close file descriptor (close des1) ;; Close file descriptor ) ;; end PROGN ;; (princ "\nUnable to create text file.") ;; Else the text file could not be created ;; ) ;; end IF ;; (princ "\n*Cancel*") ;; Else the user pressed Cancel ;; ) ;; end PROGM ;; ) ;; end IF (princ) ;; Suppress the return of the last evaluated expression ) ;; end DEFUN Edited December 7, 2022 by Steven P 1 Quote
gsc Posted December 7, 2022 Author Posted December 7, 2022 I have used unique variables like you proposed, testing right now 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.