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
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
I think here is your problem:
(if (= (getvar "loginname") "DAVID")
(alert "HELLO DAVID")
)
RE: Lisp help
RE: Lisp help
(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
Many thanks for your help in this matter, sorry for the delay in replying.
Regards
The Welshman
RE: Lisp help
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
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
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