<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: lisp file locking in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8557037#M93563</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5738838"&gt;@Gaganpatel&lt;/a&gt;&amp;nbsp;wrote:&amp;nbsp;&lt;SPAN style="color: #0000ff; font-family: inherit;"&gt;suppose one lisp file inner four types of program use.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;i do not understand what that means?&lt;/P&gt;
&lt;P&gt;and if what have i gave you is not helping than i can not help more - sorry&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 29 Jan 2019 05:53:41 GMT</pubDate>
    <dc:creator>Moshe-A</dc:creator>
    <dc:date>2019-01-29T05:53:41Z</dc:date>
    <item>
      <title>lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8551100#M93553</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dear Sir,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I want to lisp file use in one computer is working ,any other computer use this lisp file is locking process.&lt;/P&gt;
&lt;P&gt;Please share lisp file.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 03:25:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8551100#M93553</guid>
      <dc:creator>Gaganpatel</dc:creator>
      <dc:date>2019-01-26T03:25:13Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8551198#M93554</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class=""&gt;&lt;A class="lia-link-navigation lia-page-link lia-user-name-link" href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5738838" target="_self"&gt;kalandipaital19&lt;WBR /&gt;89&lt;/A&gt;,&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;I'm thinking when the lisp Routine starts it reads a text file and it must be blank or has the same username, then overwrites the file with the username and date&amp;amp;time.&amp;nbsp; When the program is finished it overwrites the file as a new blank file.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;A different computer runs the Routine and it reads the text file but the username does not match so the Routine displays "Can't proceed, In use by another user: xxxxx at mm:dd:yyyy hh:m:ss" and exits.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;However, my question would be how critical is it to lockout other computers from running the same Routine?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;1. There may be a time someone can not run the Routine because the station stopped working with the password screen lock or out of the office.&amp;nbsp; Does this person have to wait? Or can a person select an option to take ownership of the lockfile by overwriting with their username and date&amp;amp;time?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;2. Does running the lisp Routine in multiple drawings on same computer the cause any problems?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;This situation would be like editing an excel spread sheet, by read-only for others until the person editing the file exits.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Scott U&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 06:55:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8551198#M93554</guid>
      <dc:creator>Scottu2</dc:creator>
      <dc:date>2019-01-26T06:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8551227#M93555</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5738838"&gt;@Gaganpatel&lt;/a&gt;&amp;nbsp; hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is a function (sp:user_validate) that returns T if a user coming from his computer is allowed to process a lisp function. the data for (vl-some) function is two list of names, 1st user names and 2nd computer names. made them&amp;nbsp; lists so that you can reword in future more peoples&amp;nbsp;&lt;img id="smileylol" class="emoticon emoticon-smileylol" src="https://forums.autodesk.com/i/smilies/16x16_smiley-lol.png" alt="Smiley LOL" title="Smiley LOL" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;enjoy&lt;/P&gt;
&lt;P&gt;moshe&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun sp:user_validate ()
 (vl-some
   '(lambda (AllowedUserName AllowedComputername)
      (and
        (eq (strcase (getenv "UserName"))     (strcase AllowedUserName))
        (eq (strcase (getenv "ComputerName")) (strcase AllowedComputerName))
      )
   )
   '("Sandip" 	     "user2" 	 "user3")	; allowed user names
   '("Sandip-Paital" "Computer2" "Computer3")   ; allowed computer names
 ); vl-some
); user_validate


(defun c:test ()
 (if (not (sp:user_validate))
  (prompt "\nCommand is Locked.")
  (progn 
   ; do your Command 
   ; ...........
   ; .........
   ; .......
   ; .....
  ); progn
 ); if

 (princ)
)

&lt;/PRE&gt;</description>
      <pubDate>Sat, 26 Jan 2019 07:47:18 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8551227#M93555</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2019-01-26T07:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8551352#M93556</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dear Sir,&lt;/P&gt;
&lt;P&gt;how to use this lisp.&lt;/P&gt;
&lt;P&gt;Please share me.&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 11:13:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8551352#M93556</guid>
      <dc:creator>Gaganpatel</dc:creator>
      <dc:date>2019-01-26T11:13:02Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8551534#M93557</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5738838"&gt;@Gaganpatel&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;let's say you have a lisp file calls tagins.lsp that insert a specific tag block (s-tag) in your drawing - ok?&lt;/P&gt;
