×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Lisp help

Lisp help

Lisp help

(OP)
Hi gang

I am trying to write a simple lisp program that will check the system variable LOGINNAME and if the returned variable is a certain user then to write and ALERT command to screen.

I think something like this (although I do not know anything about lisp), but its not working:

(defun C:message ()
(setvar "cmdecho" 0)
(if (= loginname “DAVID” )
    (ALERT"HELLO DAVID")
  )
 (princ)
)


There is a point to this program and any help is apreciated.

Regards

The Welshman

RE: Lisp help

Hello Welshman,
I think here is your problem:

(if (= (getvar "loginname") "DAVID")
    (alert "HELLO DAVID")
  )

RE: Lisp help

(if (= (getvar loginname) “DAVID” )

RE: Lisp help

Hi...

(defun c:login (/ name)
  (setq name (getstring t "\nName?: "))
  (if (= name "")
    (setq name "@")
  )
  (if (= (getvar "loginname") name)
    (alert (strcat "Hello " name " good day"))
    (progn
      (alert "you are a stranger \"bye\"")
      (command "_.quit" "")
    )
  )
)

Un saludo de SpeedCAD... :)
CHILE

RE: Lisp help

(OP)
Hi guys

Many thanks for your help in this matter, sorry for the delay in replying.


Regards

The Welshman

RE: Lisp help

(OP)
Hi guys

Still no joy gettingmy loaded MESSAGE.LSP program to run from with in another lisp file.
Find below a copy of my ACADDOC.LSP file, it loads MESSAGE.LSP sucessfully but will not allow the lisp to run it, although if you type in MESSAGE at the command prompt it works, therefore, it must be loading.

(defun S::STARTUP()
(setvar "cmdecho" 0)
(command (load "O:\\architec\\acad2002\\templates\\message.lsp"))
(command "message")
)
)
(princ)


any ideas?

The Welshman

RE: Lisp help

Two questions:
1) Are this file succesfuly loaded? Check it in Tools->Application "Loaded Application" box.
2) Is there a string in "message.lsp":
(defun c:message())?
If yes, changed string (command "message") to (c:message) in your script should work properly.

Regards

RE: Lisp help

Hi...

If you want that the message appears every time that AutoCAD opens up, you believe a file called acad.lsp and you place it in the portfolio SUPPORT of AutoCAD.

Obviously the content of the file acad.lsp should contain what you want.

Un saludo de SpeedCAD... :)
CHILE

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources