Hi!

I am in a desperate need of a LISP routine to do the following.

I have a folder with .dwg files. These are old versions of the documents, and I need to import blocks and attribute values from them to the current drawing.
When the user types the command to start the lisp in the current drawing, the following things should happen:

1. Ask user for folder path (command line, no GUI)
2. Lisp tries to find a match of current document name to a drawing found in the folder -> If match found then continue, otherwise present user with an error.
3. Find all blocks where the name starts with "REV." from the folder document (REV.A, REV.B....), insert them to the current drawing. IMPORTANT, the position must match!
4. From the folder file, copy this list of attributes from a block named "A4" to the current drawing (current drawing also contains a block "A4", but I can't copy the whole block. I need only certain attributes to be updated!)
Code:
A list of attribute names in block "A4" that needs to be copied from the folder drawing -> Active drawing

DRAWN
DATE
REV
REV_A
DATE_A
DRAWN_A
REV_B
DATE_B
DRAWN_B
REV_C
DATE_C
DRAWN_C
REV_D
DATE_D
DRAWN_D
REV_E
DATE_E
DRAWN_E
REV_F
DATE_F
DRAWN_F

I have tried to modify a lisp by Lee Mac (But with super bad success)

Code:
;;----------------------=={ Copy Block }==--------------------;;
;;                                                            ;;
;;  Copies the selected block definition from the selected    ;;
;;  filename to the ActiveDocument using a deep clone         ;;
;;  operation (Method inspired by Tony Tanzillo)              ;;
;;------------------------------------------------------------;;
;;  Author: Lee McDonnell, 2010                               ;;
;;                                                            ;;
;;  Copyright © 2010 by Lee McDonnell, All Rights Reserved.   ;;
;;  Contact: Lee Mac @ TheSwamp.org, CADTutor.net             ;;
;;------------------------------------------------------------;;

(defun c:cb ( / *error* acapp acdoc acblk spc dwg dbxDoc lst dcfname file dc ptr fl pt norm block )
  (vl-load-com)
  ;; © Lee Mac 2010

  (defun *error* ( msg )

    (vl-catch-all-apply
     '(lambda nil
        (and dbxDoc (vlax-release-object dbxDoc))    
        (and file (eq 'FILE (type file)) (setq file (close file)))    
        (and dcfname (setq dcfname (findfile dcfname)) (vl-file-delete dcfname))    
        (and dc (unload_dialog dc))
      )
    )
    
    (or (wcmatch (strcase msg) "*BREAK,*CANCEL*,*EXIT*")
        (princ (strcat "\n** Error: " msg " **")))
    (princ)
  )
  
  (setq acapp (vlax-get-acad-object)
        acdoc (vla-get-ActiveDocument acapp)
        acblk (vla-get-Blocks acdoc))

  (setq spc
    (if
      (or (eq AcModelSpace (vla-get-ActiveSpace acdoc))
          (eq :vlax-true (vla-get-MSpace acdoc))
      )
      (vla-get-ModelSpace acdoc)
      (vla-get-PaperSpace acdoc)
    )
  )

  (cond
    (
      (not (setq dwg (getfiled "Select Drawing to Copy From" "" "dwg" 16)))

      (princ "\n*Cancel*")
    )
    (
      (eq dwg (vla-get-fullname acdoc))

      (princ "\n** Cannot Copy from Active Drawing **")
    )
    (
      (not (setq dbxDoc (LM:GetDocumentObject dwg)))

      (princ "\n** Unable to Interface with Selected Drawing **")
    )
    (
      (not
        (progn
          (vlax-for b (vla-get-Blocks dbxDoc)            
            (if (not (or (eq :vlax-true (vla-get-isXRef b))
                         (eq :vlax-true (vla-get-isLayout b))))
              (setq lst (cons (vla-get-name b) lst))
            )
          )
          (setq lst (acad_strlsort (vl-remove-if '(lambda ( x ) (tblsearch "BLOCK" x)) lst)))
        )
      )

      (princ "\n** No distinct Blocks Found in Selected Drawing **")
    )
    (
      (not
        (progn
          (setq dcfname (vl-filename-mktemp nil nil ".dcl"))

          (if (setq file (open dcfname "w"))
            (progn
              (write-line "copyblock : dialog { label = \"Select Block to Copy...\"; spacer; : list_box { key = \"blocks\"; } spacer; ok_cancel;}" file)
              (not (setq file (close file)))
            )
          )
        )
      )

      (princ "\n** Unable to Write DCL File **")
    )
    (
      (<= (setq dc (load_dialog dcfname)) 0)

      (princ "\n** DCL File not Found **")
    )
    (
      (not (new_dialog "copyblock" dc))

      (princ "\n** Unable to Load Dialog **")
    )
    (t
      (start_list "blocks")
      (mapcar 'add_list lst)
      (end_list)

      (setq ptr (set_tile "blocks" "0"))
      (action_tile "blocks" "(setq ptr $value)")

      (setq fl (start_dialog) dc (unload_dialog dc))

      (if (and (= 1 fl) (setq pt (getpoint "\nSpecify Point for Block: ")))
        (progn
          (vla-CopyObjects dbxDoc
            (vlax-make-variant
              (vlax-safearray-fill
                (vlax-make-safearray vlax-vbObject '(0 . 0))
                (list (LM:Itemp (vla-get-blocks dbxDoc) (setq block (nth (atoi ptr) lst))))
              )
            )
            acblk
          )

          (setq norm (trans '(0. 0. 1.) 1 0 t))

          (if (LM:Itemp acblk block)
            (vla-insertBlock spc (vlax-3D-point (trans pt 1 0)) block 1. 1. 1.
              (angle '(0. 0. 0.) (trans (getvar 'UCSXDIR) 0 norm t))
            )
          )
        )
        (princ "\n*Cancel*")
      )
    )
  )

  (and dcfname (setq dcfname (findfile dcfname)) (vl-file-delete dcfname))
  
  (and dbxDoc  (vlax-release-object dbxDoc))

  (princ)
)

;;-----------------=={ Get Document Object }==----------------;;
;;                                                            ;;
;;  Retrieves a the VLA Document Object for the specified     ;;
;;  filename. Document Object may be present in the Documents ;;
;;  collection, or obtained through ObjectDBX                 ;;
;;------------------------------------------------------------;;
;;  Author: Lee McDonnell, 2010                               ;;
;;                                                            ;;
;;  Copyright © 2010 by Lee McDonnell, All Rights Reserved.   ;;
;;  Contact: Lee Mac @ TheSwamp.org, CADTutor.net             ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  filename - filename for which to retrieve document object ;;
;;------------------------------------------------------------;;
;;  Returns:  VLA Document Object, else nil                   ;;
;;------------------------------------------------------------;;

(defun LM:GetDocumentObject ( filename / acdocs dbx )
  (vl-load-com)
  ;; © Lee Mac 2010
  
  (vlax-map-collection (vla-get-Documents (vlax-get-acad-object))
    (function
      (lambda ( doc )
        (setq acdocs
          (cons
            (cons (strcase (vla-get-fullname doc)) doc) acdocs
          )
        )
      )
    )
  )

  (cond
    ( (not (setq filename (findfile filename))) )
    ( (cdr (assoc (strcase filename) acdocs)) )
    ( (not
        (vl-catch-all-error-p
          (vl-catch-all-apply 'vla-open
            (list (setq dbx (LM:ObjectDBXDocument)) filename)
          )
        )
      )
      dbx
    )
  )
)

;;-----------------=={ ObjectDBX Document }==-----------------;;
;;                                                            ;;
;;  Retrieves a version specific ObjectDBX Document object    ;;
;;------------------------------------------------------------;;
;;  Author: Lee McDonnell, 2010                               ;;
;;                                                            ;;
;;  Copyright © 2010 by Lee McDonnell, All Rights Reserved.   ;;
;;  Contact: Lee Mac @ TheSwamp.org, CADTutor.net             ;;
;;------------------------------------------------------------;;
;;  Arguments: - None -                                       ;;
;;------------------------------------------------------------;;
;;  Returns:  VLA ObjectDBX Document object, else nil         ;;
;;------------------------------------------------------------;;

(defun LM:ObjectDBXDocument ( / acVer )
  ;; © Lee Mac 2010
  (vla-GetInterfaceObject (vlax-get-acad-object)
    (if (< (setq acVer (atoi (getvar "ACADVER"))) 16)
      "ObjectDBX.AxDbDocument"
      (strcat "ObjectDBX.AxDbDocument." (itoa acVer))
    )
  )
)

;;-----------------------=={ Itemp }==------------------------;;
;;                                                            ;;
;;  Retrieves the item with index 'item' if present in the    ;;
;;  specified collection, else nil                            ;;
;;------------------------------------------------------------;;
;;  Author: Lee McDonnell, 2010                               ;;
;;                                                            ;;
;;  Copyright © 2010 by Lee McDonnell, All Rights Reserved.   ;;
;;  Contact: Lee Mac @ TheSwamp.org, CADTutor.net             ;;
;;------------------------------------------------------------;;
;;  Arguments:                                                ;;
;;  coll - the VLA Collection Object                          ;;
;;  item - the index of the item to be retrieved              ;;
;;------------------------------------------------------------;;
;;  Returns:  the VLA Object at the specified index, else nil ;;
;;------------------------------------------------------------;;

(defun LM:Itemp ( coll item )
  ;; © Lee Mac 2010
  (if
    (not
      (vl-catch-all-error-p
        (setq item
          (vl-catch-all-apply
            (function vla-item) (list coll item)
          )
        )
      )
    )
    item
  )
)
Is anybody here helping me out?