Visual LISP, AutoLISP and General Customization

Reply
*DaveS
Message 11 of 20 (173 Views)

Re:

12-10-2003 10:56 PM in reply to: *Mark
Sorry about that name thingy...

HAve fun,
Dave
*Smith, Thomas
Message 12 of 20 (173 Views)

Re:

12-11-2003 12:56 AM in reply to: *Mark
This Value will only work for statis IP addresses...
The Value I used is for dynamic addresses...
You might want to check & see if it's 0.0.0.0 & read the other one...
Try this...
Let me know if it works for you...
It returns my DhcpIPAddress...

(defun C:GIP (/ rkey ipAddy)
(setq rkey
"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\
\Interfaces\\")
(if (= (setq ipAddy (cadr (vl-registry-read (strcat rkey (car
(vl-registry-descendents rkey))) "IpAddress"))) "0.0.0.0")
(vl-registry-read (strcat rkey (car (vl-registry-descendents rkey)))
"DhcpIPAddress")
ipAddy)
)





"Mark" wrote in message
news:21DC7D603584486D6DFEAB172E7A76EC@in.WebX.maYIadrTaRb...
>
> with your help i was able to create this code,
> can anybody in this ng check if it
> works with any os/ system with a network card,
> also how to tell which, if there are multiple cards
> thanks
>
> (defun C:GIP (/ rkey)
> (setq rkey
>
"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\
\Interfaces\\")
> (cadr (vl-registry-read (strcat rkey (car (vl-registry-descendents
rkey))) "IpAddress")) )
>
>
> "Mark" wrote in message
news:B93E4EAF0F0DE5EC9AB7A2D6D5E56410@in.WebX.maYIadrTaRb...
> >
> > hello all
> >
> > is there a way to get the ip address
> > of a computer thru the registry
> > programatically (no dos-lib please)
> >
> > TIA
> > mark
> >
> >
>
>
*DaveS
Message 13 of 20 (173 Views)

Re:

12-11-2003 01:17 AM in reply to: *Mark
Command: gip
; error: bad argument type: stringp nil


hAVE FUN,
dAVE

"Thomas Smith" wrote:
> SNIP <
> Try this...
> Let me know if it works for you...
> It returns my DhcpIPAddress...
>
> SNIP <
*Smith, Thomas
Message 14 of 20 (173 Views)

Re:

12-11-2003 01:58 AM in reply to: *Mark
It wasn't a code problem... It's a formatting problem...
The newsgroup reformatted my text...

See the attachment to load it the way I wrote it.

Sorry about that.


"DaveS" wrote in message
news:E45ECB2751C850A69EF23AE1CCC690BE@in.WebX.maYIadrTaRb...
> Command: gip
> ; error: bad argument type: stringp nil
>
>
> hAVE FUN,
> dAVE
>
> "Thomas Smith" wrote:
> > SNIP <
> > Try this...
> > Let me know if it works for you...
> > It returns my DhcpIPAddress...
> >
> > SNIP <
>
>
*DaveS
Message 15 of 20 (173 Views)

Re:

12-11-2003 02:27 AM in reply to: *Mark
"Thomas Smith" wrote:
> It wasn't a code problem... It's a formatting problem...
> The newsgroup reformatted my text...
>
> See the attachment to load it the way I wrote it.
>
> Sorry about that.
>
>
> sinp <

I had to reverse this list before it would work here. Like this:

(car (reverse (vl-registry-descendents rkey)))


Have fun,
Dave
*Smith, Thomas
Message 16 of 20 (173 Views)

Re:

12-11-2003 03:57 AM in reply to: *Mark
Hm...
That would seem to mean that the registry structure isn't exactly the same
there...
I know that the key we're grabbing there won't be the same for everyone, so
we're probably looking at something a little more complicated to get it...
Give me a little bit to find a few spare minutes to write it up...
Done...

