TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: andrew.. on January 19, 2021, 07:33:07 PM

Title: is there a way to get the writestat of a dwg before its opened?
Post by: andrew.. on January 19, 2021, 07:33:07 PM
Hello all
its been a while. happy new year to all.
I know the subject is a dumb question but I just thought there might be a clever way someone came up with to get this variable.
Is there a way to get a writestat of a dwg before it opens?
some of my coworkers want to just double click a file and have it open without any prompts whether its read only or not.

any guidance is appreciated
Title: Re: is there a way to get the writestat of a dwg before its opened?
Post by: ronjonp on January 19, 2021, 11:39:03 PM
Not that I know of. Your coworkers should focus on more important stuff.  :evil:
Title: Re: is there a way to get the writestat of a dwg before its opened?
Post by: Marc'Antonio Alessi on January 20, 2021, 03:07:10 AM
Maybe this:
Code: [Select]
(defun ALE_UtlFileWhoHas (PatNam / FilPtr TmpStr OutLst)
  (if (and (findfile PatNam) (setq FilPtr (open (strcat (vl-filename-directory PatNam) "\\" (vl-filename-base PatNam) ".DWL") "r")))
    (progn
      (while (setq TmpStr (read-line FilPtr))
        (setq OutLst (cons TmpStr OutLst))
      )
      (close FilPtr)
      (reverse OutLst)
    )
  )
)
Code: [Select]
(defun LM:IsReadOnly ( f / fso file result )
  (vl-load-com)
  ;; © Lee Mac 2010
  (setq fso (vlax-create-object "Scripting.FileSystemObject"))

  (setq result
    (cond
      ( (zerop (vlax-invoke fso 'FileExists f)) nil )
      ( (= 1 (logand 1 (vlax-get (setq file (vlax-invoke fso 'GetFile f)) 'Attributes))) )
    )
  )

  (and file (vlax-release-object file))
  (vlax-release-object fso)
  result
)