&lt;P&gt;could be somethings like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:tagins ()
 (if (null (tblsearch "layer" "tags")) 
  (command "._layer" "_make" "tags" "_color" 3 "tags" "")
 )
 (command-s ".insert" "s-tag")  
)&lt;/PRE&gt;
&lt;P&gt;and you want to allow only to Sandip &amp;amp; Joe &amp;amp; Sandy to run it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;open the tagins.lsp in notepad and copy paste the blue lines code inside:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#0000FF"&gt;(defun sp:user_validate (AllowedUserNames^ AllowedComputerNames^)
 (vl-some
   '(lambda (AllowedUserName AllowedComputername)
      (and
        (eq (strcase (getenv "UserName"))     (strcase AllowedUserName))
        (eq (strcase (getenv "ComputerName")) (strcase AllowedComputerName))
      )
   )
   '("Sandip" 	     "Joe"     "Sandy")	      ; allowed user names
   '("Sandip-Paital" "Joe-w10" "Sandy-w10")   ; allowed computer names
 ); vl-some
); user_validate
&lt;/FONT&gt;
(defun c:tagins ()
 &lt;FONT color="#0000FF"&gt;(if (not (sp:user_validate))
  (prompt "\nCommand is Locked.")
  (progn&lt;/FONT&gt; 
   (if (null (tblsearch "layer" "tags")) 
    (command "._layer" "_make" "tags" "_color" 3 "tags" "")
   ); if
  
   (command-s ".insert" "b-tag")
&lt;FONT color="#0000FF"&gt;  ); progn
 ); if&lt;/FONT&gt;
); tagins 
&lt;/PRE&gt;
&lt;P&gt;if this doesn't help you i'm 'coming' over&amp;nbsp;&lt;img id="smileylol" class="emoticon emoticon-smileylol" src="https://forums.autodesk.com/i/smilies/16x16_smiley-lol.png" alt="Smiley LOL" title="Smiley LOL" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 26 Jan 2019 14:29:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8551534#M93557</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2019-01-26T14:29:47Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8552351#M93558</link>
      <description>&lt;P&gt;Hello&amp;nbsp; kalandipaital1989,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did I misunderstand your original post?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Should the lisp routine only run on one machine one at time?&lt;/P&gt;
&lt;P&gt;&amp;nbsp; Should the lisp routine only run when the specific User and Computer name matches the list?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Scott&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jan 2019 09:46:24 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8552351#M93558</guid>
      <dc:creator>Scottu2</dc:creator>
      <dc:date>2019-01-27T09:46:24Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8552491#M93559</link>
      <description>&lt;P&gt;Hello &lt;A id="link_12" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/52747" target="_self"&gt;&lt;SPAN class=""&gt;Moshe-A,&lt;/SPAN&gt;&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Nice function. Could you combine it with a password function?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class=""&gt;Thanks in advance.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 27 Jan 2019 13:07:17 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8552491#M93559</guid>
      <dc:creator>dani-perez</dc:creator>
      <dc:date>2019-01-27T13:07:17Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8554825#M93560</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dear Sir,&lt;/P&gt;
&lt;P&gt;I am not professional of lisp programmer.&lt;/P&gt;
&lt;P&gt;your program in use lisp middle position,i am trying your program but not working.&lt;/P&gt;
&lt;P&gt;please share me easy type use program (program starting use another program ending use)&lt;/P&gt;
&lt;P&gt;Please share me sir.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jan 2019 16:48:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8554825#M93560</guid>
      <dc:creator>Gaganpatel</dc:creator>
      <dc:date>2019-01-28T16:48:06Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8555164#M93561</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5738838"&gt;@Gaganpatel&lt;/a&gt;&amp;nbsp; hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;this code is only sample of what you can do, how do you expect to take it from here if you do not have autolisp programming skill?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;you do aware that this protection is base on user login name plus computer name - yes?&lt;/P&gt;
