Page 1 of 1 1
Topic Options
#23782 - 2002-06-24 10:47 PM does anyone know how to use @IPADDRESSx macro
eepo Offline
Fresh Scripter

Registered: 2002-06-21
Posts: 8
I'm having a bit of difficulty figuring out the syntax for the @IPADDRESSx macro.

I need to map drives based on IP subnets.

I'm doing a test with a client machine and this is what I have so far:

IF IPAddress0 = 10.34.68.125 (client IP address)
USE Y: "\\SERVER\SHARE"
ENDIF

However, I'm not getting any mappings eventhough the condition is true.
I'm wondering if I have to declare variables and
and assign IPAddress0 to the variable. Any ideas ???

Top
#23783 - 2002-06-24 10:48 PM Re: does anyone know how to use @IPADDRESSx macro
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
Macros must have the @ in front
@IPADDRESS0

Brian

Top
#23784 - 2002-06-24 10:54 PM Re: does anyone know how to use @IPADDRESSx macro
eepo Offline
Fresh Scripter

Registered: 2002-06-21
Posts: 8
Brian,

I do have the @ in front. sorry, that's a typo
on the board. This is what I have:

IF @IPADDRESS0 = 10.34.68.125
USE Y: "\\SERVER\SHARE"
ENDIF

and it doesn't work.

Top
#23785 - 2002-06-24 10:58 PM Re: does anyone know how to use @IPADDRESSx macro
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
The @IPAddress0 macro pads with spaces and returns a string. Your if statement is incorrect because one the IP address needs quotes around it and two the your IP returned from the macro is " 10. 34. 68.125".

Check out CalcLogicalSubnet() and some other UDFs in the UDF Libraryt that assist with subnet determination.

[ 25 June 2002, 00:41: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#23786 - 2002-06-24 10:59 PM Re: does anyone know how to use @IPADDRESSx macro
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
eepo,
the 0 one has syntax of
xxx.xxx.xxx.xxx
which means, that if you have address without all three numbers xxx you need a leading space like
xxx. xx.xxx.xxx

so your code would be:

IF @IPADDRESS0 = " 10. 34. 68.125"
USE Y: "\\SERVER\SHARE"
ENDIF



cheers,
_________________________
!

download KiXnet

Top
#23787 - 2002-06-25 12:07 AM Re: does anyone know how to use @IPADDRESSx macro
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
eepo,

You should be able to do the following:

code:
; Get the User's IP Address and trim appropriately
;*************************************************************************************
;LTRIM - TRIM THE LEADING SPACES FROM A STRING
;SUBSTR - RETURNS PART OF STRING: START POSITION, LENGTH
$1st = LTRIM(SUBSTR(@ipaddress0, 1, 3)) ; #ip#
$2nd = LTRIM(SUBSTR(@ipaddress0, 5, 3)) ; #ip# Get the IP# and assign it to $ipadr
$3rd = LTRIM(SUBSTR(@ipaddress0, 9, 3)) ; #ip#
$4th = LTRIM(SUBSTR(@ipaddress0, 13, 3)) ; #ip#
$ipadr = "$1ST.$2ND.$3RD.$4TH" ; #ip#

BTW, This is in the FAQ Section under - IP Address trimming.

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#23788 - 2002-06-25 12:21 AM Re: does anyone know how to use @IPADDRESSx macro
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
An lot of verbage for a missing space... [Roll Eyes]

OK... and one @ and two "

[ 25 June 2002, 00:22: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
2 registered (morganw, mole) and 414 anonymous users online.
Newest Members
gespanntleuchten, DaveatAdvanced, Paulo_Alves, UsTaaa, xxJJxx
17864 Registered Users

Generated in 0.054 seconds in which 0.023 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org