antistar Posted October 30, 2014 Posted October 30, 2014 (edited) Does anyone know how to change the attributes of several files to read-only with LISP? Edited October 31, 2014 by antistar Quote
BIGAL Posted October 31, 2014 Posted October 31, 2014 You can do it with VLisp this has been commented on before search here. Quote
antistar Posted October 31, 2014 Author Posted October 31, 2014 Thanks Bigal, for reply. I found this routine, but it only works for one file. I would like to change several files at once. (defun c:SetRO (/ afile fso ofile ro) ;;by stig.madsen (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) ) Quote
MSasu Posted October 31, 2014 Posted October 31, 2014 Just build-up the list of files (see VL-DIRECTORy-FILES function) and use FOREACH to adjust their properties. An alternative for adjusting the properties of files is DOS_ATTRIB from DosLIB pack (freeware); please note that this supports wildcard characters. Quote
CheSyn Posted October 31, 2014 Posted October 31, 2014 Just build-up the list of files (see VL-DIRECTORy-FILES function) and use FOREACH to adjust their properties.An alternative for adjusting the properties of files is DOS_ATTRIB from DosLIB pack (freeware); please note that this supports wildcard characters. Would calling the LISP from a script, and running a batch through ScriptPro work as well? Perhaps a more simplistic approach? Quote
BIGAL Posted October 31, 2014 Posted October 31, 2014 Re script change (defun c:SetRO (/ afile fso ofile ro) to (defun SetRO (afile / fso ofile ro) The script (load "setro") (setro "C:\acadtemp\dwg1") (setro "C:\acadtemp\dwg2") [/code] Quote
asos2000 Posted November 1, 2014 Posted November 1, 2014 See this http://www.lee-mac.com/bfind.html Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.