Results 1 to 1 of 1

Thread: Create folder Path from text in a .dcl text box

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2015-03
    Posts
    1
    Login to Give a bone
    0

    Default Create folder Path from text in a .dcl text box

    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:
    //Lisp 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
    Last edited by rkmcswain; 2015-03-24 at 07:29 PM. Reason: added [CODE] tags

Similar Threads

  1. Folder Name into Text Field
    By janderson664783 in forum AutoLISP
    Replies: 10
    Last Post: 2012-07-19, 02:28 PM
  2. Replies: 0
    Last Post: 2011-11-03, 07:10 AM
  3. Text Features along a Path
    By mkrupa in forum Inventor Wish List
    Replies: 0
    Last Post: 2005-11-22, 01:45 PM
  4. Text on a path.
    By kb3cxe in forum AutoCAD General
    Replies: 2
    Last Post: 2005-11-06, 05:33 PM
  5. Text on Curved Path
    By jwherry in forum AutoCAD General
    Replies: 2
    Last Post: 2005-01-17, 06:05 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •