I sent you a message, but I cleaned up the lisp instead. Basically I can navigate to the directory, fill up list_box "subdirs" and select multiple entities. I need to build a list off of my selection of the files in "subdirs" and then populate "dwgs" with the selected items. That's where I run into this roadblock, among others, but i'm taking this one problem at a time. It may still be jumbled up, but here is the .lsp and dcl. Any information would be helpful.
;;; DCL key information
;;;
;;; key = udir (edit box)
;;; key = browse (browse button)
;;; key = subdirs (list box left)
;;; key = dwgs (list box right)
;;; key = afiles (add files button)
;;; key = rfiles (remove files button)
;;; key = script (popup list)
;;; key = run (run button)
;;; key = cancel (cancel button)
;;;
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
;;; ;;;
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
(defun c:batchtest ()
(vl-load-com)
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
(setq dcl_id (load_dialog "batchtest.dcl")) ; Load the DCL File
(if (not (new_dialog "batchtest" dcl_id)) ; Load the dialogue box
(exit) ; If not loaded exit
);end if
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
(setq dfiles nil)
(setq sname '("script1" "script2" "script3" "script4" "script5"))
; end setq sname - list of script files the User can choose from
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
(setq userfilepath nil)
(setq userfilepath (getvar "dwgprefix"))
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
(set_tile "udir" userfilepath)
(mode_tile "udir" 1)
(setq dfiles nil)
(setq dfiles (vl-sort (vl-directory-files userfilepath "*.dwg")'<))
(start_list "subdirs")
(mapcar 'add_list dfiles)
(end_list)
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
(defun getdwgs ()
(setq userfilepath (dwgdirr "Select Folder Location:" "" 512))
(set_tile "udir" userfilepath)
(setq dfiles (vl-sort (vl-directory-files userfilepath "*.dwg")'<))
(start_list "subdirs")
(mapcar 'add_list dfiles)
(end_list)
)
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
;(defun addfiles ()
;;;;
😉
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
(start_list "script")
(mapcar 'add_list sname)
(end_list)
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
(action_tile "accept"
(strcat
"(progn
(setq scr (get_tile \"script\"))"
"(done_dialog)(setq userclick T))"
);strcat
); action_tile
(action_tile "browse" "(setq userfilepath (getdwgs))")
(princ userselection)
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
(start_dialog)
(unload_dialog dcl_id)
(if userclick
(progn
(setq scr (fix scr))
(setq scr (nth scr sname))
);progn
); end if userclick
(princ)
); defun
(princ)
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
;;; ;;; from Lee mac
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
(defun dwgdirr ( msg dir bit / err fld pth shl slf )
(setq err
(vl-catch-all-apply
(function
(lambda ( / app hwd )
(if (setq app (vlax-get-acad-object)
shl (vla-getinterfaceobject app "shell.application")
hwd (vl-catch-all-apply 'vla-get-hwnd (list app))
fld (vlax-invoke-method shl 'browseforfolder (if (vl-catch-all-error-p hwd) 0 hwd) msg bit dir)
)
(setq slf (vlax-get-property fld 'self)
pth (vlax-get-property slf 'path)
pth (vl-string-right-trim "\\" (vl-string-translate "/" "\\" pth))
)
)
)
)
)
)
(if slf (vlax-release-object slf))
(if fld (vlax-release-object fld))
(if shl (vlax-release-object shl))
(if (vl-catch-all-error-p err)
(prompt (vl-catch-all-error-message err))
pth
)
;(princ pth)
)
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
;;; -------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+-----------+
// BatchProcess multiple drawing
batchtest : dialog { // Drawing files
label = "Batch Processing";
: boxed_column {
label = "Drawings to Process:";
:row {
: text {
width = 32;
label = "Folder:";
} // text
} // row
: row {
: edit_box {
width = 50;
fixed_height = true;
key = "udir";
} // edit_box
: button {
label = "Browse";
key = "browse";
width = 12;
mnemonic = "0";
is_default = false;
mnemonic = "B";
} // button
: spacer { width = 1; }
} //row
: spacer { width = 1; }
: row {
: list_box {
key = "subdirs";
width = 40;
height = 10;
multiple_select = true;
value = "";
} // list_box
} // row
: spacer { width = 1; }
: row {
: button {
label = "Add Files";
key = "afiles";
width = 5;
fixed_width = false;
is_default = true;
mnemonic = "A";
alignment = centered;
} // button
} // row
: spacer { width = 1; }
: row {
: list_box {
key = "dwgs";
width = 40;
height = 10;
multiple_select = true;
value = "";
} // list_box
} // row
: spacer { width = 1; }
: row {
: button {
label = "Remove Files";
key = "rfiles";
width = 5;
fixed_width = false;
is_default = false;
mnemonic = "F";
alignment = centered;
} // button
} // row
} // column
: row {
: text {
width = 32;
label = "Script Type:";
} // text
} // row
: row {
: popup_list {
key = "script";
width = 40;
fixed_width = true;
value = "1" ;
} // popup_list
: button {
label = "Run";
key = "run";
width = 12;
fixed_width = true;
mnemonic = "0";
is_default = true;
mnemonic = "R";
} // button
: button {
label = "Cancel";
key = "Cancel";
width = 12;
fixed_width = false;
mnemonic = "C";
is_cancel = true;
} // button
} //row
: spacer { width = 2; }
: row {
: text {
width = 32;
label = "text";
} // text
} //row
} // batchtest