Hi, are there someone who can please help me,
i facial turning blue an green.


I have a Printer.ini file for my printermappings that will
map printers if $bssid = $mac

I also have a function that locate the bssid of the accesspoint
the client is connected to, and use this to compare the location
of my printers so the client will get the printer mapped close to
him.

Printer.inf
00:1B:3F:8E:CD:21;Location1;Share1;Group1
00:16:B9:52:AF:BF;Location2;Share3;Group3
00:17:08:22:0B:C3;Location3;Share2;Group6
00:1B:3F:8E:CD:21;Location4;Share4;Group4
00:1C:2E:42:94:57;Location5;Share5;Group2


In this example i have 2 identical match (mac) and want to pass
the line argument to som variables for further use (printermapping) in my script.
It only works as long the @error = 0 when not it reads the same line again and again?


00:1B:3F:8E:CD:21;Location1;Share1;Group1
00:1B:3F:8E:CD:21;Location4;Share4;Group4

My problem is that the script will not loop through the end of my Printer.inf
to isolate the match found, here $bssid = $mac


Here is my script:
 Code:
$PrinterMapping = @LDRIVE + "\Printer.ini"
$ = Open(1, $PrinterMapping)
$aCurLine = Split(ReadLine(1),';')

$LoopCount = 0
 While @error = 0

$mac        = Trim($aCurLine[0])
$location   = Trim($aCurLine[1])
$share      = Trim($aCurLine[2])
$group      = Trim($aCurLine[3])

  If "$bssid" = "$mac"

? "BSSID: " $mac
? "Printer Placering: " $location
? "Printer Deling: " $share
? "Printer Gruppe: " $group
? @Error

$aCurLine = Split(ReadLine(1),';')

Else
 ? "Match not found"
 ? $bssid
 ? $mac
 ? $LoopCount
ENDIF

$LoopCount = $LoopCount + 1
sleep 3

  Loop


Kind regards
roundup


Edited by Mart (2010-11-05 02:08 PM)
Edit Reason: Please use code tags when posting code.