TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Andrea on February 16, 2006, 11:26:49 AM

Title: Connection Name
Post by: Andrea on February 16, 2006, 11:26:49 AM
Hi all..

Is it possible to retreive the connection name vis LISP
like showed in FIELD option ?
Title: Re: Connection Name
Post by: whdjr on February 16, 2006, 11:32:01 AM
My spanish (I hope this is Spanish) is not good at all.
What is 'connection name'?  Is that like 'loginname'?

Maybe look at environment variables, 'getenv'.
Title: Re: Connection Name
Post by: sinc on February 16, 2006, 12:04:01 PM
My spanish (I hope this is Spanish) is not good at all.
Your French must not be very good either.   :-D

But I must admit I can't quite parse the question, either.

Are you trying to access the name of the current plot device from Lisp?
Title: Re: Connection Name
Post by: whdjr on February 16, 2006, 01:17:39 PM
Your French must not be very good either.   :-D

oops   :oops:
Title: Re: Connection Name
Post by: Andrea on February 16, 2006, 01:30:14 PM
OK...

Sorry...I have installed the English version of 2006 only to show you this screen... :laugh:

Note:
The "Andrea Andreetti" is my name....and not my LOGINNAME.
also, can i use the Field expression in lisp ?

Title: Re: Connection Name
Post by: whdjr on February 16, 2006, 01:46:31 PM
You can use the Field expression in lisp as long as you are supplying the expression for text input ie: mtext, text, attributes,..
Title: Re: Connection Name
Post by: Andrea on February 16, 2006, 03:04:40 PM
thanks...

But if i need to put     %<\AcVar Login \f "%tc4">%
in a variable.. ?

(setq var1 "%<\AcVar Login \f \"%tc4\">%")

!var1 = Andrea Andreetti  ?
Title: Re: Connection Name
Post by: whdjr on February 16, 2006, 04:21:42 PM
Andrea,

The reason it doesn't work is because of the " in the expression.  The command line is treating it like the end of a string.
Title: Re: Connection Name
Post by: vladimirzm on February 17, 2006, 01:46:35 AM
Your French must not be very good either.   :-D

oops   :oops:

Don't worry whdjr...

the Spanish version...  :-D :-D :-D
Title: Re: Connection Name
Post by: vladimirzm on February 17, 2006, 02:18:39 AM
I forgot to answer  :evil:

Andrea, You can get the current user name via Windows Script Host from Vlisp, exactly through the WScript.Network class:
Code: [Select]
(defun UserName (/ wsn)
  (setq wsn (vlax-create-object "WScript.Network"))
  (vlax-get-property wsn "UserName")
)

You could get the computer name and user domain too:
Code: [Select]
(defun PCdats (/ wsn un cn ud)
  (setq wsn (vlax-create-object "WScript.Network"))
  (setq un (vlax-get-property wsn "UserName")
cn (vlax-get-property wsn "ComputerName")
ud (vlax-get-property wsn "UserDomain")
  )
  (alert
    (strcat "User Name:\t" un
    "\nComputer Name:\t"cn
    "\nUser Domain:\t" ud
    )
  )
)
Title: Re: Connection Name
Post by: Andrea on February 17, 2006, 08:48:08 AM
Vladi....

thanks, but you code is showing me the LOGINNAME....
don't need that...

I need my real name.

I don'T know where AutoCAD take this.
 :-(