if not lisp function

Discussion in 'AutoCAD' started by molokaiboy, Jul 30, 2003.

  1. molokaiboy

    molokaiboy Guest

    I am trying to create a lisp that will load only if the "poweruser" user is trying to access a command. If all other users try to access the command, it will show a msg box and not load the rest of the code. Here is what I have:

    (if (= (strcase (getvar "loginname")) "poweruser")
          (if (not (poweruser (load "msg3") ""))
    (command msg3)

    add error trap here

    ))



    Can anyone give me some tips as to how I would finish it.

    TIA

    Collin
     
    molokaiboy, Jul 30, 2003
    #1
  2. molokaiboy

    Kevin Nehls Guest

    Is this what you are looking for?

    (if (= (strcase (getvar "loginname")) "POWERUSER")
    (progn
    <do your stuff for the poweruser here>
    )
    ;;person is not poweruser and gets this
    (progn
    (load "msg3")
    (msg3)
    )
    )
    --
    Kevin Nehls


    is trying to access a command. If all other users try to access the command,
    it will show a msg box and not load the rest of the code. Here is what I
    have:
     
    Kevin Nehls, Jul 30, 2003
    #2
  3. molokaiboy

    molokaiboy Guest

    yes, this is close to what I want but just having this still allows for the rest of the code to load right? If so, how do I prevent the rest of the code from loading?

    TIA

    Collin
     
    molokaiboy, Jul 30, 2003
    #3
  4. molokaiboy

    molokaiboy Guest

    I tried the code and it only loads the error message. I would like to have the error pop up only if the user is not equal to the "poweruser" login.

    How do I do this?
    TIA

    Collin
     
    molokaiboy, Jul 30, 2003
    #4
  5. That is exactly what that code does.

    --

    -Jason
    Member of the Autodesk Discussion Forum Moderator Program


    login.
     
    Jason Piercey, Jul 30, 2003
    #5
  6. molokaiboy

    molokaiboy Guest

    Below is a copy of the code. Here is the error message that I get:

    ; error: no function definition: MSG3

    (defun C:MSG3()
    (ALERT "Access Denied! See Your System Administrator")
    )
    (princ)





    (defun logincheck (/)
    (if (= (strcase (getvar "loginname") t) "joe")
    &nbsp;&nbsp;(progn
    &nbsp;&nbsp;(load "insertreleased.lsp")
    &nbsp;&nbsp;(insertreleased)
    &nbsp;&nbsp;)
    &nbsp;&nbsp;;;person is not joe and gets this

    (progn

    ;(ALERT "Access Denied! See Your System Administrator")
    &nbsp;&nbsp;&nbsp;(load "MSG3")
    &nbsp;&nbsp;&nbsp;(MSG3)
    &nbsp;&nbsp;)
    )
    &nbsp;&nbsp;(princ)
    &nbsp;&nbsp;)
     
    molokaiboy, Jul 30, 2003
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.