What you propose above is inflexible, and requires hard coding relative to your environment. This is rarely a good thing. The use of external data (arrays in my earlier example) eliminate those shortcomings. For example..

With two arrays (or a single, two-dimensional array) you create a relationship between a network and a printer to be used in that network. The computer has an IP address, and the InSubnet UDF basically answers the question "Is my IP address in this network?" If the answer is "yes", the printer paired with that network is mapped.

In the example script, there are 2 arrays (Network and Printer) with 3 elements each. The script enumerates (works its way through) each of the elements, asking "is my address in THIS network?" and maps the printer when the answer is yes. This sets the "Mapped" variable (flag) to 1 (true) so that we can later issue a warning that no printers were mapped.

I'm guessing you're having a hard time visualizing the relationship between the Network and Printer arrays.. Create an Excel spreadsheet - place the numbers 0-2 in column A, the network/mask values in column B, and the printer UNC paths in column C. When the script enumerates this list, it's like highlighting Row 1 (element 0), asking "is my ip in the range defined in column B? If so, map the printer defined in column C. Get it?

Here's an alternative - a bit more flexible.. It uses an INI file to define the mappings - each line in the INI file contains a complete reference:
 Code:
SiteName=network/mask,\\server\Printer

The script and a sample INI file (using the same example networks as before) follow:
 Code:
Break On
; Uses an INI file for subnet/printer mapping
; The INI file in this example is called NetPrint.ini, and uses one section
; called MAPPINGS. Each value consists of a comma-delimited pair of data
; representing the network/mask and printer share UNC in the format
; sitename=w.x.y.z/mask,\\server\printer


$Mapped = 0					; value showing that printer was not mapped

$MyIP = Join(Split(@IPADDRESS0, ' '), '')	; Get the local IP address, removing spaces

; Load an array from the INI file
$Mappings = EnumIni('.\netprint.ini', 'MAPPINGS')

For Each $SiteName in $Mappings

  ; create a 2-element array by splitting the data at the comma
  ; element 0 contains the network/mask, and element 1 contains the printer UNC
  $NetPrint = Split(ReadProfileString('.\netprint.ini', 'MAPPINGS', $SiteName), ',')

  ; see if the local IP is inside the network
  If InSubnet($MyIP, $NetPrint[0])

    ; these print statements are for diagnostic/testing
    'My ip address (' $MyIP ') exists in the ' $SiteName ' site (' $NetPrint[0] ')' ?
    'Mapping printer ' $NetPrint[1] ?

    ; make the printer connection
    AddPrinterConnection($NetPrint[1])

    ; show that at least 1 printer mapped successfully
    If Not @ERROR
      $Mapped = 1
    EndIF

  EndIF

Next


If Not $Mapped
  'No printers were mapped!' ?
EndIf





; do not modify anything after this line!!!

