Author Topic: is there a way to get the writestat of a dwg before its opened?  (Read 1057 times)

0 Members and 1 Guest are viewing this topic.

andrew..

  • Newt
  • Posts: 24
is there a way to get the writestat of a dwg before its opened?
« 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

ronjonp

  • Needs a day job
  • Posts: 7526
Re: is there a way to get the writestat of a dwg before its opened?
« Reply #1 on: January 19, 2021, 11:39:03 PM »
Not that I know of. Your coworkers should focus on more important stuff.  :evil:

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: is there a way to get the writestat of a dwg before its opened?
« Reply #2 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
)