&lt;P&gt;then how can i give you specific help if up to this point you didn't think to provide these details and i even do not know what is the lisp program you want to protect?!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here is an update code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;FONT color="#0000FF"&gt;(defun sp:user_validate ()
 (vl-some
   '(lambda (AllowedUserName AllowedComputername)
      (and
        (eq (strcase (getenv "UserName"))     (strcase AllowedUserName))
        (eq (strcase (getenv "ComputerName")) (strcase AllowedComputerName))
      )
   )
   '("Sandip" 	     "Joe"     "Sandy")	      ; allowed user names
   '("Sandip-Paital" "Joe-w10" "Sandy-w10")   ; allowed computer names
 ); vl-some
); user_validate
&lt;/FONT&gt;

(defun c:tagins ()
 &lt;FONT color="#0000FF"&gt;(if (not (sp:user_validate))
  (prompt "\nCommand is Locked.")
  (progn&lt;/FONT&gt; 
   (if (null (tblsearch "layer" "tags")) 
    (command "._layer" "_make" "tags" "_color" 3 "tags" "")
   ); if
  
   (command-s ".insert" "b-tag")
&lt;FONT color="#0000FF"&gt;  ); progn
 ); if&lt;/FONT&gt;
); tagins 
&lt;/PRE&gt;</description>
      <pubDate>Mon, 28 Jan 2019 18:56:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8555164#M93561</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2019-01-28T18:56:10Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8556958#M93562</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Dear Sir,&lt;/P&gt;
&lt;P&gt;suppose one lisp file inner four types of program use.&lt;/P&gt;
&lt;P&gt;How to use your lisp locking program.&lt;/P&gt;
&lt;P&gt;Please share process.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 04:04:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8556958#M93562</guid>
      <dc:creator>Gaganpatel</dc:creator>
      <dc:date>2019-01-29T04:04:20Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8557037#M93563</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5738838"&gt;@Gaganpatel&lt;/a&gt;&amp;nbsp;wrote:&amp;nbsp;&lt;SPAN style="color: #0000ff; font-family: inherit;"&gt;suppose one lisp file inner four types of program use.&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;i do not understand what that means?&lt;/P&gt;
&lt;P&gt;and if what have i gave you is not helping than i can not help more - sorry&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 05:53:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8557037#M93563</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2019-01-29T05:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8557169#M93564</link>
      <description>&lt;P&gt;Dear Sir,&lt;/P&gt;
