Is there a way I can change the attribute of a file to read-only with lisp?
|
Is there a way I can change the attribute of a file to read-only with lisp?
Its built into vba, but with lisp, you can use DOSlib from www.mcneel.com. Use the dos_attrib command.
... or write your own,
Code:(defun SetRO (/ afile fso ofile ro) (cond ((and (setq aFile (getfiled "" "" "" 4)) (setq fso (vlax-create-object "Scripting.FilesystemObject")) (setq oFile (vlax-invoke fso 'GetFile aFile)) ) (vlax-put-property oFile 'Attributes (setq ro (- 1 (logand 1 (vlax-get-property oFile 'Attributes))))) (princ (strcat "File set to " (nth ro '("Read-write" "Read-only")))) (vlax-release-object oFile) (vlax-release-object fso) ) ) (princ) )
Thanks everyone, Stig had what I was looking for.
Don't forget Robert McNeel has what you are looking for. I just thought it'd be more fun to write one.