#23782 - 2002-06-24 10:47 PM
does anyone know how to use @IPADDRESSx macro
|
eepo
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
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
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
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 ]
|
Top
|
|
|
|
#23787 - 2002-06-25 12:07 AM
Re: does anyone know how to use @IPADDRESSx macro
|
Kdyer
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
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
2 registered
(morganw, mole)
and 414 anonymous users online.
|
|
|