Results 1 to 5 of 5

Thread: Detect Read-Only file attribute

  1. #1
    I could stop if I wanted to msretenovic's Avatar
    Join Date
    2002-02
    Location
    Galloway, Oh
    Posts
    304

    Unhappy Detect Read-Only file attribute

    Hello all,

    I'm writing a routine and have come across a slight snag. I have this code:

    Code:
     
    (if (not (vl-catch-all-apply 'vla-open (list dbxDoc dwg)))
      (progn
    	;;do my stuff here
    	(vla-saveas- dbxDoc dwg)
      )
    )
    This works really well until I come to a file that is Read-Only . It will do as I expect when the file is Read-Only when someone has it open, but if it's file attribute is Read-Only, it doesn't catch it . Does any know a way around this or how to check to see if a file has a Read-Only attribute ?

    TIA
    Michael K. Sretenović
    Most folks are about as happy as they make up their minds to be.
    -Abraham Lincoln (1809-1865)
    -16th president of The United States of America (1861 - 1865)

  2. #2
    Administrator Mike.Perry's Avatar
    Join Date
    2001-03
    Posts
    13,499

    Default Re: Detect Read-Only file attribute

    Hi Mike

    Check out the following article by Stig Madsen -

    Scripting objects

    Way over my head but I'm pretty sure you can/could achieve what you're after using the methods described in the article.

    Have a good one, Mike

  3. #3
    Administrator RobertB's Avatar
    Join Date
    2001-08
    Location
    Dallas TX USA
    Posts
    5,825

    Default Re: Detect Read-Only file attribute

    Here is a simple method too:

    Code:
    (defun IsRO (fileN / fileH)
     (cond ((setq fileH (open fileN "a"))
            (close fileH)))
     (not fileH))

  4. #4
    I could stop if I wanted to msretenovic's Avatar
    Join Date
    2002-02
    Location
    Galloway, Oh
    Posts
    304

    Default Re: Detect Read-Only file attribute

    Robert,

    That is exactly what I was looking for . So simple, yet so effective .



    Thanks
    Michael K. Sretenović
    Most folks are about as happy as they make up their minds to be.
    -Abraham Lincoln (1809-1865)
    -16th president of The United States of America (1861 - 1865)

  5. #5
    Administrator RobertB's Avatar
    Join Date
    2001-08
    Location
    Dallas TX USA
    Posts
    5,825

    Default Re: Detect Read-Only file attribute

    Glad I could help!

Similar Threads

  1. read field expression of an attribute
    By alberto.boffi695984 in forum AutoLISP
    Replies: 4
    Last Post: 2011-06-02, 07:29 AM
  2. Read attribute values FROM Access.
    By jguest in forum VBA/COM Interop
    Replies: 14
    Last Post: 2009-06-29, 12:59 AM
  3. READ ATTRIBUTE
    By lshivers in forum AutoLISP
    Replies: 3
    Last Post: 2009-05-08, 09:17 AM
  4. script/lisp: read attribute value
    By David van Erk in forum AutoLISP
    Replies: 4
    Last Post: 2006-08-10, 05:02 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
  •