PDA

View Full Version : read only


clovis
2006-07-10, 02:52 PM
Hello,
I'd like to be able to check if a file is read-only.(with lisp?)
have you some example?
Thanks

rkmcswain
2006-07-10, 04:35 PM
You could use something like this.


(defun isFileRO (fname / fso)
(setq fso (vlax-create-object "Scripting.FileSystemObject"))
(if (eq :vlax-true (vlax-invoke-method fso 'FileExists fname))
(eq (logand 1 (vlax-get (vlax-invoke-method fso 'GetFile fname) "Attributes")) 1)
nil
)
)

clovis
2006-07-11, 07:05 AM
Hello,
Thanks a lot rkmcswain
It works like a charm
A question though:
where did you find out about
-"Scripting.FileSystemObject"
-:vlax-true
?
Bye

Opie
2006-07-11, 03:05 PM
Hello,
Thanks a lot rkmcswain
It works like a charm
A question though:
where did you find out about
-"Scripting.FileSystemObject"
-:vlax-true
?
Bye
You can try Scripting Objects I (http://www.afralisp.net/lisp/script1.htm) from Afralisp.

RenataP
2006-07-12, 01:52 AM
You can try Scripting Objects I (http://www.afralisp.net/lisp/script1.htm) from Afralisp.
Thanks for the link!

Just passing through. :)

clovis
2006-07-12, 09:03 AM
Thanks a lot (too) ;-))

abdulhuck
2006-07-12, 09:16 AM
Hello,
I'd like to be able to check if a file is read-only.(with lisp?)
have you some example?
Thanks
Also have a look at the DosLib utility from http://www.mcneel.com (http://www.mcneel.com/). It is packed with a lot of useful functions.

Regards,
Abdul Huck

rkmcswain
2006-07-12, 02:05 PM
Also have a look at the DosLib utility...

Nothing against DosLib or any other 3rd party add-on, but keep in mind when you use 3rd party applications for which you do not have the source code, you risk the chance that development for the 3rd party tool may be dropped, leaving your code with a hole when AutoCAD is upgraded.

Having said that, I believe DosLib has always been good in the past about providing timely updates when required.

abdulhuck
2006-07-22, 08:37 AM
I agree with you McSwain...

Regards,

Abdul Huck