TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Ron Heigh on July 01, 2004, 01:33:25 PM

Title: username via lisp???
Post by: Ron Heigh on July 01, 2004, 01:33:25 PM
Is there any way to get the username of the computer using LISP?
Title: username via lisp???
Post by: MP on July 01, 2004, 01:36:20 PM
perhaps (getenv "username")
Title: username via lisp???
Post by: Slim© on July 01, 2004, 01:38:29 PM
Or maybe (getvar "loginname")
Title: username via lisp???
Post by: JohnK on July 01, 2004, 01:48:26 PM
Or even (getstring "\nWhat's your name dummy? ")
Title: username via lisp???
Post by: Ron Heigh on July 01, 2004, 01:51:18 PM
Thanks Lance.
That's what I was looking for.
Title: username via lisp???
Post by: Slim© on July 01, 2004, 01:52:59 PM
It's what we're here for, enjoy.
Title: username via lisp???
Post by: JohnK on July 01, 2004, 01:53:08 PM
*Bahhp?!* Dude, what's wrong with mine?!
Title: username via lisp???
Post by: Slim© on July 01, 2004, 01:54:07 PM
I like it, Se7en. Don't know about the others tho.  :twisted:
Title: username via lisp???
Post by: JohnK on July 01, 2004, 01:59:50 PM
Thanx Lance. Since you like it so much i wrote you a little app you can use in your programs.

Code: [Select]
(defun test ()
  (if
    (not
      (eq
        (getenv "username") (getstring "\nWhat's your name dummy? ")))
    (progn (alert "Liar!!") (test)))
  (princ)
  )
Title: username via lisp???
Post by: Anonymous on July 01, 2004, 06:46:31 PM
Quote from: Se7en
Or even (getstring "\nWhat's your name dummy? ")


LOL
Title: username via lisp???
Post by: Slim© on July 01, 2004, 07:03:26 PM
Thanks alot Se7en.
Title: username via lisp???
Post by: Ron Heigh on July 02, 2004, 11:01:11 AM
(getenv "username") = nil

This isn't set on my computer.  How do I use it?[/code]
Title: username via lisp???
Post by: nivuahc on July 02, 2004, 11:18:54 AM
Try

(getvar "loginname")
Title: username via lisp???
Post by: Mark on July 02, 2004, 11:25:16 AM
Maybe this;
Code: [Select]

(if (not (getenv "username"))
  (setenv "username" "name")
)
Title: username via lisp???
Post by: LUCAS on July 05, 2004, 12:42:27 AM
Code: [Select]

(defun C:TT (/ WS)
  (vl-load-com)
  (setq WS (vlax-create-object "wscript.network"))
  (alert
    (strcat "USERNAME= "
   (vlax-get-property WS 'USERNAME)
   "\n\nUSERDOMAIN= "
   (vlax-get-property WS 'USERDOMAIN)
   "\n\nCOMPUTERNAME= "
   (vlax-get-property WS 'COMPUTERNAME)
    )
  )
  (vlax-release-object WS)
  (princ)
)