Give this one a try...
It'a a little conveluded, but it should work for you... (I hope)...
I'm taking a few assumptions with this one...
I've got multiple entries under the "interfaces" key & I'm assuming that
the Ethernet connection always has a value for
"IPAutoconfigurationAddress"...
Another problem with this is if the PC has multiple Ethernet cards, this
will only
catch one of them...

Anyhow, assuming I'm right on the above assumption this would cover
MOST people's set-ups.

Let me know if this doesn't work for you.

Thomas

"DaveS" wrote in message
news:969EB77369D8CAFFD2C755E2399E028B@in.WebX.maYIadrTaRb...
>
> I had to reverse this list before it would work here. Like this:
>
> (car (reverse (vl-registry-descendents rkey)))
> snip<
*Gump, F.
Message 17 of 20 (173 Views)

Re:

12-11-2003 03:57 AM in reply to: *Mark
works for me.

"Thomas Smith" wrote in message
news:A4EF0461E498F6E0B6945AD6F7B70148@in.WebX.maYIadrTaRb...
> Hm...
> That would seem to mean that the registry structure isn't exactly the same
> there...
> I know that the key we're grabbing there won't be the same for everyone,
so
> we're probably looking at something a little more complicated to get it...
> Give me a little bit to find a few spare minutes to write it up...
> Done...
>
> Give this one a try...
> It'a a little conveluded, but it should work for you... (I hope)...
> I'm taking a few assumptions with this one...
> I've got multiple entries under the "interfaces" key & I'm assuming that
> the Ethernet connection always has a value for
> "IPAutoconfigurationAddress"...
> Another problem with this is if the PC has multiple Ethernet cards, this
> will only
> catch one of them...
>
> Anyhow, assuming I'm right on the above assumption this would cover
> MOST people's set-ups.
>
> Let me know if this doesn't work for you.
>
> Thomas
>
> "DaveS" wrote in message
> news:969EB77369D8CAFFD2C755E2399E028B@in.WebX.maYIadrTaRb...
> >
> > I had to reverse this list before it would work here. Like this:
> >
> > (car (reverse (vl-registry-descendents rkey)))
> > snip<
>
>


----------------------------------------------------------------------------
----




(defun C:GIP (/)
(setq rkey
"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\
\Interfaces\\")
(setq keyList (vl-registry-descendents rkey))

(setq tmpInt (length keyList))
(setq ipAddy nil)
(while (and (>= (setq tmpInt (1- tmpInt)) 0) (not ipAddy))
(setq tmpKey (strcat rkey (nth tmpInt keyList)))
(setq tmpValue (vl-registry-read tmpKey "IPAutoconfigurationAddress"))
(if tmpValue
(if (wcmatch tmpValue "*\.*\.*\.*")
(setq ipAddy (cadr (vl-registry-read tmpKey "IPAddress"))))))

(if (not ipAddy)
(progn
(alert "Couldn't find an Ethernet connection with an assigned IP
address!")
(exit)))

(if (= ipAddy "0.0.0.0")
(setq ipAddy (vl-registry-read tmpKey "DhcpIpAddress"))
ipAddy)
)
*DaveS
Message 18 of 20 (173 Views)

Re:

12-11-2003 04:04 AM in reply to: *Mark
Looks like a winner!! :smileysurprised:)

Have fun,
Dave
*Smith, Thomas
Message 19 of 20 (173 Views)

Re:

12-11-2003 04:08 AM in reply to: *Mark
yeah!!!


"DaveS" wrote in message
news:f1a535a.16@WebX.maYIadrTaRb...
> Looks like a winner!! :smileysurprised:)
>
> Have fun,
> Dave
>
>
Active Contributor
scotts
Posts: 30
Registered: ‎07-25-2008
Message 20 of 20 (74 Views)

Re: Re:

12-14-2011 05:47 PM in reply to: *DaveS

Hi there!

 

So I'm using this same bit of script and it works like a charm for XP installs, but Windows 7 not so good.  It seems like it should work, but no go...  I tried browsing around to find an alternate solution but so far have been unsuccessful.  Any ideas?

 

-Scott

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community