eepo
(Fresh Scripter)
2002-06-24 10:47 PM
does anyone know how to use @IPADDRESSx macro

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 ???


BrianTX
(Korg Regular)
2002-06-24 10:48 PM
Re: does anyone know how to use @IPADDRESSx macro

Macros must have the @ in front
@IPADDRESS0

Brian


eepo
(Fresh Scripter)
2002-06-24 10:54 PM
Re: does anyone know how to use @IPADDRESSx macro

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.


Howard Bullock
(KiX Supporter)
2002-06-24 10:58 PM
Re: does anyone know how to use @IPADDRESSx macro

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 ]


LonkeroAdministrator
(KiX Master Guru)
2002-06-24 10:59 PM
Re: does anyone know how to use @IPADDRESSx macro

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,


Kdyer
(KiX Supporter)
2002-06-25 12:07 AM
Re: does anyone know how to use @IPADDRESSx macro

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


Les
(KiX Master)
2002-06-25 12:21 AM
Re: does anyone know how to use @IPADDRESSx macro

An lot of verbage for a missing space... [Roll Eyes]

OK... and one @ and two "

[ 25 June 2002, 00:22: Message edited by: LLigetfa ]