I found someone's script to pull monitor information. It outputs the results to the screen, but I'm trying to get it to output the values to variables. I added $MSN = MonitorSN() and $MMN = MonitorModel() to the end of the script and it works if I use kix32.exe, but I get an error when wkix32.exe gets to those lines. Can someone help? Thanks!


 Code:
Break ON

$=SetOption("Explicit","ON")
$=SetOption("WrapAtEOL","ON")
$=SetOption("ASCII","ON")

; MonitorSN()

?

; MonitorModel()


; get $

FUNCTION MonitorSN(OPTIONAL $computer)
   Dim $sEDID,$ioffset,$sblock,$c,$s,$iIndex,$sMonitor
   $iIndex=0
   $sMonitor=EnumKey("HKLM\SYSTEM\CurrentControlSet\Enum\Display",$iIndex)

   While Not @ERROR

   $sMonitor="HKLM\SYSTEM\CurrentControlSet\Enum\Display\"+$sMonitor+"\"+EnumKey("HKLM\SYSTEM\CurrentControlSet\Enum\Display\"+$sMonitor,0)

      If KeyExist($sMonitor+"\Control")
         If Instr(ReadValue($sMonitor,"HardwareID"),"Monitor\")=1
            $sEDID = ReadValue($sMonitor+"\Device Parameters","EDID")
            For $iOffset=54 To 108 Step 18
               $sBlock=SubStr($sEDID,$iOffset*2+1,18*2)
               If Left($sBlock,8)="000000ff"
                  $s = SubStr($sBlock,9)
                  While $s
                     $c=Execute("Exit &"+Left($s,2))
                     If $c=10
                        Exit 0
                     EndIf
                     If $c
                        $MonitorSN=$MonitorSN+Chr($c)
                     EndIf
                     $s=SubStr($s,3)
                  Loop
               EndIf
            Next
         EndIf
      EndIf

      $iIndex=$iIndex+1

      $sMonitor=EnumKey("HKLM\SYSTEM\CurrentControlSet\Enum\Display",$iIndex)

   Loop

ENDFUNCTION

FUNCTION MonitorModel(OPTIONAL $computer)
   Dim $sEDID,$ioffset,$sblock,$c,$s,$iIndex,$sMonitor
   $iIndex=0
   $sMonitor=EnumKey("HKLM\SYSTEM\CurrentControlSet\Enum\Display",$iIndex)
   While Not @ERROR
      

$sMonitor="HKLM\SYSTEM\CurrentControlSet\Enum\Display\"+$sMonitor+"\"+EnumKey("HKLM\SYSTEM\CurrentControlSet\Enum\Display\"+$sMonitor,0)

      If KeyExist($sMonitor+"\Control")
         If Instr(ReadValue($sMonitor,"HardwareID"),"Monitor\")=1
            $sEDID = ReadValue($sMonitor+"\Device Parameters","EDID")
            For $iOffset=54 To 108 Step 18
               $sBlock=SubStr($sEDID,$iOffset*2+1,18*2)
               If Left($sBlock,8)="000000fc"
                  $s = SubStr($sBlock,9)
                  While $s
                     $c=Execute("Exit &"+Left($s,2))
                     If $c=10
                        Exit 0
                     EndIf
                     If $c
                        $MonitorModel=$MonitorModel+Chr($c)
                     EndIf
                     $s=SubStr($s,3)
                  Loop
               EndIf
            Next
         EndIf
      EndIf

      $iIndex=$iIndex+1

      $sMonitor=EnumKey("HKLM\SYSTEM\CurrentControlSet\Enum\Display",$iIndex)

   Loop

ENDFUNCTION

$MSN = MonitorSN()
$MMN = MonitorModel()





Edited by Richard H. (2010-08-27 08:54 AM)
Edit Reason: Added code tags