Is There a way of a lisp warn instantly when an archive is created in a directory?
Cheers
Solved! Go to Solution.
Solved by BlackBox_. Go to Solution.
Welcome to the forums, and congrats on your first post!
@Nett0 wrote:Is There a way of a lisp warn instantly when an archive is created in a directory?
Cheers
No not in the way you might be wanting... LISP can do many things, particularly the ActiveX side of the API, but LISP is relegated to a small number of what's called "Events" that it can monitor, or react to, when a given event is raised.
As an example, when you open a Document (read Drawing), or when a particular Command starts (i.e., Save, etc.), certain tasks can be performed programmatically.
However, to properly be notified when an archive is placed within the Active Document's location (read DwgPrefix), you'd have to step up into the .NET API, in order to implement an appropriate FileSystemWatcher.
While this may not be the answer you were hoping for, I do hope it helps.
Cheers
"How we think determines what we do, and what we do determines what we get."
Thanks BlackBox,
This is what i'm looking for, to be notified when an archive is placed within the Active Document's location.
But i've never worked with .NET before. Where can i find more about it?
Cheers
Just to reiterate, LISP can tell you if there's an archive file withint he DwgPrefix, it's simply a matter of when you'd be notified.
For example, here's a LISP Reactor which checks for any file with .RAR within the Active Document's location, following each Command (which is only being done for dmeonstration purposes; this would probably become quite annoying if used for daily production depending on how often a .RAR is added to your project):
(vl-load-com) (defun c:FileWatcher () ;; if FileWatcher is active (if *FileWatcher* ;; turn off (progn (vlr-remove *FileWatcher*) (setq *FileWatcher* nil) (setq FileWatcher:CommandEnded nil) (prompt "\n** FileWatcher off ** ") ) ;; turn on (progn (setq *FileWatcher* (vlr-command-reactor nil '( (:vlr-commandcancelled . FileWatcher:CommandEnded) (:vlr-commandended . FileWatcher:CommandEnded) (:vlr-commandfailed . FileWatcher:CommandEnded) ) ) ) (defun FileWatcher:CommandEnded (rea cmd / archives) (if (setq archives (vl-directory-files (getvar 'dwgprefix) "*.rar" 1) ) (alert (apply 'strcat (cons "Archive file(s) found in Active Document's location: \n\n" (mapcar (function (lambda (x) (strcat x "\n") ) ) (vl-sort archives '<) ) ) ) ) ) ) (prompt "\nFileWatcher loaded. ") ) ) (princ) ) (c:FileWatcher) (princ)
As for learnign about .NET development... That's a loaded question! LoL
As many .NET developers will confirm, your best bet is to spend the next year learning to become adept at .NET development outside of AutoCAD, however, if you don't have time for that this thread may help get you started:
http://www.cadtutor.net/forum/showthread.php?69646-Where-to-start-with-.Net
Cheers
"How we think determines what we do, and what we do determines what we get."