See the top rated post in this thread. Click here

Results 1 to 6 of 6

Thread: Changing file attributes with lisp

  1. #1
    Member
    Join Date
    2000-11
    Location
    Roanoke, Va.
    Posts
    28
    Login to Give a bone
    0

    Default Changing file attributes with lisp

    Is there a way I can change the attribute of a file to read-only with lisp?

  2. #2
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,419
    Login to Give a bone
    0

    Default Re: Changing file attributes with lisp

    Its built into vba, but with lisp, you can use DOSlib from www.mcneel.com. Use the dos_attrib command.
    C:> ED WORKING....


    LinkedIn

  3. #3
    100 Club
    Join Date
    2000-12
    Posts
    126
    Login to Give a bone
    1

    Default Re: Changing file attributes with lisp

    ... 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)
    )

  4. #4
    Member
    Join Date
    2000-11
    Location
    Roanoke, Va.
    Posts
    28
    Login to Give a bone
    0

    Default Re: Changing file attributes with lisp

    Thanks everyone, Stig had what I was looking for.

  5. #5
    100 Club
    Join Date
    2000-12
    Posts
    126
    Login to Give a bone
    1

    Default Re: Changing file attributes with lisp

    Don't forget Robert McNeel has what you are looking for. I just thought it'd be more fun to write one.

  6. #6
    Administrator Ed Jobe's Avatar
    Join Date
    2000-11
    Location
    Turlock, CA
    Posts
    6,419
    Login to Give a bone
    0

    Default Re: Changing file attributes with lisp

    If you're referring to McNeel, I provided you a link in post #2.
    C:> ED WORKING....


    LinkedIn

Similar Threads

  1. Changing attributes color bylayer...?
    By aport in forum AutoCAD LT - General
    Replies: 5
    Last Post: 2018-09-11, 02:18 PM
  2. Replies: 3
    Last Post: 2012-05-07, 08:16 PM
  3. Replies: 10
    Last Post: 2008-02-21, 07:44 PM
  4. Changing all attributes with the same tag
    By todd.mackay in forum AutoCAD General
    Replies: 3
    Last Post: 2005-11-21, 04:26 PM
  5. Changing the order of attributes
    By kdayman in forum VBA/COM Interop
    Replies: 2
    Last Post: 2005-02-15, 11:46 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •