Here is one way to get the SSID using WMI...

 Code:
Break On

? GetCurrentSSID()
get $

Function GetCurrentSSID()
   $objWMIService = GetObject("winmgmts:\\"+@WkSta+"\root\WMI")
   $colItems = $objWMIService.ExecQuery("SELECT * FROM MSNdis_80211_ServiceSetIdentifier Where active=true")
   For Each $objItem In $colItems
      if len($GetCurrentSSID)=0
         $strNdis80211SsId = Join($objItem.Ndis80211SsId,"")
         $y=5
         for $x=0 to len($strNdis80211SsId)
            $GetCurrentSSID=""+$GetCurrentSSID+Chr(substr($strNdis80211SsId,$y,3))
            $y=$y+3
         next
      endif
   Next
EndFunction