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
    305
    Login to Give a bone
    0

    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

  2. #2
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    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
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    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
    305
    Login to Give a bone
    0

    Default Re: Detect Read-Only file attribute

    Robert,

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



    Thanks

  5. #5
    The Silent Type RobertB's Avatar
    Join Date
    2000-01
    Location
    Seattle WA USA
    Posts
    5,859
    Login to Give a bone
    0

    Default Re: Detect Read-Only file attribute

    Glad I could help!

Similar Threads

  1. read attribute textstring vb.net
    By El Martino in forum Dot Net API
    Replies: 3
    Last Post: 2012-05-29, 09:11 PM
  2. read field expression of an attribute
    By alberto.boffi695984 in forum AutoLISP
    Replies: 4
    Last Post: 2011-06-02, 07:29 AM
  3. Read attribute values FROM Access.
    By jguest82179 in forum VBA/COM Interop
    Replies: 14
    Last Post: 2009-06-29, 12:59 AM
  4. READ ATTRIBUTE
    By lshivers in forum AutoLISP
    Replies: 3
    Last Post: 2009-05-08, 09:17 AM
  5. 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
  •