<?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 crashing AutoCAD in AutoCAD Forum</title>
    <link>https://forums.autodesk.com/t5/autocad-forum/lisp-crashing-autocad/m-p/9058388#M126202</link>
    <description>&lt;P&gt;Great! The "(progn..." was what I needed!&lt;/P&gt;&lt;P&gt;So I have another issue... I'm trying to get this code to actually run and not load when opening a drawing. This is what I have right now.&lt;/P&gt;&lt;PRE&gt;(load "C:\\Users\\mcfoster1\\AppData\\Roaming\\Autodesk\\C3D 2019\\enu\\Support\\Individual LISP Routines\\Standards.lsp")

(defun c:enforcement ()
  (if (= (getvar 'dwgtitled) 0)
    (c:standardsetup)
    (progn (initget "Continue Cancel")
      (if (= "Continue" (getkword "\nRun Standard Set-up? [Continue/CAncel] &amp;lt;Cancel&amp;gt;: "))
	(c:standardsetup)
	(alert "\nStandards Not Loaded")
	)
      )
    )
  )
(c:enforcement)&lt;/PRE&gt;&lt;P&gt;I didn't have the "(defun c:enforcement ()" originally, but I thought that turning it into a defined function would allow me to run it with "(c:enforcement)".&lt;/P&gt;&lt;P&gt;Any advice with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
    <pubDate>Mon, 30 Sep 2019 23:38:41 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-09-30T23:38:41Z</dc:date>
    <item>
      <title>LISP crashing AutoCAD</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-crashing-autocad/m-p/9057806#M126199</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am working on a LISP program to run when opening a drawing to enforce standards. I found the following code (on a forum post; I can't remember where) to provide some control over whether or not the program runs if opening a new drawing or opening a previously saved drawing. I want it to automatically run when opening a new drawing and prompt user to decide whether&amp;nbsp;or not they want it to run when opening a previously saved drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a long (illness filled) weekend and can't remember where I left off, but when I went load this particular selection of code, the command line repeated "Initializing..." over and over again and AutoCAD then crashed. When I opened AutoCAD again it would crash once the program automatically ran at start-up. I removed the following code from the program, so I'm assuming the problem is somewhere in here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(if (= (getvar 'dwgtitled) 0)
  (c:standardsetup)
  ((initget "Continue Cancel")
    (if (= "Continue" (getkword "\nRun Standard Set-up? [COntinue/CAncel] &amp;lt;Cancel&amp;gt;: "))
      (if (or c:standardsetup (and (load "C:\\Users\\mcfoster1\\AppData\\Roaming\\Autodesk\\C3D 2019\\enu\\Support\\Individual LISP Routines\\Standard Set-up.lsp" nil) c:standardsetup))
	(c:standardsetup)
	(princ "\nc:standardsetup could not be defined.")
	)
      )
    )
  )&lt;/PRE&gt;&lt;P&gt;Is there something in this selection of code that I have wrong that would cause this crashing loop?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 19:01:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-crashing-autocad/m-p/9057806#M126199</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-30T19:01:22Z</dc:date>
    </item>
    <item>
      <title>Re: LISP crashing AutoCAD</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-crashing-autocad/m-p/9057824#M126200</link>
      <description>&lt;P&gt;Okay, so I may have figured it out... BUT I have a new problem, well not new, but one that I forgot about.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(if (= (getvar 'dwgtitled) 0)
  (c:standardsetup)
  ((initget "Continue Cancel")
    (if (= "Continue" (getkword "\nRun Standard Set-up? [COntinue/CAncel] &amp;lt;Cancel&amp;gt;: "))
      (if (or c:standardsetup (and (load "C:\\Users\\mcfoster1\\AppData\\Roaming\\Autodesk\\C3D 2019\\enu\\Support\\Individual LISP Routines\\Standard Set-up.lsp" nil) c:standardsetup))
	(c:standardsetup)
	(princ "\n&lt;FONT color="#FF0000"&gt;&lt;U&gt;&lt;STRONG&gt;c:standardsetup&lt;/STRONG&gt;&lt;/U&gt;&lt;/FONT&gt; could not be defined.")
	)
      )
    )
  )&lt;/PRE&gt;&lt;P&gt;I'm guessing that the "\nc:standardsetup..." doesn't quite work. I changed it to "\nStandard setup..."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So the other problem is that when I try it out and it prompts to "Continue" or "Cancel", it says "Invalid option keyword". Does this mean I can only have "Yes" and "No"? Or am I missing something?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 19:08:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-crashing-autocad/m-p/9057824#M126200</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-30T19:08:41Z</dc:date>
    </item>
    <item>
      <title>Re: LISP crashing AutoCAD</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-crashing-autocad/m-p/9057853#M126201</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I am working on a LISP program to run when opening a drawing to enforce standards. I found the following code (on a forum post; I can't remember where) to provide some control over whether or not the program runs if opening a new drawing or opening a previously saved drawing. I want it to automatically run when opening a new drawing and prompt user to decide whether&amp;nbsp;or not they want it to run when opening a previously saved drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I had a long (illness filled) weekend and can't remember where I left off, but when I went load this particular selection of code, the command line repeated "Initializing..." over and over again and AutoCAD then crashed. When I opened AutoCAD again it would crash once the program automatically ran at start-up. I removed the following code from the program, so I'm assuming the problem is somewhere in here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;(if (= (getvar 'dwgtitled) 0)
  (c:standardsetup)
  &lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;(progn (&lt;/STRONG&gt;&lt;/FONT&gt;initget "Continue Cancel")
    (if (= "Continue" (getkword "\nRun Standard Set-up? [COntinue/CAncel] &amp;lt;Cancel&amp;gt;: "))
      (if (or c:standardsetup (and (load "C:\\Users\\mcfoster1\\AppData\\Roaming\\Autodesk\\C3D 2019\\enu\\Support\\Individual LISP Routines\\Standard Set-up.lsp" nil) c:standardsetup))
	(c:standardsetup)
	(princ "\nc:standardsetup could not be defined.")
	)
      )
    )
  )&lt;/PRE&gt;&lt;P&gt;Is there something in this selection of code that I have wrong that would cause this crashing loop?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;I think that prompt part is working as it is... but for sake of insurance you should have the same capitals at (initget) as at prompt.&lt;/P&gt;&lt;P&gt;And also- it could be a bit simper:&lt;/P&gt;&lt;PRE&gt;(initget "Continue")
(if (getkword "\nRun Standard Set-up? [Continue] &amp;lt;cancel&amp;gt;: ")
  "Go"
  "Stop"))&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 19:31:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-crashing-autocad/m-p/9057853#M126201</guid>
      <dc:creator>johnyDFFXO</dc:creator>
      <dc:date>2019-09-30T19:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: LISP crashing AutoCAD</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-crashing-autocad/m-p/9058388#M126202</link>
      <description>&lt;P&gt;Great! The "(progn..." was what I needed!&lt;/P&gt;&lt;P&gt;So I have another issue... I'm trying to get this code to actually run and not load when opening a drawing. This is what I have right now.&lt;/P&gt;&lt;PRE&gt;(load "C:\\Users\\mcfoster1\\AppData\\Roaming\\Autodesk\\C3D 2019\\enu\\Support\\Individual LISP Routines\\Standards.lsp")

(defun c:enforcement ()
  (if (= (getvar 'dwgtitled) 0)
    (c:standardsetup)
    (progn (initget "Continue Cancel")
      (if (= "Continue" (getkword "\nRun Standard Set-up? [Continue/CAncel] &amp;lt;Cancel&amp;gt;: "))
	(c:standardsetup)
	(alert "\nStandards Not Loaded")
	)
      )
    )
  )
(c:enforcement)&lt;/PRE&gt;&lt;P&gt;I didn't have the "(defun c:enforcement ()" originally, but I thought that turning it into a defined function would allow me to run it with "(c:enforcement)".&lt;/P&gt;&lt;P&gt;Any advice with this?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Mon, 30 Sep 2019 23:38:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-crashing-autocad/m-p/9058388#M126202</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-09-30T23:38:41Z</dc:date>
    </item>
    <item>
      <title>Re: LISP crashing AutoCAD</title>
      <link>https://forums.autodesk.com/t5/autocad-forum/lisp-crashing-autocad/m-p/9060311#M126203</link>
      <description>&lt;P&gt;Well, it seems to be working now. I'm not sure why it wouldn't originally and now it does, but I came into work, started up AutoCAD and the lisp loaded AND ran when I opened a new drawing.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;</description>
      <pubDate>Tue, 01 Oct 2019 17:10:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/autocad-forum/lisp-crashing-autocad/m-p/9060311#M126203</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-10-01T17:10:07Z</dc:date>
    </item>
  </channel>
</rss>