;; 
;;====================================================================== 
;; 
;;FUNCTION       InSubnet() 
;; 
;;ACTION         Determines if a specific IP address is in a subnet 
;; 
;;AUTHOR         Glenn Barnas 
;; 
;;VERSION        1.0 / 2008/01/20 
;; 
;;SYNTAX         InSubnet(Address, Network) 
;; 
;;PARAMETERS     Address - REQUIRED, IP address in dotted-decimal (w.x.y.z) 
;; 
;;		 Network - REQUIRED, Network in CIDR format (w.x.y.z/mask) 
;; 
;;REMARKS         
;; 
;;RETURNS        1 if ip address is in the defined subnet, 0 otherwise 
;; 
;;DEPENDENCIES   none 
;; 
;;TESTED WITH    W2K, WXP, W2K3, Vista, X64 
;; 
;;EXAMPLES       If InSubnet('192.168.12.243', '192.168.8.0/21') 
;;		   'Is in subnet!' ? 
;;		 EndIf 
; 
Function InSubnet($_IPAddr, $_Network)
 
  Dim $_aAdd				; array of address values 
  Dim $_Mask				; Mask value 
  Dim $_Hosts				; hosts in subnet 
 
  ; Convert the supplied IP address to a double value representing the decimal address 
  $_aAdd = Split($_IPAddr, '.')
  $_IPAddr = (CDbl($_aAdd[0]) * 16777216.0) + (CDbl($_aAdd[1]) * 65536.0) + (CDbl($_aAdd[2]) * 256.0) + (CDbl($_aAdd[3]) * 1.0)
 
  ; Convert the network from a w.x.y.z/mask format to a decimal value 
  ; this is the starting network address value 
  $_Network = Split($_Network, '/')
  $_Mask = Val($_Network[1])
  $_aAdd = Split($_Network[0], '.')
  $_Network = (CDbl($_aAdd[0]) * 16777216.0) + (CDbl($_aAdd[1]) * 65536.0) + (CDbl($_aAdd[2]) * 256.0) + (CDbl($_aAdd[3]) * 1.0)
 
  ; Set the number of hosts in the defined network 
  $_Hosts = 1.0
  For $_I = 31 to $_Mask Step -1
    $_Hosts = ($_Hosts * 2.0)
  Next
 
  ; return the value  
  $InSubnet = 0
  If $_IPAddr >= $_Network And $_IPAddr < ($_Network + $_Hosts)
    $InSubnet = 1
  EndIf
 
  Exit 0
 
EndFunction
 



;; 
;;====================================================================== 
;; 
;;FUNCTION       EnumIni() 
;; 
;;ACTION         Enumerates sections or keys of an INI file 
;; 
;;AUTHOR         Glenn Barnas  
;; 
;;VERSION        2.0 
;; 
;;DATE CREATED   2003/11/17 
;; 
;;DATE MODIFIED  2004/10/16 
;; 
;;SYNTAX         EnumIni(File [, Section]) 
;; 
;;PARAMETERS     File - 	REQUIRED, path/name of INI file to examine 
;; 
;;               Section -	OPTIONAL, Section name to parse 
;; 
;;REMARKS        Returns an array containing the sections in an INI file, or 
;;               an array of key names in a specified section. Errors are returned 
;;               for non-existant files or INI file reads. If the specified file 
;;               contains no sections, or the specified section contains no keys, 
;;               the UDF exits with error 13 and returns a null array. Thus, a For-Each loop 
;;               will properly perform no iterations if no data is returned. 
;; 
;;               CAUTION - Error 13 is returned for empty files, or nonexistant sections. 
;;                         This is not necessarily a "failure". 
;; 
;;RETURNS        Array of sections or keys in a section 
;; 
;;DEPENDENCIES   none 
;; 
;;TESTED WITH    Kix 4.2+, NT4, W2K, WXP, W2K3 
;; 
;;EXAMPLES       $Sections = EnumIni('.\config.ini') 
;;               $Keys = EnumIni('.\config.ini', 'Common') 
; 
Function EnumIni($_fSrcFile, OPTIONAL $_fSectName)
 
  Dim $_fSectList
 
  ; die if the file doesn't exist 
  If Exist($_fSrcFile) = 0
    Exit 2
  EndIf
 
  ; Get the list of sections or keys 
  $_fSectList = ReadProfileString($_fSrcFile, $_fSectName, '')
  ; Return if error occurred 
  If @ERROR
    Exit @ERROR
  EndIf
 
  ; If len is >0, return an array of sections 
  ; If len is 0, either no sections or keys exist, or an invalid section name was specified. Return nothing. 
  If Len($_fSectList) > 0
    $EnumIni = Split(Left($_fSectList,len($_fSectList)-1), Chr(10))
    Exit 0
  EndIF
 
  ; return an error here for value not found (no sections or no keys in section) 
  Exit 13
 
EndFunction 


Here's a sample ini file:
 Code:
[MAPPINGS]
sitename1=10.1.0.0/24,\\server\printer1
sitename2=10.18.22.0/24,\\server\printer2
sitename3=10.64.61.0/24,\\server\printer3


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