Saturday, November 21, 2009
Home   |   Search   |   About AUGI   |   My AUGI   |   Join Now

Go Back   AUGI Forums > AUGI Technical (English) > Programming > AutoLISP
 Welcome, Guest. 

Login

Join Now FAQ Members List Calendar Search Today's Posts Mark Forums Read

AutoLISP AutoLISP or Visual LISP, learn both here!

Reply
 
Thread Tools Display Modes
Old 2004-06-18, 05:34 PM   #1
pcs
Member
 
Join Date: 2000-11
Posts: 21
pcs is starting their journey
Default File dates

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?
pcs is offline   Reply With Quote
Old 2004-06-18, 06:57 PM   #2
stig.madsen
100 Club
 
Join Date: 2000-12
Posts: 126
stig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightly
Default RE: File dates

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
)
stig.madsen is offline   Reply With Quote
Old 2004-06-18, 07:04 PM   #3
stig.madsen
100 Club
 
Join Date: 2000-12
Posts: 126
stig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightlystig.madsen is glowing brightly
Default

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.
stig.madsen is offline   Reply With Quote
Old 2004-06-23, 01:43 PM   #4
pcs
Member
 
Join Date: 2000-11
Posts: 21
pcs is starting their journey
Default RE: File dates

Thanks for your help, Stig. That will put me where I want to go.
pcs is offline   Reply With Quote
Reply


Go Back   AUGI Forums > AUGI Technical (English) > Programming > AutoLISP

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off

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


All times are GMT +1. The time now is 01:47 PM.