0 Members and 1 Guest are viewing this topic.
;;; this function will prompt the user with a dialog box;;; to select an existing file to open;;;;;; returns the open file handle or nil;;;;;; usage;;; (setq fo (open_file))(defun open_file (/ file_select open_file) (if (setq file_select (getfiled "Select File to Read" "" "txt" 8)) (setq open_file (open file_select "r")) ) )
;;; this function will prompt the user with a dialog box;;; to enter the name of a new file to write to.;;;;;; returns the open file handle or nil;;;;;; usage;;; (setq fw (file_write))(defun file_write (/ file_select file_open) (if (setq file_select (getfiled "Select File to Write" "" "txt" 1)) (setq file_open (open file_select "w")) ) )
"At the same time" is not possible as the MS OS can only number crunch in 1 dimension.
;;; this function will prompt the user with a dialog box;;; to select an existing file to open;;;;;; returns the open file handle or nil;;;;;; usage;;; (setq fo (open_file))(defun open_file (/ file_select open_file) (if (setq file_select (getfiled "Select File to Read" "" "txt" 8)) (setq open_file (open file_select "r")) ) );;; this function will prompt the user with a dialog box;;; to enter the name of a new file to write to.;;;;;; returns the open file handle or nil;;;;;; usage;;; (setq fw (file_write))(defun file_write (/ file_select file_open) (if (setq file_select (getfiled "Select File to Write" "" "txt" 1)) (setq file_open (open file_select "w")) ) );;; main function;;; read the contents from one file and write them to another(defun c:r-w_file (/ read_file write_file each_line) (if (setq read_file (open_file)) (if (setq write_file (file_write)) (while (setq each_line (read-line read_file)) (prompt (strcat "\nWriting Line ->" each_line " to file")) (write-line each_line write_file) ); while ); if ); if (mapcar 'close (list read_file write_file)) (princ) )