&lt;P&gt;My Computer Name-Paital&lt;/P&gt;
&lt;P&gt;Please see the lisp program and your lisp locking program use this program.&lt;/P&gt;
&lt;P&gt;Please help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(vl-load-com)&lt;BR /&gt;(defun C:DimSum (/ i n sumtxt ss sn dobj mea ovr OldVars VarList)&lt;BR /&gt;(setq&lt;BR /&gt;i 0&lt;BR /&gt;n -1&lt;BR /&gt;sumtxt "" ; initially empty string&lt;BR /&gt;); setq&lt;BR /&gt;(if (setq ss (ssget '((0 . "DIMENSION"))))&lt;BR /&gt;(progn ; then&lt;BR /&gt;(while (setq sn (ssname ss (setq n (1+ n))))&lt;BR /&gt;(setq&lt;BR /&gt;dobj (vlax-ename-&amp;gt;vla-object sn)&lt;BR /&gt;i ; accumulating total&lt;BR /&gt;(+&lt;BR /&gt;i ; total so far&lt;BR /&gt;(setq mea ; measurement of this Dimension&lt;BR /&gt;(if (= (setq ovr (vla-get-TextOverride dobj)) ""); no override&lt;BR /&gt;(vla-get-measurement dobj); then -- measured length&lt;BR /&gt;(if (wcmatch ovr "&amp;lt;&amp;gt;*"); else [override] -- just real measurement with suffix [of either kind]?&lt;BR /&gt;(vla-get-measurement dobj); then -- measured length&lt;BR /&gt;(distof ; else -- numerical equivalent of override&lt;BR /&gt;(substr ovr 1 ; start at beginning&lt;BR /&gt;(vl-string-search&lt;BR /&gt;(if (wcmatch ovr "*%*") "%" "\\"); plus-or-minus vs. new-line&lt;BR /&gt;ovr&lt;BR /&gt;); vl-string-search&lt;BR /&gt;); substr&lt;BR /&gt;); distof&lt;BR /&gt;); if [real-with-suffix vs. forced]&lt;BR /&gt;); if [no-override vs. override]&lt;BR /&gt;); setq &amp;amp; mea&lt;BR /&gt;); + &amp;amp; i&lt;BR /&gt;sumtxt (strcat sumtxt (rtos mea 2 4) "\\P"); add line to Mtext content&lt;BR /&gt;); setq&lt;BR /&gt;); while&lt;BR /&gt;(if (&amp;gt; i 0)&lt;BR /&gt;(progn ; then&lt;BR /&gt;(prompt (strcat "\nTotal measuremnts : &amp;lt; " (rtos i 2 4) " &amp;gt; ."))&lt;BR /&gt;(setq OldVars (mapcar 'getvar (setq VarList '(cmdecho clayer))))&lt;BR /&gt;(setvar 'cmdecho 0)&lt;BR /&gt;(command "_.layer" "_make" "DimSums" "_plot" "_no" "" "")&lt;BR /&gt;(entmake&lt;BR /&gt;(list&lt;BR /&gt;'(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText")&lt;BR /&gt;'(8 . "DimSums"); Layer&lt;BR /&gt;(cons 10 (getvar 'viewctr)); insertion point&lt;BR /&gt;'(40 . 12); height&lt;BR /&gt;'(41 . 0.0); ref. rectangle width&lt;BR /&gt;'(71 . 1); top-left justification&lt;BR /&gt;'(72 . 5); direction by Style&lt;BR /&gt;(cons 1 (strcat sumtxt "total = " (rtos i 2 4))); content&lt;BR /&gt;'(7 . "STANDARD"); Style&lt;BR /&gt;'(50 . 0.0); rotation&lt;BR /&gt;); list&lt;BR /&gt;); entmake&lt;BR /&gt;(command "_move" "_last" "" (getvar 'viewctr) pause)&lt;BR /&gt;(mapcar 'setvar VarList OldVars)&lt;BR /&gt;); progn&lt;BR /&gt;); if&lt;BR /&gt;); progn&lt;BR /&gt;(prompt "\nNo Dimension(s) selected."); else&lt;BR /&gt;); if&lt;BR /&gt;(princ)&lt;BR /&gt;); defun&lt;/P&gt;</description>
      <pubDate>Tue, 29 Jan 2019 07:39:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8557169#M93564</guid>
      <dc:creator>Gaganpatel</dc:creator>
      <dc:date>2019-01-29T07:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8558822#M93565</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5738838"&gt;@Gaganpatel&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&lt;FONT color="#0000FF"&gt;My Computer Name-&lt;/FONT&gt;&amp;nbsp;&lt;FONT color="#FF0000"&gt;Paital&lt;/FONT&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;computer name is not enough a login name is also needed.&lt;/P&gt;
&lt;P&gt;so in code i painted the login name + computer name to red if your login name is not sandip? then you should change it to the exact login name.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;remember:&lt;/P&gt;
&lt;P&gt;the login name + computer name that appears in list are allowed to run the lisp&lt;/P&gt;
&lt;P&gt;i do not know if your lisp is working and did not test it either.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;cheers&lt;/P&gt;
&lt;P&gt;moshe&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun sp:user_validate ()
 (vl-some
   '(lambda (AllowedUserName AllowedComputername)
      (and
        (eq (strcase (getenv "UserName"))     (strcase AllowedUserName))
        (eq (strcase (getenv "ComputerName")) (strcase AllowedComputerName))
      )
   )
   '("&lt;FONT color="#FF0000"&gt;Sandip&lt;/FONT&gt;"  "Joe"     "Sandy")	; allowed user names
   '("&lt;FONT color="#FF0000"&gt;Paital&lt;/FONT&gt;"  "Joe-w10" "Sandy-w10")   ; allowed computer names
 ); vl-some
); user_validate

(vl-load-com)
(defun dimension_sum (/ i n sumtxt ss sn dobj mea ovr OldVars VarList)
(setq
i 0
n -1
sumtxt "" ; initially empty string
); setq
(if (setq ss (ssget '((0 . "DIMENSION"))))
(progn ; then
(while (setq sn (ssname ss (setq n (1+ n))))
(setq
dobj (vlax-ename-&amp;gt;vla-object sn)
i ; accumulating total
(+
i ; total so far
(setq mea ; measurement of this Dimension
(if (= (setq ovr (vla-get-TextOverride dobj)) ""); no override
(vla-get-measurement dobj); then -- measured length
(if (wcmatch ovr "&amp;lt;&amp;gt;*"); else [override] -- just real measurement with suffix [of either kind]?
(vla-get-measurement dobj); then -- measured length
(distof ; else -- numerical equivalent of override
(substr ovr 1 ; start at beginning
(vl-string-search
(if (wcmatch ovr "*%*") "%" "\\"); plus-or-minus vs. new-line
ovr
); vl-string-search
); substr
); distof
); if [real-with-suffix vs. forced]
); if [no-override vs. override]
); setq &amp;amp; mea
); + &amp;amp; i
sumtxt (strcat sumtxt (rtos mea 2 4) "\\P"); add line to Mtext content
); setq
); while
(if (&amp;gt; i 0)
(progn ; then
(prompt (strcat "\nTotal measuremnts : &amp;lt; " (rtos i 2 4) " &amp;gt; ."))
(setq OldVars (mapcar 'getvar (setq VarList '(cmdecho clayer))))
(setvar 'cmdecho 0)
(command "_.layer" "_make" "DimSums" "_plot" "_no" "" "")
(entmake
(list
'(0 . "MTEXT") '(100 . "AcDbEntity") '(100 . "AcDbMText")
'(8 . "DimSums"); Layer
(cons 10 (getvar 'viewctr)); insertion point
'(40 . 12); height
'(41 . 0.0); ref. rectangle width
'(71 . 1); top-left justification
'(72 . 5); direction by Style
(cons 1 (strcat sumtxt "total = " (rtos i 2 4))); content
'(7 . "STANDARD"); Style
'(50 . 0.0); rotation
); list
); entmake
(command "_move" "_last" "" (getvar 'viewctr) pause)
(mapcar 'setvar VarList OldVars)
); progn
); if
); progn
(prompt "\nNo Dimension(s) selected."); else
); if
); defun


(defun c:dimsum ()
 (if (not (sp:user_validate))
  (prompt "\nCommand is Locked.")
  (dimension_sum) 
 ); if
 (princ)
) 

&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Jan 2019 17:48:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8558822#M93565</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2019-01-29T17:48:34Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8559756#M93566</link>
      <description>This looks better - not woven into the program as you showed earlier.&lt;BR /&gt;[I would have used (exit), which otherwise I would never use]&lt;BR /&gt;&lt;BR /&gt;Other possible solutions:&lt;BR /&gt;a) Registry key initiated into the workstation by the proprietor [can be a time bomb].&lt;BR /&gt;b) (if (not (and (load (findfile "CheckName.fas")) (CheckName "&amp;lt;LoginName&amp;gt;" "&amp;lt;ComputerName&amp;gt;")))&lt;BR /&gt;      (progn (alert "Command is locked.") (exit))&lt;BR /&gt;     );if&lt;BR /&gt;&lt;BR /&gt;untested.&lt;BR /&gt;&lt;BR /&gt;???&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Jan 2019 23:48:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8559756#M93566</guid>
      <dc:creator>scot-65</dc:creator>
      <dc:date>2019-01-29T23:48:10Z</dc:date>
    </item>
    <item>
      <title>Re: lisp file locking</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8559910#M93567</link>
      <description>&lt;P&gt;This appears to be a menu option, one lisp file with 4 programs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/5738838" target="_blank"&gt;@kalandipaital1989&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;wrote:&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN&gt;suppose one lisp file inner four types of program use.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;This program will add dimensions&amp;nbsp;and place the result on a different layer.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Enter Password: xxx&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if xxxx = "111" then run program1&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if xxxx = "222" then run program2&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if xxxx = "33" then run program3&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;if xxxx = "44" then run program4&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jan 2019 01:40:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/lisp-file-locking/m-p/8559910#M93567</guid>
      <dc:creator>Scottu2</dc:creator>
      <dc:date>2019-01-30T01:40:59Z</dc:date>
    </item>
  </channel>
</rss>

