Hi All,
I am really new to autolisp coding and need some help figuring this out. I would like to be able to create a folder path from text I paste into a textbox on a .dcl I created. It varies on an occasion by occasion basis as to how many folders deep the root folders will already exist e.g. a typical root folder scenario is like this:
"U:\Folder1\Folder2\Folder3\Folder4\Folder5"
- folders1 and 2 are static and can be hard coded as root folders,
- folder3 is there 98% of the time but there will be rare occasions that a new folder will need to be created
- folder4 may or may not already exist (ususally not)
- in very rare cases folder5 may also exist
Using the lisp code I found on a forum below, how do I pass the string variable from my dcl text box to the code.
Code:
(defun makepath (path / temp items dir)
(vl-load-com)
(setq path (if (= (type path) 'STR)(vl-string-right-trim "/\\" path)
nil))
(while (and path (/= temp path))
(setq items (cons (vl-filename-base path) items)
temp path
path (vl-filename-directory path)
)
)
(while (setq item (car (setq items (cdr items))))
(setq dir (strcat path item))
(if (or (vl-directory-files path item -1)(vl-mkdir dir))
(setq path (strcat dir "\\"))
(setq items (prompt (strcat "\nUnable to create directory \"" dir
"\"\n")))
)
///Note: I can't tell what the path string is much less where it would come from
//DCL
myTB : dialog {
label = "Project Folder";
: edit_box {
label = "Enter Path";
key = "VEL";
edit_width = 100;
allow_accept = true;
}
ok_cancel ;
}
I would very much appreciate some help on this. I think that once I can understand these two things, I'll be on my way. Thanks in advance