Page 1 of 4 1234 LastLast
Results 1 to 10 of 31

Thread: Question on Lisp, trying to create a Warning Box.

  1. #1
    I could stop if I wanted to Dr._House's Avatar
    Join Date
    2007-07
    Location
    Milwaukee, WI
    Posts
    218
    Login to Give a bone
    0

    Default Question on Lisp, trying to create a Warning Box.

    My firm has asked that I create a warning when AutoCAD 2010 is opening saying something like "You are about to open AutoCAD 2010, are you sure you want to do this?" then have a Yes and No option with the Yes Option allowing it to open and the No option closing the program. Can anyone tell me IF this can be done, and if it can be done can you point me in the right direction? I have some basic lisp knowledge and can make an alert window pop up but not with the right buttons or actions. Help

  2. #2
    I could stop if I wanted to
    Join Date
    2004-12
    Location
    California
    Posts
    283
    Login to Give a bone
    0

    Default Re: Question on Lisp, trying to create a Warning Box.

    You can create a lisp with DCL code to start up the moment CAD finishes loading, and then just have it close CAD if they say no and stay open if they say yes (lisp to just close dialog and do nothing).

    Not sure if you can do it prior to opening with lisp. You may need to look into a script and/or batch routine to do that. Your IT guy should be able to help with this method.

  3. #3
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Question on Lisp, trying to create a Warning Box.

    This 'should' work.
    Put this code in your startup file, followed by (OpenCheck2010). You will need to replace the line in red with your "acadver". I'm in 2009, so I don't know the one for 2010.

    Code:
    (defun OpenCheck2010 ( / MyYesNo)
    ;----------------------------------------------------------------------------------------------------------
    ; Courtesy of http://web2.airmail.net/terrycad/Tutorials/MyDialogs.htm
    ; MyYesNo - Question dialog with one question line
    ; Arguments: 2
    ;   Title$ = Dialog Title
    ;   Question$ = Question line
    ; Syntax: (MyYesNo " My Yes No" "Do you like creating programs in AutoLISP?")
    ;----------------------------------------------------------------------------------------------------------
    (defun MyYesNo (Title$ Question$ / Answer$ Dcl_Id% Return#)
      ; Load Dialog
      (setq Dcl_Id% (load_dialog "MyDialogs.dcl"))
      (new_dialog "MyYesNo" Dcl_Id%)
      ; Set Dialog Initial Settings
      (set_tile "Title" Title$)
      (set_tile "Text1" Question$)
      ; Dialog Actions
      (action_tile "Yes" "(done_dialog 1)")
      (action_tile "No" "(done_dialog 0)")
      (setq Return# (start_dialog))
      ; Unload Dialog
      (unload_dialog Dcl_Id%)
      (if (= Return# 1)
        (setq Answer$ "Yes")
        (setq Answer$ "No")
      );if
      Answer$
    );defun MyYesNo
      
      (and (findfile "MyDialogs.dcl")
           (eq "your (getvar "acadver") here" (getvar "acadver"))
           (eq "No" (MyYesNo "AutoCAD v2010 Check" "You are about to open AutoCAD 2010, are you sure you want to do this?"))
           (if (zerop (getvar "dbmod"))
             (command "_.close")
             (command "_.close" "_yes")
             )
           )
      (princ)
      )
    This .dcl file must be in a supportpath also.


    This will, if matches version, prompt user for verification. If "Yes", drawing stays open, if "No" drawing is closed. I make no guarantees, very limited testing.
    Attached Files Attached Files
    Last edited by alanjt; 2009-09-10 at 08:02 PM.

  4. #4
    I could stop if I wanted to Dr._House's Avatar
    Join Date
    2007-07
    Location
    Milwaukee, WI
    Posts
    218
    Login to Give a bone
    0

    Default Re: Question on Lisp, trying to create a Warning Box.

    So by putting that in my "Startup" do you mean my ACADDOC.lsp file or whichever it was?

  5. #5
    I could stop if I wanted to Dr._House's Avatar
    Join Date
    2007-07
    Location
    Milwaukee, WI
    Posts
    218
    Login to Give a bone
    0

    Default Re: Question on Lisp, trying to create a Warning Box.

    Is this my ACADVER?

    ACADVER = "18.0s (LMS Tech)

    I don't mean to sound do ignorant.. but when it comes to programming I kinda am.. LOL

  6. #6
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Question on Lisp, trying to create a Warning Box.

    No problem.
    To your questions: yes and yes.

  7. #7
    I could stop if I wanted to Dr._House's Avatar
    Join Date
    2007-07
    Location
    Milwaukee, WI
    Posts
    218
    Login to Give a bone
    0

    Default Re: Question on Lisp, trying to create a Warning Box.

    (eq "18.0s" (getvar "acadver"))

    Is that line right then?

  8. #8
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Question on Lisp, trying to create a Warning Box.

    Quote Originally Posted by Dr._House View Post
    (eq "18.0s" (getvar "acadver"))

    Is that line right then?
    Replace the entire line with:
    Code:
    (eq 18.0 (atof (getvar "acadver")))

  9. #9
    I could stop if I wanted to Dr._House's Avatar
    Join Date
    2007-07
    Location
    Milwaukee, WI
    Posts
    218
    Login to Give a bone
    0

    Default Re: Question on Lisp, trying to create a Warning Box.

    Okay cool! Here goes a test!!

  10. #10
    AUGI Addict
    Join Date
    2008-02
    Posts
    1,141
    Login to Give a bone
    0

    Default Re: Question on Lisp, trying to create a Warning Box.

    Quote Originally Posted by Dr._House View Post
    Okay cool! Here goes a test!!
    <fingers crossed>

Page 1 of 4 1234 LastLast

Similar Threads

  1. Replies: 2
    Last Post: 2015-04-17, 04:00 PM
  2. Need help with LISP to create thread
    By stapelbergp675461 in forum AutoLISP
    Replies: 1
    Last Post: 2014-08-18, 01:09 PM
  3. Warning! Retreaded Noob question...
    By crbateman in forum AutoLISP
    Replies: 2
    Last Post: 2009-03-18, 02:54 PM
  4. Warning - Can't Create?
    By cadman6735 in forum Revit Architecture - General
    Replies: 0
    Last Post: 2008-10-21, 09:42 PM
  5. Warning: Could not create geometry for Space.
    By nosten in forum Revit MEP - General
    Replies: 2
    Last Post: 2008-09-30, 09:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •