Sign in to follow this  
Followers 0
realkiller

helllp

2 posts in this topic

i made a script that can get computer some computer information, now you think oke what is the problem. when i compile the script i get the message:

! ***************************************************************************************************

! * Input file is UTF16 encoded, Au3Check/Tidy/Obfuscator do no support UNICODE and will be skipped.*

! ***************************************************************************************************

this wil not allow me to get all the information i need, here is the script.

Dim $objWshShell, $colitems, $objWMIservice, $objitem, $Bin, $split
$Bin = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion","DigitalProductID")
$objWshShell = ObjCreate("WScript.Shell")
$objWMIservice = ObjGet("winmgmts:\\.\root\cimv2")
$colitems = $objWMIservice.ExecQuery ("Select * from Win32_BIOS", "WQL", 48)
$processorname = RegRead("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor", "processornamestring")

    
    Call ("Getmacaddress")

Local $oExcel1 = _ExcelBookNew(1)
_ExcelWriteCell($oExcel1, "User Nam1e:", "A1")
_ExcelWriteCell($oExcel1, "Computer Name:", "A2")
_ExcelWriteCell($oExcel1, "Dell Service Tag:", "A3")
_ExcelWriteCell($oExcel1, "OS Language:", "A4")
_ExcelWriteCell($oExcel1, "OS:", "A5")
_ExcelWriteCell($oExcel1, "Processorarchitecture:", "A6")
_ExcelWriteCell($oExcel1, "product key is:", "A7")

_ExcelWriteCell($oExcel1, @UserName, "B1")
_ExcelWriteCell($oExcel1, @ComputerName, "B2")
_ExcelWriteCell($oExcel1, $objitem.serialnumber, "B3")
_ExcelWriteCell($oExcel1, _Language(), "B4")
_ExcelWriteCell($oExcel1, @OSVersion, "B5")
_ExcelWriteCell($oExcel1, $processorname&" "&@ProcessorArch, "B6")
_ExcelWriteCell($oExcel1, DecodeProductKey($bin), "B7")

_ExcelBookSaveAs($oExcel1, "C:\1.xls", "xls", 0, 1)
_ExcelBookClose($oExcel1)



Func _ExcelBookNew($fVisible = 1)
    $oExcel = ObjCreate("Excel.Application")
    If NOT IsObj($oExcel) Then Return SetError(1, 0, 0)
    If NOT IsNumber($fVisible) Then Return SetError(2, 0, 0)
    If $fVisible > 1 Then $fVisible = 1
    If $fVisible < 0 Then $fVisible = 0
    With $oExcel
        .Visible = $fVisible
        .WorkBooks.Add
        .ActiveWorkbook.Sheets(1).Select()
    EndWith
    Return $oExcel
EndFunc
Func _ExcelBookClose($oExcel, $fSave = 1, $fAlerts = 0)
    If NOT IsObj($oExcel) Then Return SetError(1, 0, 0)
    If $fSave > 1 Then $fSave = 1
    If $fSave < 0 Then $fSave = 0
    If $fAlerts > 1 Then $fAlerts = 1
    If $fAlerts < 0 Then $fAlerts = 0
    $oExcel.Application.DisplayAlerts = $fAlerts
    $oExcel.Application.ScreenUpdating = $fAlerts
    If $fSave Then
        $oExcel.ActiveWorkBook.Save
    EndIf
    $oExcel.Application.DisplayAlerts = True
    $oExcel.Application.ScreenUpdating = True
    $oExcel.Quit
    Return 1
EndFunc
Func _ExcelBookSaveAs($oExcel, $sFilePath, $sType = "xls", $fAlerts = 0, $fOverWrite = 0)
    If NOT IsObj($oExcel) Then Return SetError(1, 0, 0)
    If $sType = "xls" or $sType = "csv" or $sType = "txt" or $sType = "template" or $sType = "html" Then
        If $sType = "xls" Then $sType = $xlNormal
        If $sType = "csv" Then $sType = $xlCSVMSDOS
        If $sType = "txt" Then $sType = $xlTextWindows
        If $sType = "template" Then $sType = $xlTemplate
        If $sType = "html" Then $sType = $xlHtml
    Else
        Return SetError(2, 0, 0)
    EndIf
    If $fAlerts > 1 Then $fAlerts = 1
    If $fAlerts < 0 Then $fAlerts = 0
    $oExcel.Application.DisplayAlerts = $fAlerts
    $oExcel.Application.ScreenUpdating = $fAlerts
    If FileExists($sFilePath) Then
        If NOT $fOverWrite Then Return SetError(3, 0, 0)
        FileDelete($sFilePath)
    EndIf
    $oExcel.ActiveWorkBook.SaveAs ($sFilePath, $sType)
    If NOT $fAlerts Then
        $oExcel.Application.DisplayAlerts = 1
        $oExcel.Application.ScreenUpdating = 1
    EndIf
    Return 1
EndFunc 
Func _ExcelWriteCell($oExcel, $sValue, $sRangeOrRow, $iColumn = 1)
    If NOT IsObj($oExcel) Then Return SetError(1, 0, 0)
    If NOT StringRegExp($sRangeOrRow, "[A-Z,a-z]", 0) Then
        If $sRangeOrRow < 1 Then Return SetError(2, 0, 0)
        If $iColumn < 1 Then Return SetError(2, 1, 0)
        $oExcel.Activesheet.Cells($sRangeOrRow, $iColumn).Value = $sValue
        Return 1
    Else
        $oExcel.Activesheet.Range($sRangeOrRow).Value = $sValue
        Return 1
    EndIf
EndFunc
Func _Language()
Select
    Case StringInStr("0413,0813", @OSLang)
        Return "Dutch"
    Case StringInStr("0409,0809,0c09,1009,1409,1809,1c09,2009,2409,2809,2c09,3009,3409", @OSLang)
        Return "English"
    Case StringInStr("040c,080c,0c0c,100c,140c,180c", @OSLang)
        Return "French"
    Case StringInStr("0407,0807,0c07,1007,1407", @OSLang)
        Return "German"
    Case StringInStr("0410,0810", @OSLang)
        Return "Italian"
    Case StringInStr("0414,0814", @OSLang)
        Return "Norwegian"
    Case StringInStr("0415", @OSLang)
        Return "Polish"
    Case StringInStr("0416,0816", @OSLang)
        Return "Portuguese"
    Case StringInStr("040a,080a,0c0a,100a,140a,180a,1c0a,200a,240a,280a,2c0a,300a,340a,380a,3c0a,400a,440a,480a,4c0a,500a", @OSLang)
        Return "Spanish"
    Case StringInStr("041d,081d", @OSLang)
        Return "Swedish"
    Case Else
        Return "Other (can't determine with @OSLang directly)"
    EndSelect
EndFunc
Func DecodeProductKey($BinaryDPID)
   Local $bKey[15]
   Local $sKey[29]
   Local $Digits[24]
   Local $Value = 0
   Local $hi = 0
   local $n = 0
   Local $i = 0
   Local $dlen = 29
   Local $slen = 15
   Local $Result
   $Digits = StringSplit("BCDFGHJKMPQRTVWXY2346789","")
   $binaryDPID = stringmid($binaryDPID,105,30)
   For $i = 1 to 29 step 2
       $bKey[int($i / 2)] = dec(stringmid($binaryDPID,$i,2))
   next
   For $i = $dlen -1 To 0 Step -1
       If Mod(($i + 1), 6) = 0 Then
           $sKey[$i] = "-"
       Else
           $hi = 0
           For $n = $slen -1 To 0 Step -1
               $Value = Bitor(bitshift($hi ,- 8) , $bKey[$n])
               $bKey[$n] = int($Value / 24)
               $hi = mod($Value , 24)
           Next
           $sKey[$i] = $Digits[$hi +1]
       EndIf
   Next
   For $i = 0 To 28
       $Result = $Result & $sKey[$i]
   Next
   Return $Result
EndFunc
Func Getmacaddress()
    ProcessClose("cmd.exe")
    If FileExists ( @AppDataDir&"\autoit\mac.txt" ) Then
        FileDelete ( @AppDataDir&"\autoit\mac.txt" )
    EndIf
    DirCreate(@AppDataDir&"\autoit")
    Opt("WinTitleMatchMode", 2)
    RunWait(@ComSpec & " /c ipconfig /all>"&Chr(34)&@AppDataDir&"\autoit\mac.txt"&Chr(34),"",@SW_HIDE)
    ProcessClose("cmd.exe")
    $file = FileOpen(@AppDataDir&"\autoit\mac.txt", 0)
    If $file = -1 Then
        MsgBox(48, "Error:", "Unable to open file.")
        Exit
    EndIf
    $message = @CRLF & @CRLF
    Global $split[90][10]
    Dim $all[99][10]
    Dim $seq[10]
    $j=1
    $i=0
    $l=0
    $line=""
    $oldline=""
    $oldline1=""
    While 1
        $oldline1 = $oldline
        $oldline = $line
        $line = FileReadLine($file)
        If @error = -1 Then ExitLoop
        $seq= StringSplit($line, ":")
        If $seq[0]>1 Then
            $l+=1
            $i+=1
            For $r=0 To $seq[0]
                $split[$i][$r]=$seq[$r]
                $all[$l][$r]=$seq[$r]
            Next
        EndIf
        If @error <> 1 Then
            If StringMid($seq[2], 4, 1)= "-" Then
                $split[$i][2]=StringTrimLeft($split[$i][2], 1)
                $split[$i][1]=StringTrimLeft($all[$l-1][2], 1)
                If $split[$i][1] = "" Then
                    While StringLeft($oldline1,1) = " "
                        $oldline1=StringTrimLeft($oldline1,1)
                    WEnd
                    $split[$i][1] = $oldline1
                EndIf
                $message &= $split[$i][1]&@CRLF&$split[$i][2]&@CRLF
                $split[0][0]=$i
            Else
                $i-=1
            EndIf
        EndIf
    Wend
    FileClose($file)
    ProcessClose(@AppDataDir&"\autoit\mac.txt")
    FileDelete ( @AppDataDir&"\autoit\mac.txt")
EndFunc

Share this post


Link to post
Share on other sites



What is your question ?

When the file is saved as UNICODE, those listed utilities will be skipped.

Save your file as Ansi when there is no need to use the UNICODE fileformat for your script and all will work again.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0