View Full Version : Retrieve Computer ID
Is there a way to get a computer's name from lsp? I've got the user's name with loginname, but I also need the computer's ID.
MarkTheSwampThomas
2004-06-08, 09:54 PM
I know DosLib will do it.
<qoute>
dos_computer
--------------------------------------------------------------------------------
Returns or sets the computer name of the current system. The name is established at system startup, when it is initialized from the Windows Registry. Changes to the computer name take effect the next time the system is started.
</qoute>
http://www.mcneel.com/doslib.htm
stig.madsen
2004-06-08, 11:22 PM
If you don't think it's overkill, you can get some info from the Windows WScript object:
(cond ((setq wscript (vlax-create-object "WScript.Network"))
(setq pcname (vlax-get-property wscript "ComputerName")
pcdom (vlax-get-property wscript "UserDomain")
pcuser (vlax-get-property wscript "UserName")
)
(mapcar 'princ
(list "\nComputername: " pcname
"\nUser domain: " pcdom
"\nUser name: " pcuser
)
)
(vlax-release-object wscript)
)
)
That's exactly what I'm looking for. Thanks Everyone!
stig.madsen
2004-06-08, 11:47 PM
You're welcome.
For some more on scripting objects, you can check out http://www.afralisp.com/lisp/script1.htm
MarkTheSwampThomas
2004-06-09, 12:35 PM
What about this:
(princ (getenv "COMPUTERNAME"))
stig.madsen
2004-06-09, 01:41 PM
Mark, you're a genius :)
why didn't I think of that ..
Mike.Perry
2004-06-09, 01:55 PM
why didn't I think of that ..
Hi Stig
<PublicMockingMode = On>
<PublicMockingMode = Off>
I couldn't be so cruel and publicly mock a LISP Jedi Master ;-) wouldn't want to experience the wrath further down the road when I require your help.
Cheers, Mike
MarkTheSwampThomas
2004-06-09, 01:55 PM
Mark, you're a genius :)
why didn't I think of that ..
I'm still trying to figure out why I didn't post that in the first place! *grin*
sdoman
2004-06-10, 05:16 AM
Stig,
I'm glad you posted how to access the wscript host and also the link to AfraLisp. I wasn't aware how easy it is to write code to access objects outside of AutoCAD. Also at AfraLisp, Kenny shows how to use wscript to get the hard disk serial number, which is something I've been looking for.
Thanks for posting!
stig.madsen
2004-06-10, 10:44 AM
sdoman, what do you mean 'Kenny shows.. '? Didn't you see the authors name? Hehe
Anyway, glad to have been of service..
sdoman
2004-06-10, 02:17 PM
Stig,
I just assumed everything on AftraLisp was by Kenny Mamage and didn't noticed your name as author of the article regarding scripting objects. Well then congratualations for writing such an interesting article. I'll be sure to pay better atttention to the name of the author from now on. <embarrassed>
stig.madsen
2004-06-10, 03:53 PM
Thanks. Don't worry about it, I was just pulling your .. what do you Americans say .. ummm .. something?
MarkTheSwampThomas
2004-06-10, 04:49 PM
Thanks. Don't worry about it, I was just pulling your .. what do you Americans say .. ummm .. something?
leg.........
stig.madsen
2004-06-10, 05:26 PM
......... leg
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.