Jump to content

Recommended Posts

Posted

Hi,

Ive got a good .dcl and .lsp routine that i use but it was discovered that a bit flag (variable) can only hold 256 lines of data. when i select more that 256 files it only does 256 no more. i was thinking instead of making the bit flag (variable) i could just make it write to a file instead, kind of taking raw data to text file instead of memory.

 

hears the pertinent .lsp code

 

(defun FileSelect (Dir Pat) 
(setq DH (load_dialog "dialogbox")) 
  (if (and DH (new_dialog "FILES" DH)) 
    (progn 
      (setq iExt 0) 
      (Refresh_Display) 
      (start_list "EXT") 
      (mapcar 'add_list Pat) 
      (end_list) 
      ; 
      (action_tile "DIR" "(new_dir $value)") 
      (action_tile "EXT" "(new_mask $value)") 
      (action_tile "FIL" "(picked $value)") 
      ; 
      (if (= (start_dialog) 0) 
	(setq File_List nil) 
      ) 
      (unload_dialog DH) 
    ) 
  ) 
  File_List ;<---here is where i thought i could change to write-line tofile
) 
;------------------------------------------------
(defun Refresh_Display () 
  (start_list "FIL") 
  (end_list) 
  (set_tile "CDIR" "Working...") 
  (setq FL (VL-Directory-Files
             ;Dir Pat 1)
             Dir (nth iExt Pat) 1) 
	DR (VL-Directory-Files 
	     Dir nil -1) 
	FL (VL-Sort FL 'str_compare) 
	DR (VL-Sort DR 'str_compare) 
	) 
  (start_list "DIR") 
  (mapcar 'add_list DR) 
  (end_list) 
  (start_list "FIL") 
  (if Show_the_details 
    (mapcar 
      '(lambda (F) 
	 (setq Dt (VL-File-SysTime 
		    (strcat Dir F)) 
	       F1 (if Dt 
		    (strcat 
		      F 
		      "\t" 
		      (itoa_f (nth 1 Dt) 2) 
		      "/" 
		      (itoa_f (nth 3 Dt) 2) 
		      "/" 
		      (itoa_f (nth 0 Dt) 4) 
		      "\t" 
		      (itoa_f (nth 4 Dt) 2) 
		      ":" 
		      (itoa_f (nth 5 Dt) 2) 
		      ":" 
		      (itoa_f (nth 6 Dt) 2) 
		      ) 
		    (strcat F "\t\t") 
		  ) 
	       Sz (VL-File-Size	(strcat Dir F)) 
	       F1 (strcat 
		    F1 
		    "\t" 
		    (rtos Sz 2 0)) 
	       ) 
	     (add_list F1)) 
	  FL) 
    (mapcar 'add_list FL) 
  ) 
  (end_list) 
  (set_tile "DIRS" 
	    (strcat 
	      "Directories = " 
	      (itoa (length DR)))) 
  (set_tile "FILS" 
	    (strcat 
	      "Files = " 
	      (itoa (length FL)))) 
  (set_tile "CDIR" Dir) 
  )

(defun New_Dir (Pth) 
  (setq Pth (nth (atoi Pth) DR)) 
  (cond 
    ((= Pth ".") 
     nil 
     ) 
    ((= Pth "..") ;;back up a directory 
     ;;remove directory name up one 
     (setq L (1- (strlen Dir)) 
	   Dir (substr Dir 1 L) 
	   ) 
     (while (/= (substr Dir L 1) "/") 
       (setq L (1- L))) 
     (setq Dir (substr Dir 1 L)) 
    ) 
    ('T 
     (setq Dir (strcat Dir Pth "/")) 
     ) 
  ) 
  (Refresh_Display) 
) 
;------------------------------------------------ 
;; Call back function to handle new file mask 
;; selection by the user. 
;; 
(defun New_Mask (II) 
  (setq iExt (atoi II)) 
  (Refresh_Display) 
) 
; 
;------------------------------------------------ 
;; Call back function for saving the selected 
;; file list in the variable FILE_LIST. 
;; 
(defun Picked (val / V)   ;<--it turns out i need to write tofile here
  (setq val (read (strcat "(" Val ")")) ;<----any thoughts?
	File_List          ;<---ive tried alot and am thinking i need a foreach statement 
	 (mapcar '(lambda (V) ;<---other wise ill have to switch to a macro but am limited in that 
		    (strcat 
		      Dir 
		      (nth V FL))) 
		 Val) 
	) 
) 

any thoughts would be great! cheers

Posted (edited)

Unfortunately, I believe this is a restriction of the DCL list box implementation, rather than of the data type of the variable used to store the selected items. Given this restriction, you may wish to consider using a paged list box, which divides the data set into groups which are each smaller than this inherent limit.

Edited by Lee Mac
Posted

Nice Lee.

 

256+ files is massive, why not use some form of reducing the list, the obvious is A-Z 1st character. Or enter a pattern BIG*, Lee*.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...