@IPADDRESS is text based and a messy way of mananging IP info..

This will convert the IP address string to a normal IP address without extra spaces.
 Code:
$MyIP = Join(Split(@IPADDRESS, ' '), '')
Now that you have an IP address, you can use one of several UDFs that can perform CIDR calculations and tell you which subnet that IP address belongs to. Once you know which subnet you are a member of, you can easily apply the "one or many" logic to create the MSDS shortcuts.

Here's some PseudoCode to give you an idea of how it works. First, you need a table of network subnet ranges in an array.
 Code:
$SiteSubnets = '192.168.0.0/22','192.168.4.0/23','192.168.6.0/23'
Note that this array aggregates the individual subnets at a site - the first has networks 0-3, the second 4-5, and the third 6-7. We aren't interested so much in the subnet but the SITE where the subnet exists! Here's some basic working code. You'll need the IsInSubnet UDF, either from KORG or my library.
 Code:
Call '\KixLib\IsInSubnet.udf'

; define the subnets at each site
$aSiteSubnets = '192.168.0.0/22','192.168.4.0/23','192.168.6.0/23'

; Define each of the URL strings
$aURLs = 'URL1', 'URL2', 'URL3'

; Define which URLs are assigned to each site. In this example, site 0 gets URL0, Site 1 gets URL 0 and 1, etc..
$aSiteURLs = '0', '0,1', '2'

; Eliminate spaces in the IP macro
$MyIP = Join(Split(@IPADDRESS0, ' '), '')



; Use a UDF to determine which subnet the current IP resides in.
$aMySite = isinsubnet($MyIP,$aSiteSubnets)


; If no error, get the Site ID
If Not @ERROR


 'My IP: ' $MyIP ?		; debug message

  $Site = AScan($aMySite, 1)

 'My Site ID: ' $Site ?		; debug message
 'URLs: ' $aSiteURLs[$Site] ?	; debug message

  $URL_List = Split($aSiteURLs[$Site], ',')
  For Each $Url in $URL_List
    $aURLs[$Url] ' is being defined' ?
    ; Use a UDF to create the shortcut to the URL
  Next
Else

  'IP is not in any Site network!' ?

EndIf
By using the UDF and sticking with CIDR calculations, you can aggregate subnets by site without lots of "InStr()" calls to test for each individual subnet.

BTW - Welcome to KORG!

Glenn
_________________________
Actually I am a Rocket Scientist! \:D