Guys I'm using the following UDF (I did not create this)

The UDF maps drives out drives from an INI file based on active directory group names.
The UDF is working and mapping the driver correctly , however I have discovered that once it matchs you to 1 group (the first match within the INI file) it exits the script. I need the script to continue checking through the full INI file connecting any drives that you match to. I've looked through the script but I haven't been able to figure out how I can do this. Any help would be great.
 Code:
Function ConnectSpecialShares()
  ;******************************
  ; SpecialShares
  ;******************************
  Dim $ShareEntries
  Dim $numShareEntries
  $numShareEntries = 1
  Progress("Connecting Special Shares")
  DbgMessage("Info", "Connecting Special Shares")
  DbgMessage("Info", "  SpecialSharesinifile = " + $SpecialSharesIniFile)
  If Exist($SpecialSharesIniFile)
  ;Walk through SpecialSharesIniFile and generate array
  $MainGroup = "ALLSTAFF"
  $Handle = FreeFileHandle()
  If $Handle > 0
    If Open($Handle, $SpecialSharesIniFile, 2) = 0
      $line = ReadLine($Handle)
      While @ERROR = 0
        If Left($line, 1) = "["
          $GroupName = SubStr($line, 2, Len($line) - 2)
          If InGroup($GroupName)
            ReDim preserve $ShareEntries[$numShareEntries]
            $ShareEntries[$numShareEntries] = $GroupName
            $numShareEntries = $numShareEntries + 1
          EndIf
        EndIf
        $line = ReadLine($Handle)
      Loop
      Close($Handle)
    EndIf
  EndIf
  For $shares = 1 to UBound($ShareEntries)
    For $x = 1 to 10
      $DriveDefinition = ReadProfileString($SpecialSharesIniFile, $ShareEntries[$shares], "drive" + $x)
      If @ERROR = 0
        If $DriveDefinition <> ""
          ConnectShare($DriveDefinition)
        EndIf
      Else
        Return
      EndIf
    Next
  Next
  EndIf
EndFunction



Here is what the INI file looks like

;================================================================
; GROUP 1
;=Start==========================================================
[AD.GROUP1]
Drive1="P:, \\SERVERA\C$, "
Drive2="R:, \\SERVERB\C$, "
;=End============================================================
;================================================================

;==========================================
;GROUP 2
;=Start====================================
[AD.GROUP2]
Drive1="G:, \\SERVERC\DATA.MS1$, "
Drive2="B:, \\SERVERD\DATA.WTA$, "
;=End======================================


;================================================================
; GROUP 3
;=Start==========================================================
[AD.GROUP3]
Drive1="X:, \\SERVERE\ALLDATA$, HPC Servers"
Drive2="V:, \\SERVERF\ALLDATA$, HPC DR Server"
;=End============================================================
;================================================================







Edited by Glenn Barnas (2013-08-09 12:40 PM)
Edit Reason: Please use CODE tags