Hey guys!
What I'm trying to do is relieve some of the pressure on the IT Group in my company. Right now, when we have spec files and such to copy to our CAD program (CADWorx Plant), I call the IT Group and they change the revision number in the company log-off script for the CAD package, and then when certain people log-off, it copies the files from the network, to their local drive.
So I already have the code which can copy the files (2 lisp files):
Code:
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; José Luis García Galán. 25/09/07, www.HISPACAD.com
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;Abrir Vlisp Extensión AtiveX:
(vl-load-com)
;;---------------------- CopyDir2Dir ------------------------------------------
;;Sample Use:
;; (CopyDir2Dir "F:\\Pruebas\\Cocina\\" "F:\\Pruebas\\CocinaBis" "*.lsp")
;;-----------------------------------------------------------------------------
(defun CopyDir2Dir (sourceDir destinationDir PatFiles / filesInSource)
(setq sourceDir (strcat (vl-string-right-trim "\\" sourceDir) "\\"))
(setq destinationDir (strcat (vl-string-right-trim "\\" destinationDir) "\\"))
;;Test sourceDir
(if (findfile (strcat sourceDir "."))
(if (setq filesInSource (vl-directory-files sourceDir))
(progn
;;Test destinationDir
(if (not (findfile (strcat destinationDir ".")))
(if (not (vl-mkdir destinationDir))
(progn (alert (strcat "Destination Dir: " destinationDir "\n\nwas not possible to be created."))(exit))
);c.if
);c.if
;;Process copy files:
(mapcar (function (lambda (file / fileNumber)
(if (setq fileNumber (vl-file-copy (strcat sourceDir file) (strcat destinationDir file)))
(prompt (strcat "\n" (itoa fileNumber) " -> " (strcat destinationDir file) " -> OK."))
(if (findfile (strcat destinationDir file))
(prompt (strcat "\nAlert -> " (strcat destinationDir file) " -> the file exists."))
(prompt (strcat "\nError -> " (strcat destinationDir file) " -> was not possible to be copied."))
);c.if
)
)) filesInSource);c.mapcar
);c.prg
(alert (strcat "Source Dir: " sourceDir "\n\ndoes not contain files: " PatFiles))
);c.if
(alert (strcat "Source Dir: " sourceDir "\n\ndoes not exist."))
);c.if
(princ)
);c.defun
(princ)
Code:
(CopyDir2Dir "\\\\teprog\\Programs\\CAD\\Mechanical\\CADWorx Specs" "C:\\CADWorx Plant 2009\\Spec" "*")(princ)
(CopyDir2Dir "\\\\teprog\\Programs\\CAD\\Mechanical\\CADWorx Specs\\Config Files" "C:\\CADWorx Plant 2009\\Spec\\Config Files" "*")(princ)
(CopyDir2Dir "\\\\teprog\\Programs\\CAD\\Mechanical\\CADWorx Specs\\DUVERNAY" "C:\\CADWorx Plant 2009\\Spec\\DUVERNAY" "*")(princ)
(CopyDir2Dir "\\\\teprog\\Programs\\CAD\\Mechanical\\CADWorx Specs\\ENCANA" "C:\\CADWorx Plant 2009\\Spec\\ENCANA" "*")(princ)
(CopyDir2Dir "\\\\teprog\\Programs\\CAD\\Mechanical\\CADWorx Specs\\ENCANA (BISSETTE)" "C:\\CADWorx Plant 2009\\Spec\\ENCANA (BISSETTE)" "*")(princ)
(CopyDir2Dir "\\\\teprog\\Programs\\CAD\\Mechanical\\CADWorx Specs\\ENCANA (GORDONDALE)" "C:\\CADWorx Plant 2009\\Spec\\ENCANA (GORDONDALE)" "*")(princ)
(CopyDir2Dir "\\\\teprog\\Programs\\CAD\\Mechanical\\CADWorx Specs\\PENN WEST" "C:\\CADWorx Plant 2009\\Spec\\PENN WEST" "*")(princ)
(CopyDir2Dir "\\\\teprog\\Programs\\CAD\\Mechanical\\CADWorx Specs\\TEAL" "C:\\CADWorx Plant 2009\\Spec\\TEAL" "*")(princ)
Anyways, I have acaddoc.lsp on all the CAD workstations local drives which loads another lisp file off the network everytime a drawing is opened. It sets up page setups, plot stamp stuff and loads other lisp files, etc etc.
Code:
(vl-load-com)
(princ)
(princ (load "J:\\CAD\\Mechanical\\Startup\\TEAL Mods - Mechanical.lsp" "\nTEAL Mods - Mechanical.lsp file not loaded."))
(c:tealmods)
(princ)
What I want to do is be able to add a number on a new line in the acaddoc.lsp file, and then have the same number in my TEAL Mods - Mechanical.lsp file. When I change the number (revision) in the TEAL Mods file, it will read the line in acaddoc.lsp and see there is a difference in revision numbers, then copy all my files I want from the network to the local drives, and then update the revision number in acaddoc.lsp.
So............anyone up for a small challenge?