Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Lisp help

Status
Not open for further replies.

Welshman

Computer
Dec 16, 2002
28
0
0
GB
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
 
Replies continue below

Recommended for you

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
 
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
 
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
 
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
 
Status
Not open for further replies.
Back
Top