|
Welcome, Guest.
|
||||||
| AutoLISP AutoLISP or Visual LISP, learn both here! |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Member
Join Date: 2000-11
Posts: 21
![]() |
I am trying to compare the dates on various files.
I have been using vl-file-systime, which is unreliable, it often returns nil for inexplicable (at least to me) reasons. I now Doslib has a function to pull out a file's date, but is there another way to do it, so I don't have to rely on outside software? |
|
|
|
|
|
#2 |
|
100 Club
Join Date: 2000-12
Posts: 126
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
If you don't want to use either, you could again consult the Windows Scripting Host. But don't forget, that's also "outside software".
File dates accessed by the FileSystemObject are in a 1900-based format that's not easy to convert with AutoLISP. Jon Fleming provides an excellent conversion routine in his ADOLISP Database Library (excellent stuff alltogether). The routine below uses it. Of course you could just compare the raw julian dates it retrieves from the file. Code:
;; Note: Some VL-CATCH-ALL-thingies should be added in strategic places!
(defun fDate (file / fso date)
(and (not file)(setq file (getfiled "" "" "" 0)))
(cond ((setq fso (vlax-create-object "Scripting.FilesystemObject"))
(and (eq :vlax-true (vlax-invoke-method fso 'FileExists file))
(setq file (vlax-invoke-method fso 'GetFile file))
(setq date (vlax-get-property file 'DateCreated))
(setq date (1900BasedJulianToCalender date))
(vlax-release-object file)
)
(vlax-release-object fso)
)
)
date
)
|
|
|
|
|
|
#3 |
|
100 Club
Join Date: 2000-12
Posts: 126
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
By the way, if you need modication or last accessed date instead of creation date - or some other property - then look up the references at http://msdn.microsoft.com/library/default.asp?. Just search for FileSystemObject.
|
|
|
|
|
|
#4 |
|
Member
Join Date: 2000-11
Posts: 21
![]() |
Thanks for your help, Stig. That will put me where I want to go.
|
|
|
|
![]() |
|
||||||
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Copy Central File | B. Strube | Revit - Worksharing/Worksets | 5 | 2004-09-24 05:32 PM |
| Ploting and Publish DWL file | trevorh | AutoCAD Plotting | 2 | 2004-06-30 10:29 AM |
| linking a central file to the site plan produces errors | JGAbbott | Revit - Worksharing/Worksets | 2 | 2004-01-12 01:43 AM |