Author Topic: Fileopen test  (Read 9655 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: Fileopen test
« Reply #15 on: September 20, 2010, 07:31:50 PM »
Lee, I don't think that is what the OP requires.
When [you] open an AutoCAD file read-Only the file attributes are NOT set by the Op System ... In fact I think you may be able to even move the file while it is open. If memory serves, the read-only status is saved by the app.



Apologies -

You are right, it (my function) returns nil in both states (open & closed).

kpblc

  • Bull Frog
  • Posts: 396
Re: Fileopen test
« Reply #16 on: September 21, 2010, 06:20:17 AM »
Try this:
Code: [Select]
(defun check-readonly-file (file)
                           ;|
Cheking REadONly file
Call args:
file - filename, string
Returns:
-1 -> File not exist
0  -> File is not read-only
1  -> File is read-only
|;
  (cond
    ((not (findfile file))
          ;(princ "\nFile not found")
     -1
     )
    ((not (vl-file-systime (findfile file)))
          ;(princ "\nFile is ReadOnly")
     0
     )
    (t
     1
          ;(princ "\nEverything OK")
     )
    ) ;_ end of cond
  ) ;_ end of defun
Sorry for my English.

BlackBox

  • King Gator
  • Posts: 3770
Re: Fileopen test
« Reply #17 on: September 21, 2010, 09:41:05 AM »
Combined the WHOHAS code and have a really useful function now.

Post your code, for others to find.
"How we think determines what we do, and what we do determines what we get."