Jump to content

Trong

Active Members
  • Posts

    1,101
  • Joined

  • Days Won

    2

Everything posted by Trong

  1. The article is a bit long, I will add more example code below when finished!
  2. Using BarCodeGenerator.dll in AutoIt: A Comprehensive Guide This guide introduces you to the BarCodeGenerator.dll—a dynamic link library designed for generating various types of barcodes and QR codes. You will learn about the structure of its exported functions, the necessary parameters, and how you can integrate and call these functions from an AutoIt script. The article also includes example code to illustrate both the in-memory image handling (using GDIPlus) as well as file-based output. 1. Exported Functions Overview The DLL exports two primary functions: a) CreateBarcode Purpose: Generates a barcode or QR code based on the provided text and other configuration parameters. Depending on the parameters, the function either returns an HBITMAP (when no file path is provided and when the output format is an image such as PNG, BMP, JPG, or TGA) or returns a text result with configuration details (for console output, SVG, or when output is generated to a file). Exported Signature (C/C++ Prototype): DLL_API void* __stdcall CreateBarcode( const wchar_t* textContent, const wchar_t* outputType, const wchar_t* eccStr, const wchar_t* qrColorHex, const wchar_t* bgColorHex, const wchar_t* outputFormat, const wchar_t* filePath, int sizeParam, int scale, int borderModules ); Parameters: textContent: The string content that you want to encode. For example, "Hello World". outputType: A string that defines the type of barcode/QR code. Accepted values include "qr", "code128", "code39", and "ean128". eccStr: Specifies the error correction level (primarily used for QR codes). Example values are "low", "medium", "quartile", and "high". qrColorHex and bgColorHex: These parameters represent the barcode (foreground) and background colors in hexadecimal notation. For example, passing "000000" for black and an empty string for the default background. outputFormat: Sets the desired output format. Valid options include "bmp", "png", "jpg", "jpeg", "tga", "svg", and "console". filePath: When provided with a valid path, the DLL saves the generated file to disk. If this parameter is an empty string, the function instead returns an HBITMAP (if the output is an image) that can be handled via GDIPlus in AutoIt. sizeParam: Indicates the desired overall size for the generated image. scale: The scale factor. If set to 0 (or less), the scale is determined automatically based on size and border parameters. borderModules: Determines the number of border modules (padding) around the generated symbol. Return Value: The function returns a pointer to a structure—BarcodeResult. This structure contains: A fixed-length wide-character array (wchar_t info[4096]) that includes the configuration details along with the generation result. A pointer (hBitmap) that will hold a valid HBITMAP if the output is generated in memory (i.e., when no file path is provided). b) GetBarcodeInfo Purpose: This function returns static information about the DLL, including version and author details. Exported Signature (C/C++ Prototype): DLL_API wchar_t* __stdcall GetBarcodeInfo(); Return Value: A pointer to a wide-character string containing DLL information (for example, version, author, etc.). 2. Structure Definition in the Header File For smooth integration with AutoIt, the DLL uses a predefined structure for the return value of CreateBarcode. Below is an example of the header file content (named BarCodeGenerator.h😞 #ifndef BARCODEGENERATOR_H #define BARCODEGENERATOR_H #ifdef _WIN32 #ifdef DLL_EXPORTS #define DLL_API __declspec(dllexport) #else #define DLL_API __declspec(dllimport) #endif #else #define DLL_API #endif // Define the size of the buffer to store info details. #define INFO_BUFFER_SIZE 4096 #ifdef __cplusplus extern "C" { #endif // Structure returned from CreateBarcode typedef struct _BarcodeResult { wchar_t info[INFO_BUFFER_SIZE]; #ifdef _WIN32 void* hBitmap; // HBITMAP handle on Windows platforms #else void* hBitmap; #endif } BarcodeResult; // Exported function to create a barcode/QR code. DLL_API void* __stdcall CreateBarcode( const wchar_t* textContent, const wchar_t* outputType, const wchar_t* eccStr, const wchar_t* qrColorHex, const wchar_t* bgColorHex, const wchar_t* outputFormat, const wchar_t* filePath, int sizeParam, int scale, int borderModules ); // Exported function to get general renderer information. DLL_API wchar_t* __stdcall GetBarcodeInfo(); #ifdef __cplusplus } #endif #endif // BARCODEGENERATOR_H This header file clearly defines the exported functions and makes it easier to write AutoIt scripts to call these functions via the DllCall mechanism. 3. Using the DLL in AutoIt When integrating this DLL in AutoIt, you must create a structure that matches BarcodeResult. Typically, you'll use DllStructCreate() with a format string such as "wchar[4096];ptr hBitmap". Example AutoIt Workflow: Call CreateBarcode to generate a QR code in memory. Pass an empty string as the filePath parameter so that the DLL returns an HBITMAP for in-memory processing. Use GDIPlus (via the GDIPlus UDF) to convert the HBITMAP to a PNG image and save it to disk. Call CreateBarcode to output directly to a file. Provide a valid filePath (e.g., "C:\Temp\qr_output.png") so that the DLL writes the file to the disk and also returns a text report with the configuration and operation details. Call GetBarcodeInfo to retrieve additional information about the DLL. Below is a sample AutoIt code snippet that demonstrates how to call these functions: #RequireAdmin ;~ #Region ;**** Directives created by AutoIt3Wrapper_GUI **** ;~ #AutoIt3Wrapper_UseX64=y ;~ #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ;~ #pragma compile(x64, true) ; For test FileDelete(@ScriptDir & "\output_qr.png") FileDelete(@ScriptDir & "\output_code128.png") ; Path to the DLL (adjust according to the actual location of the DLL on your system) Global Const $g_sDllPath = @AutoItX64 ? @ScriptDir & "\BarCodeGenerator_x64.dll" : @ScriptDir & "\BarCodeGenerator_x86.dll" ; Path to the DLL (update to the correct path) #include <GDIPlus.au3> ; Define the BarcodeResult structure as follows: ; - wchar[4096]: a text string containing configuration and result information (fixed at 4096 characters) ; - ptr hBitmap: the hBitmap pointer returned when using in-memory image output Local $tBarcodeResultDef = "wchar[4096];ptr hBitmap" ConsoleWrite("; EG 1 -----------------------------" & @CRLF) ; ----------------------------- ; PART 1: Call CreateBarcode to generate a QR code in-memory ; (Since FilePath is "" the function returns an HBITMAP, and the PNG image will be saved using _GDIPlus) Local $aRet = DllCall($g_sDllPath, "ptr", "CreateBarcode", _ "wstr", "Hello World", _ ; textContent "wstr", "qr", _ ; outputType "wstr", "medium", _ ; eccStr "wstr", "000000", _ ; qrColorHex "wstr", "", _ ; bgColorHex (empty means default) "wstr", "png", _ ; outputFormat "wstr", "", _ ; filePath = empty => create image in memory "int", 128, _ ; sizeParam "int", 0, _ ; scale "int", 1) ; borderModules If Not IsArray($aRet) Then ConsoleWrite("CreateBarcode call failed." & @CRLF) Else ; $aRet[0] is the pointer to the BarcodeResult structure. Local $pResult = $aRet[0] ; Map the returned pointer to the BarcodeResult structure. Local $sBarcodeResult = DllStructCreate($tBarcodeResultDef, $pResult) ; Retrieve the configuration and status message string. Local $sInfo = DllStructGetData($sBarcodeResult, 1) ConsoleWrite("In-memory QR generation result info:" & @CRLF & $sInfo & @CRLF) ; Get the HBITMAP Local $hBmp = DllStructGetData($sBarcodeResult, 2) If @error Then ConsoleWrite("! Error in DllStructGetData, Code: " & @error & @CRLF) EndIf ; Use _GDIPlus to save this HBITMAP to a PNG file. _GDIPlus_Startup() ; Convert HBITMAP to a GDI+ Bitmap object Local $hBmpGp = _GDIPlus_BitmapCreateFromHBITMAP($hBmp) If $hBmpGp = 0 Then ConsoleWrite("Failed to convert HBITMAP to GDI+ Bitmap." & @CRLF) Else ; Save the image to a file If _GDIPlus_ImageSaveToFile($hBmpGp, @ScriptDir & "\output_qr.png") Then ConsoleWrite("Saved in-memory QR code to file " & @ScriptDir & "\output_qr.png" & @CRLF) If FileExists(@ScriptDir & "\output_qr.png") Then ShellExecute(@ScriptDir & "\output_qr.png"); show qr Else ConsoleWrite("! Failed to save the image to file." & @CRLF) EndIf _GDIPlus_ImageDispose($hBmpGp) EndIf _GDIPlus_Shutdown() EndIf ConsoleWrite("; EG 2 -----------------------------" & @CRLF) ; ----------------------------- ; PART 2: Call CreateBarcode to output the result directly to a file. ; Here, since filePath is provided, the DLL will write the file to disk. Local $aRet2 = DllCall($g_sDllPath, "ptr", "CreateBarcode", _ "wstr", "Hello World", _ "wstr", "code128", _ "wstr", "medium", _ "wstr", "000000", _ "wstr", "", _ "wstr", "png", _ "wstr", @ScriptDir & "\output_code128.png", _ ; Direct output to file "int", 128, _ "int", 0, _ "int", 4) If Not IsArray($aRet2) Then ConsoleWrite("! File output CreateBarcode call failed." & @CRLF) Else Local $pResult2 = $aRet2[0] Local $sBarcodeResult2 = DllStructCreate($tBarcodeResultDef, $pResult2) Local $sInfo2 = DllStructGetData($sBarcodeResult2, 1) If FileExists(@ScriptDir & "\output_code128.png") Then ShellExecute(@ScriptDir & "\output_code128.png") ; show bar code 128 ConsoleWrite("File output QR generation result info:" & @CRLF & $sInfo2 & @CRLF) EndIf ConsoleWrite("; Test 3 -----------------------------" & @CRLF) ; ----------------------------- ; PART 3: Call GetBarcodeInfo to retrieve additional information about the author, version, etc. Local $aRet3 = DllCall($g_sDllPath, "wstr", "GetBarcodeInfo") If Not IsArray($aRet3) Then ConsoleWrite("! GetBarcodeInfo call failed." & @CRLF) Else MsgBox(64 + 262144, "About ", $aRet3[0] & @CRLF) ;MsgBox(64 + 262144, "GetBarcodeInfo: ", CorrectFromCP1252ToUTF8($aRet3[0]) & @CRLF) EndIf ; Function to convert strings misinterpreted as CP1252 to proper UTF-8 Func CorrectFromCP1252ToUTF8($sMisinterpreted) ; Convert the string (encoded as CP1252) to binary. Local $aBinary = StringToBinary($sMisinterpreted, 0) ; Create an ADODB.Stream object to perform encoding conversion. Local $oStream = ObjCreate("ADODB.Stream") If Not IsObj($oStream) Then MsgBox(16, "Error", "Unable to create ADODB.Stream object.") Return $sMisinterpreted EndIf ; Write the binary data to the stream. $oStream.Type = 1 ; 1: Binary $oStream.Open $oStream.Write($aBinary) ; Reset stream position and switch to text mode. $oStream.Position = 0 $oStream.Type = 2 ; 2: Text $oStream.Charset = "utf-8" ; Read data as UTF-8. Local $sCorrect = $oStream.ReadText() $oStream.Close() Return $sCorrect EndFunc ;==>CorrectFromCP1252ToUTF8 Explanation of the AutoIt Code: Structure Initialization: The structure for the result (BarcodeResult) is defined in AutoIt using DllStructCreate with "wchar[4096];ptr hBitmap". This matches the DLL’s definition. Function Calls: For the first call to CreateBarcode, an empty filePath tells the DLL to generate the image in memory. The returned HBITMAP is then processed via _GDIPlus for conversion and saving. For the second call, a valid file path is provided so the DLL writes the image file directly to disk while also returning a text-based log of the configuration and status. Finally, the static information is retrieved using GetBarcodeInfo. Output Display: Instead of using message boxes, all feedback and information are displayed using ConsoleWrite(). 4. Conclusion In this guide, we have covered the following: The structure and purpose of the exported functions from BarCodeGenerator.dll. Detailed descriptions of all necessary parameters—including text content, barcode/QR type, error correction level, colors, output format, and file handling. How to set up and call these functions from an AutoIt script using the DLL call mechanism. An example AutoIt code that demonstrates both in-memory image retrieval (with _GDIPlus) and direct file output, and how to retrieve additional DLL information. By following this guide, you should be able to effectively integrate the barcode generation capabilities of the DLL into your AutoIt projects and further customize the functionality to suit your requirements. Happy coding! _________________________________________ For Vietnamese: >> Link Download Dll/Exe (Because it contains exe cli file so to avoid warning when downloading I set password as number 1) Limitation: due to using c++17, it will not support running on windows XP ________________________________________________________ QR Code generator library (c) Nayuki
  3. It works fine on my computer, make sure that window and tab are active, if you open multiple tabs on the browser it will only report for the current active tab
  4. I have written a function to run the ps command and get the result back, but the semicolon problem has been driving me crazy, as the command sent to ps quotes seems to have problems and cannot run the command correctly! no matter I try to add 2 double quotes or use single quotes, it still does not work properly. ; *** Add a program to Windows Defender Exclusions using PowerShell *** #RequireAdmin #include <AutoItConstants.au3> ; *** Example Usage *** ; Get the list of running processes and filter for processes named "notepad" Local $commandToRun = "Get-Process | Where-Object {$_.ProcessName -eq 'notepad'} | Format-List Name, Id, MainWindowTitle" Local $powerShellResult = RunPowerShellCommand($commandToRun) If @error Then MsgBox(16, "Error", "Could not get results from PowerShell.") Else If $powerShellResult Then MsgBox(64, "PowerShell Result", "Result returned from PowerShell: " & $powerShellResult) Else MsgBox(64, "Information", "No processes match the criteria.") EndIf EndIf ; Another example: Get the PowerShell version Local $versionCommand = "$PSVersionTable.PSVersion" Local $powerShellVersion = RunPowerShellCommand($versionCommand) If Not @error Then MsgBox(64, "PowerShell Version", "PowerShell Version: " & $powerShellVersion) EndIf ;~ ; *** Example Usage *** ; **Change the program path and rule name according to your needs** Local $programToExclude = @Compiled ? @ScriptFullPath : @AutoItExe Local $firewallRuleName = "AutoIt3" ; Add to Windows Defender Exclusions using PowerShell If AddToDefenderExclusions_PS($programToExclude) Then MsgBox(64, "Success", "Successfully added '" & $programToExclude & "' to Windows Defender Exclusions (PowerShell).") Else MsgBox(16, "Failure", "Failed to add '" & $programToExclude & "' to Windows Defender Exclusions (PowerShell). Please check the path or run the script with administrator privileges.") EndIf ; Add to Windows Firewall Exclusions using PowerShell If AddToFirewallExclusions_PS($programToExclude, $firewallRuleName) Then MsgBox(64, "Success", "Successfully added Firewall rule for '" & $programToExclude & "' (PowerShell).") Else MsgBox(16, "Failure", "Failed to add Firewall rule for '" & $programToExclude & "' (PowerShell). Please check the path or run the script with administrator privileges.") EndIf Func RunPowerShellCommand($powerShellCommand) Local $output = "" Local $error = "" Local $command_r = "PowerShell -Command '" & '"' & $powerShellCommand & '"' & "'" ConsoleWrite('-> ' & $command_r & @CRLF) Local $pid = Run(@ComSpec & ' /c ' & $command_r, "", @SW_HIDE, $STDOUT_CHILD + $STDERR_CHILD) If Not $pid Then MsgBox(16, "Error", "Could not run PowerShell.") Return SetError(-1, 0, False) EndIf While 1 $line = StdoutRead($pid) If @error Then ExitLoop $output &= $line & @CRLF WEnd While 1 $line = StderrRead($pid) If @error Then ExitLoop $error &= $line & @CRLF WEnd ProcessClose($pid) $error = StringStripWS($error, 7) $output = StringStripWS($output, 7) If StringLen(StringStripWS($error, 8)) > 0 Then ConsoleWrite($output & @CRLF & $error & @CRLF) MsgBox(16, "PowerShell Error", "Error returned from PowerShell: " & $error) Return SetError(1, 0, $error) Else ConsoleWrite($output & @CRLF) Return SetError(0, 0, $output) EndIf EndFunc ;==>RunPowerShellCommand Func AddToDefenderExclusions_PS($programPath) Local $command = 'Add-MpPreference -ExclusionPath "' & $programPath & '"' Local $result = RunPowerShellCommand($command) If @error Then MsgBox(16, "Defender Error", "Error running PowerShell command to add to Defender Exclusion." & @CRLF & "" & $result & "") Return False Else If StringLen($result) > 0 Then MsgBox(16, "Defender return", "" & $result & "") Return True Else Return False EndIf EndIf EndFunc ;==>AddToDefenderExclusions_PS ; *** Add a program to Windows Firewall Exclusions using PowerShell *** Func AddToFirewallExclusions_PS($programPath, $ruleName) Return AddToFirewall_InboundExclusions_PS($programPath, $ruleName) And AddToFirewall_OutboundExclusions_PS($programPath, $ruleName) EndFunc ;==>AddToFirewallExclusions_PS Func AddToFirewall_InboundExclusions_PS($programPath, $ruleName) ; Create Inbound rule Local $inboundCommand = 'New-NetFirewallRule -DisplayName "' & $ruleName & ' (Inbound)" -Direction Inbound -Action Allow -Program "' & $programPath & '" -Enabled True' Local $inboundResult = RunPowerShellCommand($inboundCommand) If @error Then MsgBox(16, "Firewall Error", "Error running PowerShell command to add Inbound Firewall rule." & @CRLF & "" & $inboundResult & "") Return False Else If StringLen($inboundResult) > 0 Then MsgBox(16, "Defender return", "" & $inboundResult & "") Return True Else Return False EndIf EndIf EndFunc ;==>AddToFirewall_InboundExclusions_PS Func AddToFirewall_OutboundExclusions_PS($programPath, $ruleName) ; Create Outbound rule Local $outboundCommand = 'New-NetFirewallRule -DisplayName "' & $ruleName & ' (Outbound)" -Direction Outbound -Action Allow -Program "' & $programPath & '" -Enabled True' Local $outboundResult = RunPowerShellCommand($outboundCommand) If @error Then MsgBox(16, "Firewall Error", "Error running PowerShell command to add OutboundFirewall rule." & @CRLF & "" & $outboundResult & "") Return False Else If StringLen($outboundResult) > 0 Then MsgBox(16, "Defender return", "" & $outboundResult & "") Return True Else Return False EndIf EndIf Return True EndFunc ;==>AddToFirewall_OutboundExclusions_PS
  5. How to show tray menu without clicking on tray icon? Or Click on tray icon automatically! #NoTrayIcon #include <MsgBoxConstants.au3> #include <StringConstants.au3> #include <TrayConstants.au3> ; Required for the $TRAY_ICONSTATE_SHOW constant. Opt("TrayMenuMode", 3) ; The default tray menu items will not be shown and items are not checked when selected. These are options 1 and 2 for TrayMenuMode. HotKeySet("{F12}", "_ShowTrayMenu") ; Đặt Hotkey là phím F12 Example() Func Example() Local $idAbout = TrayCreateItem("About") TrayCreateItem("") ; Create a separator line. Local $idExit = TrayCreateItem("Exit") TraySetState($TRAY_ICONSTATE_SHOW) ; Show the tray menu. While 1 Switch TrayGetMsg() Case $idAbout ; Display a message box about the AutoIt version and installation path of the AutoIt executable. MsgBox($MB_SYSTEMMODAL, "", "AutoIt tray menu example." & @CRLF & @CRLF & _ "Version: " & @AutoItVersion & @CRLF & _ "Install Path: " & StringLeft(@AutoItExe, StringInStr(@AutoItExe, "\", $STR_NOCASESENSEBASIC, -1) - 1)) ; Find the folder of a full path. Case $idExit ; Exit the loop. ExitLoop EndSwitch WEnd EndFunc ;==>Example Func _ShowTrayMenu() ;??????????????????????????????????????? EndFunc
  6. Your file is locked by "windows defender" you need to wait for the scan to complete, it's best to add the working path to the whitelist to improve, but it's best to disable it.
  7. DirMove and DirCopy are different in usage, try to understand it. Here is an example script for backing up and restoring folders: #RequireAdmin ; ----------------------------------------------- #include <AutoItConstants.au3> #include <FileConstants.au3> ; ----------------------------------------------- Opt("MustDeclareVars", 1) ; ----------------------------------------------- ; ------------------------------------------------------------- INPUT : Global Const $sUserName = @UserName Global $sNAME_Path[6] $sNAME_Path[0] = 4 $sNAME_Path[1] = 'SAC64' ; App Folder Name $sNAME_Path[2] = 'Software Audio Console64' ; Start Menu Folder Name $sNAME_Path[3] = 'SAWStudio' ; App Folder Name $sNAME_Path[4] = 'SAWStudio' ; Start Menu Folder Name $sNAME_Path[5] = 'RML' ; App Data Folder Name Global Const $aDirNAME_Path = $sNAME_Path Global Const $sORGAPP_Path = @HomeDrive Global Const $sBACKUP_Path = "D:\Backup" Global Const $sPathDir_BACKUP_Data = $sBACKUP_Path & "\Data" Global Const $sPathDir_BACKUP_App = $sBACKUP_Path & "\Apps" Global Const $sPathDir_BACKUP_Start_Menu = $sBACKUP_Path & "\Start_Menu" Global Const $iSleep_Time = 2500 ; ms Stop Show Result ; ---------------------------------------------------------------------- Global Const $sPathDir_ORG_StartMenuPrograms = @HomeDrive & "\Users\" & $sUserName & "\AppData\Roaming\Microsoft\Windows\Start Menu\Programs" ; @AppDataDir & "\Microsoft\Windows\Start Menu\Programs" Global $sPathDir_ORG[6] $sPathDir_ORG[0] = 5 $sPathDir_ORG[1] = $sORGAPP_Path & "\" & $aDirNAME_Path[1] $sPathDir_ORG[2] = $sPathDir_ORG_StartMenuPrograms & '\' & $aDirNAME_Path[2] $sPathDir_ORG[3] = $sORGAPP_Path & "\" & $aDirNAME_Path[3] $sPathDir_ORG[4] = $sPathDir_ORG_StartMenuPrograms & '\' & $aDirNAME_Path[4] $sPathDir_ORG[5] = $sPathDir_ORG_StartMenuPrograms & '\' & $aDirNAME_Path[5] Global Const $aPathDir_ORG = $sPathDir_ORG ; ---------------------------------------------------------------------- Global $sPathDir_BACKUP[6] $sPathDir_BACKUP[0] = 5 $sPathDir_BACKUP[1] = $sPathDir_BACKUP_App & "\" & $aDirNAME_Path[1] $sPathDir_BACKUP[2] = $sPathDir_BACKUP_Start_Menu & "\" & $aDirNAME_Path[2] $sPathDir_BACKUP[3] = $sPathDir_BACKUP_App & "\" & $aDirNAME_Path[3] $sPathDir_BACKUP[4] = $sPathDir_BACKUP_Start_Menu & "\" & $aDirNAME_Path[4] $sPathDir_BACKUP[5] = $sPathDir_BACKUP_Data & "\" & $aDirNAME_Path[5] Global Const $aPathDir_BACKUP = $sPathDir_BACKUP ; ---------------------------------------------------------------------- _Remove_RMLData_Backup() _Backup_RMLData() ;_Remove_RMLData_AppDir() ;_Restore_RMLData() ; ----------------------------------------------- Func _Backup_RMLData() ; ----------------------------------------------- Local $sResult, $iResult = 0, $sMessage = "Backup data..." & @CRLF & @CRLF ; ----------------------------------------------- For $i = 1 To $aPathDir_ORG[0] ToolTip('> COPY: ' & $aPathDir_ORG[$i] & ' -> TO: ' & $aPathDir_BACKUP[$i], (@DesktopWidth / 2) - 50, 5, 'Backing up data [' & $i & '/' & $aPathDir_ORG[0] & '] please wait...') ConsoleWrite('> COPY: ' & $aPathDir_ORG[$i] & ' (FileExists: ' & FileExists($aPathDir_ORG[$i]) & ') ' & @CRLF) ConsoleWrite('- TO: ' & $aPathDir_BACKUP[$i] & ' (FileExists: ' & FileExists($aPathDir_BACKUP[$i]) & ') ' & @CRLF) ConsoleWrite('! Please wait: Copying ....' & @CRLF) If Not FileExists($aPathDir_BACKUP[$i]) Then DirCreate($aPathDir_BACKUP[$i]) If FileExists($aPathDir_ORG[$i]) Then $sResult = DirCopy($aPathDir_ORG[$i], $aPathDir_BACKUP[$i], $FC_OVERWRITE) Else $sResult = 0 EndIf Switch $sResult Case 0 ConsoleWrite('!> Result (0): ERROR: Data was not backed-up! (' & $aDirNAME_Path[$i] & ' - FileExists: ' & FileExists($aPathDir_BACKUP[$i]) & ') ' & @CRLF) $sResult = "[" & $aDirNAME_Path[$i] & "] ERROR: Data was not backed up" Case 1 $iResult += 1 ConsoleWrite('-> Result (1): The data WAS backed-up successfully! (' & $aDirNAME_Path[$i] & ' - FileExists: ' & FileExists($aPathDir_BACKUP[$i]) & ') ' & @CRLF) $sResult = "[" & $aDirNAME_Path[$i] & "] The data WAS backed-up successfully!" EndSwitch ; ----------------- $sMessage &= $sResult & @CRLF $sResult = '' ToolTip('') Next ToolTip('') ; ----------------------------------------------- $sMessage &= @CRLF & "The Backup of data completed..." & @CRLF ; ----------------------------------------------- ToolTip($sMessage, (@DesktopWidth / 2) - 50, 5, "NOTICE!!", 1) Sleep($iSleep_Time) ToolTip('') $sResult = $aPathDir_ORG[0] - $iResult If ($sResult < 1) Then ConsoleWrite('+> The data WAS backed-up successfully!' & @CRLF) Return True Else ConsoleWrite('!> ERROR: Data was not backed-up!' & @CRLF) Return False EndIf ; ----------------------------------------------- EndFunc ;==>_Backup_RMLData ; ----------------------------------------------- Func _Restore_RMLData() ; ----------------------------------------------- Local $sResult, $iResult = 0, $sMessage = "Restore data..." & @CRLF & @CRLF ; ----------------------------------------------- For $i = 1 To $aPathDir_BACKUP[0] ToolTip('> COPY: ' & $aPathDir_BACKUP[$i] & ' -> TO: ' & $aPathDir_ORG[$i], (@DesktopWidth / 2) - 50, 5, 'Restoring data [' & $i & '/' & $aPathDir_BACKUP[0] & '] please wait...') ConsoleWrite('- COPY: ' & $aPathDir_BACKUP[$i] & ' (FileExists: ' & FileExists($aPathDir_BACKUP[$i]) & ') ' & @CRLF) ConsoleWrite('> TO: ' & $aPathDir_ORG[$i] & ' (FileExists: ' & FileExists($aPathDir_ORG[$i]) & ') ' & @CRLF) ConsoleWrite('! Please wait: Copying ....' & @CRLF) If Not FileExists($aPathDir_ORG[$i]) Then DirCreate($aPathDir_ORG[$i]) If FileExists($aPathDir_BACKUP[$i]) Then $sResult = DirCopy($aPathDir_BACKUP[$i], $aPathDir_ORG[$i], $FC_OVERWRITE) Else $sResult = 0 EndIf Switch $sResult Case 0 ConsoleWrite('+> Result (0): ERROR: Data not restored! (' & $aDirNAME_Path[$i] & ' - FileExists: ' & FileExists($aPathDir_ORG[$i]) & ') ' & @CRLF) $sResult = "[" & $aDirNAME_Path[$i] & "] ERROR: Data not restored!" Case 1 $iResult += 1 ConsoleWrite('+> Result (1): Data restored successfully! (' & $aDirNAME_Path[$i] & ' - FileExists: ' & FileExists($aPathDir_ORG[$i]) & ') ' & @CRLF) $sResult = "[" & $aDirNAME_Path[$i] & "] Data restored successfully!" EndSwitch ; ----------------- $sMessage &= $sResult & @CRLF $sResult = '' ToolTip('') Next ToolTip('') ; ----------------------------------------------- $sMessage &= @CRLF & "Data recovery completed." & @CRLF ; ----------------------------------------------- ToolTip($sMessage, (@DesktopWidth / 2) - 50, 5, "NOTICE!!", 1) Sleep($iSleep_Time) ToolTip('') $sResult = $aPathDir_ORG[0] - $iResult If ($sResult < 1) Then ConsoleWrite('+> Data restored successfully!' & @CRLF) Return True Else ConsoleWrite('!> ERROR: Data not restored!' & @CRLF) Return False EndIf EndFunc ;==>_Restore_RMLData ; ----------------------------------------------- Func _Remove_RMLData_Backup() ; ----------------------------------------------- Local $sResult, $iResult = 0, $sMessage = "Remove data..." & @CRLF & @CRLF ; ----------------------------------------------- For $i = 1 To $aPathDir_BACKUP[0] ToolTip('> Remove: ' & $aPathDir_BACKUP[$i], (@DesktopWidth / 2) - 50, 5, 'Removing data [' & $i & '/' & $aPathDir_BACKUP[0] & '] please wait...') ConsoleWrite('! Remove: ' & $aPathDir_BACKUP[$i] & ' (FileExists: ' & FileExists($aPathDir_BACKUP[$i]) & ') ' & @CRLF) ConsoleWrite('- Please wait: removing...' & @CRLF) If FileExists($aPathDir_BACKUP[$i]) Then $sResult = DirRemove($aPathDir_BACKUP[$i], $DIR_REMOVE) Else $sResult = 1 EndIf Switch $sResult Case 0 ConsoleWrite('+> Result (0): ERROR: Data not Removed! (' & $aDirNAME_Path[$i] & ' - FileExists: ' & FileExists($aPathDir_BACKUP[$i]) & ') ' & @CRLF) $sResult = "[" & $aDirNAME_Path[$i] & "] ERROR: Data not Removed!" Case 1 $iResult += 1 ConsoleWrite('+> Result (1): Data Removed successfully! (' & $aDirNAME_Path[$i] & ' - FileExists: ' & FileExists($aPathDir_BACKUP[$i]) & ') ' & @CRLF) $sResult = "[" & $aDirNAME_Path[$i] & "] Data Removed successfully!" EndSwitch ; ----------------- $sMessage &= $sResult & @CRLF $sResult = '' ToolTip('') Next ToolTip('') ; ----------------------------------------------- $sMessage &= @CRLF & "Data Removal Completed." & @CRLF ; ----------------------------------------------- ToolTip($sMessage, (@DesktopWidth / 2) - 50, 5, "NOTICE!!", 1) Sleep($iSleep_Time) ToolTip('') $sResult = $aPathDir_ORG[0] - $iResult If ($sResult < 1) Then ConsoleWrite('+> Data Removed successfully!' & @CRLF) Return True Else ConsoleWrite('!> ERROR: Data not Removed!' & @CRLF) Return False EndIf EndFunc ;==>_Remove_RMLData_Backup ; ----------------------------------------------- Func _Remove_RMLData_AppDir() ; ----------------------------------------------- Local $sResult, $iResult = 0, $sMessage = "Remove data..." & @CRLF & @CRLF ; ----------------------------------------------- For $i = 1 To $aPathDir_ORG[0] ToolTip('> Remove: ' & $aPathDir_ORG[$i], (@DesktopWidth / 2) - 50, 5, 'Removing data [' & $i & '/' & $aPathDir_ORG[0] & '] please wait...') ConsoleWrite('!> Remove: ' & $aPathDir_ORG[$i] & ' (FileExists: ' & FileExists($aPathDir_ORG[$i]) & ') ' & @CRLF) ConsoleWrite('- Please wait: removing ....' & @CRLF) If FileExists($aPathDir_ORG[$i]) Then $sResult = DirRemove($aPathDir_ORG[$i], $DIR_REMOVE) Else $sResult = 1 EndIf Switch $sResult Case 0 ConsoleWrite('+> Result (0): ERROR: Data not Removed! (' & $aDirNAME_Path[$i] & ' - FileExists: ' & FileExists($aPathDir_ORG[$i]) & ') ' & @CRLF) $sResult = "[" & $aDirNAME_Path[$i] & "] ERROR: Data not Removed!" Case 1 $iResult += 1 ConsoleWrite('+> Result (1): Data Removed successfully! (' & $aDirNAME_Path[$i] & ' - FileExists: ' & FileExists($aPathDir_ORG[$i]) & ') ' & @CRLF) $sResult = "[" & $aDirNAME_Path[$i] & "] Data Removed successfully!" EndSwitch ; ----------------- $sMessage &= $sResult & @CRLF $sResult = '' ToolTip('') Next ToolTip('') ; ----------------------------------------------- $sMessage &= @CRLF & "Data Removal Completed." & @CRLF ; ----------------------------------------------- ToolTip($sMessage, (@DesktopWidth / 2) - 50, 5, "NOTICE!!", 1) Sleep($iSleep_Time) ToolTip('') $sResult = $aPathDir_ORG[0] - $iResult If ($sResult < 1) Then ConsoleWrite('+> Data Removed successfully!' & @CRLF) Return True Else ConsoleWrite('!> ERROR: Data not Removed!' & @CRLF) Return False EndIf EndFunc ;==>_Remove_RMLData_AppDir ; -----------------------------------------------
  8. Thank you AspirinJunkie and pixelsearch for helping make my work easier.
  9. Thanks, I will research further 140 is the sum of the "all products that have been produce" quantity of "all orders" , Each order is 1 line. Column 1 is the total quantity of 1 order Column 2 is the number of products that have been produced Column 3 is the number of remaining unproduced products.
  10. I have to report hourly production and mental calculation or adding up the numbers seems to take a long time, so I'm trying to write a script to do the calculation quickly, but my logic is a bit bad, hope for help! Input data: (The exact data copied from the master management software table can be downloaded from here: https://www.liteon.vn/Big_Data.txt AND https://www.liteon.vn/Lite_Data.txt) N05 8587652 96908-003760A000 FG,GSUBUSW-Flex_NA,Packing FCC (USW 1-Nesscessary FATP FATP_PACKING_02 100 90 10 N Y N05 8587651 96908-003760A000 FG,GSUBUSW-Flex_NA,Packing US (USW 1-Nesscessary FATP FATP_PACKING_02 110 20 80 N Y N05 8587602 96908-003760A000 FG,GSUBUSW-Flex_NA,Packing UK (USW 1-Nesscessary FATP FATP_PACKING_02 105 10 95 N Y N05 8587252 96908-003760A000 FG,GSUBUSW-Flex_NA,Packing ASSY (UK 1-Nesscessary FATP FATP_PACKING_02 120 20 100 N Y N05 8587612 96908-003760A000 FG,GSUBUSW-Flex_NA,Packing FCC (USW 1-Nesscessary FATP FATP_FT_02 100 90 10 N Y N05 8587621 96908-003760A000 FG,GSUBUSW-Flex_NA,Packing US (USW 1-Nesscessary FATP FATP_FT_02 110 20 80 N Y N05 8587632 96908-003760A000 FG,GSUBUSW-Flex_NA,Packing UK (USW 1-Nesscessary FATP FATP_FT_02 105 10 95 N Y N05 8587242 96908-003760A000 FG,GSUBUSW-Flex_NA,Packing ASSY (UK 1-Nesscessary FATP FATP_FT_02 120 20 100 N Y N05 8587612 96908-003760A000 FG,GSUBUSW-Flex_NA,Packing FCC (USW 1-Nesscessary FATP FATP_FT_03 100 90 10 N Y N05 8587621 96908-003760A000 FG,GSUBUSW-Flex_NA,Packing US (USW 1-Nesscessary FATP FATP_FT_03 110 20 80 N Y N05 8587632 96908-003760A000 FG,GSUBUSW-Flex_NA,Packing UK (USW 1-Nesscessary FATP FATP_FT_03 105 10 95 N Y N05 8587242 96908-003760A000 FG,GSUBUSW-Flex_NA,Packing ASSY (UK 1-Nesscessary FATP FATP_FT_03 120 20 100 N Y N06 8584568 96801-002910A000 FG,WPUBUK-Ultra_NA,Packing FCC 1-Nesscessary FATP FATP_PRINT_01 100 10 90 N N N06 8584548 96801-002910A000 FG,WPUBUK-Ultra_NA,Packing US 1-Nesscessary FATP FATP_PRINT_01 101 10 91 N N N06 8584528 96801-002910A000 FG,WPUBUK-Ultra_NA,Packing ASSY (UK 1-Nesscessary FATP FATP_PRINT_01 110 10 100 N N N06 8586247 96801-003400A000 FG,WPUBU7-Pro_NA,Packing ASSY FCC (U7 1-Nesscessary FATP FATP_FT_01 102 12 90 N N N06 8586217 96801-003400A000 FG,WPUBU7-Pro_NA,Packing ASSY US (U7 1-Nesscessary FATP FATP_FT_01 104 14 90 N N N06 8586287 96801-003400A000 FG,WPUBU7-Pro_NA,Packing ASSY (UK 1-Nesscessary FATP FATP_FT_01 108 10 98 N N The table displays the desired output: PROCESS >>> |FATP_PACKING_02 | FATP_FT_01| FATP_FT_02 | FATP_FT_03| FATP_PRINT_01 MODEL ⇓ GSUBUSW-Flex | 140 | 0 | 140 | 140 | 0 WPUBUK-Ultra | 0 | 0 | 0 | 0 | 30 WPUBU7-Pro | 0 | 36 | 0 | 0 | 0 GSUBUSW-Flex FATP_PACKING_02 | 140 FATP_FT_02 | 140 FATP_FT_03 | 140 WPUBUK-Ultra FATP_PRINT_01 | 30 WPUBU7-Pro FATP_FT_01 | 36 I am stuck on how to save and retrieve data from array: #include <Array.au3> _GetYield() Func _GetYield() Global $aPROCESS_List = StringSplit('PC MAP-CASE|PC-AS-LQC|FATP-AS-GULE Filling1|FATP-AS-GULE Filling2|PC-BI-INPUT|PC-BI-OUTPUT|PC-PK-LOAD|PC-PK-HIPOT1|PC-PK-FIN-ATE1|PC-PK-PF-TEST1|PC-PK-UNLOAD|PC-PK-LQC2|PC-PK-LQC1|PC-PK-PACKING|PC-OQC|SMT_TOP_MAPPING_02|SMT_TOP_AOI|PWR-PC-HI-INPUT|PC_TU_ICT|PC_TU_INT|AI_INPUT|AI_OUTPUT|RI_INPUT|RI_OUTPUT|RI_VMI|SMT_TOP_INPUT|SMT_TOP_MOUNT|PC-PK-LASER|SMT_BOT_MAPPING_01|SMT_BOT_AOI|PC-USW-01|FATP-AS-USW-check1|FATP-AS-USW-Check2|PC-TU-INT-R|PK-AS-Thrust|PC-AS-LQC1|PC-PK-MAP-More material|SMT_BOT_INPUT|SMT_BOT_MOUNT|NB-KB-CHAS-Input|NB-KB-CHAS-AOI|NB-KB-CHAS-Packing|PC_Packing|PC_ASSY2|PC_Check|PC_QC|FATP_ASSY_06|Packing_OQC|DIP_INPUT|DIP_VMI_01|DIP_PACKING|DIP_OBA|FATP_INPUT|FATP_PCBA_01|FATP_PCBA_02|FATP_RUN IN|FATP_FT_01|FATP_PRINT_01|FATP_AOI_03|FATP_PRINT_02|FATP_AOI_04|FATP_AOI_05|FATP_PACKING_02|FATP_PCBA_03|FATP_LASER|FATP_AOI_01|FATP_FT_02|FATP_FT_03|FATP_ASSY_01|FATP_HIPOT_TEST|FATP_BURN_IN|FATP_FT_04|FATP_FT_05|FATP_MAPPING_01|FATP_Leak Test|FATP_AOI_02|FATP_FCD TEST|FATP_ASSY_LCM|FATP_AOI_06|FATP_VMI_01|PC_Packing_SP|PC_CCD|PC_Check_SP|Tampo|KM_ASM_Cosmetic|KM_TES_ATE|KM_ASM_Mapping|KM_ASM_Box|KM_PAC_Carton|PC_OQC|KM_PAC_Pallet|KM_TES_AOI|KM_TES_Pair test|KM_FATP_KB_Input|KM_TES_RF test|KM_Semi_Output|QC-FT01|FATP_FT_06|QC-FT02|FATP_ASSY_02|KM_ASM_SN|FATP_OQC|KM_ASM_Input|KM_TES_bluetooth|KM_TES_Backlight|FATP-LASER_02|QC_IR_TEST|QC-FT04|FATP_ASSY_04|FATP_AOI_07|FATP_AOI_08|FATP_ASSY_03|FATP_CHECK|FATP_PRINT_03|FATP_GLUE_IN|FATP_GLUE_OUT|FATP_TEST_PULL|FATP_Leak Test02|FATP_PCBA_04|PL_PACKING|SMT_BOT_PRINT|DIP_TU|DIP_PCBA_01|DIP_PCBA Test02|DIP_Funtion Test|DIP_OQC|DIP_INSERT_01|DIP_PCBA Test03|DIP_WAVESOLDER|DIP_RF Test|DIP_Assy 01|DIP_ICT_01|DIP_ICT_02|SMT Laser|CIPS-TU-FUNCTION|DIP_FCD_01|PWR-PC-HI-LQC|RI_Mapping|DIP_AOI_01|COB_INPUT|COB_Test_01|COB_Test_02|COB_VMI|SMT_XRAY_BOT|DIP_ Tes Wheel|SMT_TOP_VMI|DIP_Test ADD FW|DIP_Test Adaptor 1|DIP_Test Adaptor 2|DIP_Keo|DIP_TEST FW|CIPS-HISN-MAP|CIPS-TU-LQC1-MAP|CIPS-TU-LeadLength|CIPS-TU-AOI-Check|CIPS-TU-ICT|CIPS-TU-LQC2|CIPS-AS-LQC1|AS-SSN-MAP|CIPS-AS-FRU-W|CIPS-AS-IAC|CIPS-AS-PRE-ATE|CIPS-BI-Input|CIPS-BI-Output|CIPS-PK-PRINT|CIPS-PK-Hipot|CIPS-PK-FINAL-ATE|CIPS-PK-FRU-V|CIPS-PK-Measure|CIPS-PK-LQC1|CIPS-PK-LQC2|CIPS-Packing|SMT_Test_ICT|FATP_PACKING_05|PS_QC|PS_Machine|PS_Packing|PL_OBA|PL_Machine_4201|PL_Machine_4202|SMT_OBA|SMT_TOP_SPI|SMT_TOP_AOI_BR|SMT_TOP_MOUNT_02|SMT_PACKING|NB-KB-FINAL-Pull Key|NB-KB-FINAL-LED Test|NB-KB-FINAL-Autofeeling|NB-KB-FINAL-BL Test|NB-KB-FINAL-FQC|NB-KB-FINAL-AOI|NB-KB-FINAL-Packing|NB-KB-FINAL-OBA|NB-KB-FINAL-Input|NB-KB-FINAL-VI|KM_ASM_Flatness|KM_ASM_AOI|PC-PK-SCP-OVP|PC-PK-FIN-ATE2|PC-AS-ICBURN|PC-AS-PT|PC-PK-MAP-Cable|CIPS-PK-ACC-V|CIPS-OQC-Hipot|CIPS-OQC-ATE|CIPS-OQC-FRU-V|PC_TU_LQC1|PC-OQC-HIPOT|PC-OQC-ATE|PC-PK-FAN LED|PC-PK-SDQ|PC-PK-LQC3|PC-PK-LQC4|PC MAP-CASE-CCD|PC-AS-Leak test|PC-TU-AOI|PC-AS-LQC2|PC-PK-ID-SSN-MAP|PC-PK-ID-SSN-MAP-READ', '|') Global $aMODEL_List Local $CSV_Yield = ClipGet() If Not StringInStr($CSV_Yield, @TAB) Then $CSV_Yield = FileRead(@ScriptDir & "\Lite_Data.txt") ;MsgBox(48 + 262144, 'Yield Report', 'Please COPY ' & @CRLF & 'PDLINE_NAME' & @CRLF & 'WORK_ORDER' & @CRLF & 'PART_NO' & @CRLF & 'MODEL_NAME' & @CRLF & 'PROCESS_TYPE' & @CRLF & 'STAGE_NAME' & @CRLF & 'PROCESS_NAME' & @CRLF & 'TARGET_QTY' & @CRLF & 'OUTPUT_QTY' & @CRLF & 'WAIT_INPUT' & @CRLF & 'STAGE_INPUT' & @CRLF & 'STAGE_OUTPUT' & @CRLF &'xong thi BAM OK', 60) ;$CSV_Yield = ClipGet() EndIf If Not StringInStr($CSV_Yield, @TAB) Then Exit $CSV_Yield = StringReplace($CSV_Yield, @CRLF, @LF) $CSV_Yield = StringReplace($CSV_Yield, @TAB, '|') While StringInStr($CSV_Yield, ' ' & ' ') $CSV_Yield = StringReplace($CSV_Yield, ' ' & ' ', ' ') WEnd Local $NewContent, $iNewContent, $xNewContent, $PROCESS_List, $MODEL_List Local $aLine, $iLine, $aArray_Yield = StringSplit($CSV_Yield, @LF) If IsArray($aArray_Yield) Then Local $iModelName, $iProcessName, $iOutput Local $a_PROCESS_List[1], $a_MODEL_List[1] For $i = 1 To $aArray_Yield[0] $aLine = StringSplit($aArray_Yield[$i], '|', 3) If IsArray($aLine) Then If UBound($aLine) > 8 Then _Get_Info($iModelName, $iProcessName, $iOutput, $aArray_Yield[$i]) If (StringLen($iModelName) > 1) And (StringLen($iProcessName) > 1) And ($iOutput > 0) Then If Not StringInStr($MODEL_List, $iModelName) Then $MODEL_List&=$iModelName&'|' If Not StringInStr($PROCESS_List, $iProcessName) Then $PROCESS_List&=$iModelName&'|' _ArrayAdd($a_MODEL_List, $iModelName) _ArrayAdd($a_PROCESS_List, $iProcessName) EndIf EndIf EndIf $iModelName = '' $iProcessName = '' $iOutput = 0 $aLine = 0 Next _ArrayUnique($a_MODEL_List) _ArrayUnique($a_PROCESS_List) ;~ For $i = 1 To $aArray_Yield[0] ;~ ;ConsoleWrite("$a [" & $i & "] _ " & $aArray_Yield[$i] & @CRLF) ;~ $aLine = StringSplit($aArray_Yield[$i], '|', 3) ;~ If IsArray($aLine) Then ;~ If UBound($aLine) > 8 Then ;~ ;ConsoleWrite('-$aLine: '&UBound($aLine)&@CRLF) ;~ _Get_Info($iModelName, $iProcessName, $iOutput, $aArray_Yield[$i]) ;~ If (StringLen($iModelName) > 1) And (StringLen($iProcessName) > 1) And ($iOutput > 0) Then ;~ ;ConsoleWrite('-Model: ' & $iModelName & ' -Process: ' & $iProcessName & ' -Output: ' & $iOutput & @CRLF) ;~ ; Array: MODEL | PROCESS | OUTPUT ;~ ;~ ; | PROCESS_1 | PROCESS_2 | PROCESS_3 | PROCESS_N ;~ ;MODEL_1 | OUTPUT_X | OUTPUT_X | OUTPUT_X | OUTPUT_X ;~ ;MODEL_2 | OUTPUT_X | OUTPUT_X | OUTPUT_X | OUTPUT_X ;~ ;MODEL_3 | OUTPUT_X | OUTPUT_X | OUTPUT_X | OUTPUT_X ;~ ;MODEL_N | OUTPUT_X | OUTPUT_X | OUTPUT_X | OUTPUT_X ;~ EndIf ;~ EndIf ;~ EndIf ;~ $iModelName = '' ;~ $iProcessName = '' ;~ $iOutput = 0 ;~ $aLine = 0 ;~ Next EndIf ;~ ConsoleWrite($MODEL_List&@CRLF) ;~ ConsoleWrite($PROCESS_List&@CRLF) ;~ ConsoleWrite($xNewContent&@CRLF) ;~ ConsoleWrite($NewContent&@CRLF) EndFunc ;==>_TinhYield Func _Get_Info(ByRef $iModelName, ByRef $iProcessName, ByRef $iOutput, $iLine = '|') Local $aLine = StringSplit($iLine, '|', 3) If IsArray($aLine) Then If (UBound($aLine) > 8) Then $iLine = _Get_ModelName($aLine[4]) If (StringLen($iLine) > 1) Then ;ConsoleWrite('-$aLine: '&UBound($aLine)&@CRLF) $iModelName = $iLine $iProcessName = $aLine[7] If Int($aLine[9]) > 0 Then $iOutput = $aLine[9] Else $iOutput = 0 EndIf ;ConsoleWrite('-Model: '&$aLine[4]&' -Process: '&$aLine[7]&' -Output: '&$aLine[9]&@CRLF) EndIf EndIf EndIf EndFunc ;==>_Get_Info Func _Get_ModelName($iLine = ',,,,', $iRetunNoCountry = True) Local $aLine = StringSplit($iLine & ',,,,', ',', 3) If IsArray($aLine) Then StringReplace($iLine, ',', '') If (@extended < 2) Then If (StringLen($aLine[0]) > 1) And (StringLen($aLine[1]) > 1) Then ;ConsoleWrite('-0: ' & $aLine[0] & ' -1: ' & $aLine[1] & ' -2: ' & $aLine[2] & ' -3: ' & $aLine[3] & @CRLF) $iLine = StringReplace($aLine[0] & '_' & $aLine[1], ' ', '-') Return $iLine EndIf Else If (StringLen($aLine[1]) > 1) Then ;ConsoleWrite('-0: ' & $aLine[0] & ' -1: ' & $aLine[1] & ' -2: ' & $aLine[2] & ' -3: ' & $aLine[3] & @CRLF) $iLine = StringReplace($aLine[1], '_NA', '') If (StringStripWS($iLine, 8) <> '') Then If $iRetunNoCountry Then Return $iLine If StringInStr($aLine[2], 'Packing ASSY FCC') Then Return $iLine & '_FCC' ElseIf StringInStr($aLine[2], 'Packing ASSY US') Then Return $iLine & '_US' ElseIf StringInStr($aLine[2], 'Packing ASSY WW') Then Return $iLine & '_WW' ElseIf StringInStr($aLine[2], 'Packing ASSY EU') Then Return $iLine & '_EU' ElseIf StringInStr($aLine[2], 'Packing ASSY UK') Then Return $iLine & '_UK' Else Return $iLine EndIf EndIf Return '' EndIf EndIf EndIf EndFunc ;==>_Get_ModelName Thanks a lot
  11. LOL It looks similar to your script but I created it from Computer Info UDF HTML I took from a vbs file at my company NAS.
  12. I created the relay server myself and installed RustDesk using the auto install script via ps. It seems your UDF is not detecting it.
  13. Get system information and Create reports in HTML and CSV format: ;#NoTrayIcon ;Opt("MustDeclareVars", 1) Global $oMyError = ObjEvent("AutoIt.Error", "__PCinfo_ObjErrorFunc") Global Const $cI_CompName = @ComputerName, $sBlankMAC = "00:00:00:00:00:00", $ERR_NO_INFO = "Array contains no information", $ERR_NOT_OBJ = "$colItems isnt an object" Global $isWin64 = False, $softCount = 0, $sAdapterInfo If StringInStr(@OSArch, "64") Then $isWin64 = True Global $Report_SaveDir = @ScriptDir If Not __PCinfo_Singleton("PC_Scan_Info") Then Exit If Not FileExists($Report_SaveDir) Then DirCreate($Report_SaveDir) Global $sHTML_Content, $sFilePath_SaveHTML = $Report_SaveDir & "\" & @ComputerName & "_HTML.htm" Global $sLogs_Content, $sFilePath_SaveLog = $Report_SaveDir & "\" & @ComputerName & "_Csv.log" _Get_PCinformation() Func _Get_PCinformation() ToolTip('System Info Getting...', (@DesktopWidth / 2) - 20, 10) __PCinfo_HTML_AddHeader(@ComputerName & " System Information") Local $error, $extended, $sPC_Info $sPC_Info &= @CRLF Local $__PCinfo_Get_SysOverview = __PCinfo_Get_SysOverview() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_SysOverview') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_SysOverview') EndSwitch Else __Write_PCinfo($__PCinfo_Get_SysOverview, 'System_Overview', @ComputerName & ',System Infomation') EndIf Local $Network_Adapters = __PCinfo_Get_AdaptersInfo() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_AdaptersInfo') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_AdaptersInfo') EndSwitch Else __Write_PCinfo($Network_Adapters, 'Network_Adapters', 'Index,Network_Adapters,Name,Status,IPType,IP,SubNetIP,MAC,GetwayIP,MAC,Speed,DNS1,DNS2,DNS3,DNS4,DNS5,DNS6,DNS7,DNS8,DNS_Num') EndIf $sPC_Info &= @CRLF Local $Drives = __PCinfo_Get_Drives() If @error Then $error = @error $extended = @extended __PCinfo_DebugMsg("DriveGetDrive Error!", '__PCinfo_Get_Drives') Else __Write_PCinfo($Drives, 'Drives', 'Drive,DriveType,DriveStatus,FileSystem,Label,Serial,SpaceFree(GB),SpaceTotal(GB),DriveBusType,MapTo,IsSSD') EndIf $sPC_Info &= @CRLF Local $SystemProduct = __PCinfo_Get_SystemProduct() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_SystemProduct') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_SystemProduct') EndSwitch Else __Write_PCinfo($SystemProduct, 'SystemProduct', 'Name,IdentifyingNumber,SKUNumber,UUID,Description,Vendor,Version') EndIf $sPC_Info &= @CRLF Local $OSs = __PCinfo_Get_OSs() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_OSs') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_OSs') EndSwitch Else __Write_PCinfo($OSs, 'OS', 'Name,BootDevice,BuildNumber,BuildType,Description,CodeSet,CountryCode,CreationClassName,CSCreationClassName,CSDVersion,CSName,CurrentTimeZone,DataExecutionPrevention_32BitApplications,DataExecutionPrevention_Available,DataExecutionPrevention_Drivers,DataExecutionPrevention_SupportPolicy,Debug,Distributed,EncryptionLevel,ForegroundApplicationBoost,FreePhysicalMemory,FreeSpaceInPagingFiles,FreeVirtualMemory,InstALLDate,LargeSystemCache,LastBootUpTime,LocalDateTime,Locale,Manufacturer,MaxNumberOfProcesses,MaxProcessMemorySize,NumberOfLicensedUsers,NumberOfProcesses,NumberOfUsers,Organization,OSLanguage,OSProductSuite,OSType,OtherTypeDescription,PlusProductID,PlusVersionNumber,Primary,ProductType,QuantumLength,QuantumType,RegisteredUser,SerialNumber,ServicePackMajorVersion,ServicePackMinorVersion,SizeStoredInPagingFiles,Status,SuiteMask,SystemDevice,SystemDirectory,SystemDrive,TotalSwapSpaceSize,TotalVirtualMemorySize,TotalVisibleMemorySize,Version,WindowsDirectory') EndIf $sPC_Info &= @CRLF Local $Users = __PCinfo_Get_Users() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Users') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Users') EndSwitch Else __Write_PCinfo($Users, 'Users', 'Name,Domain,Status,LocalAccount,SID,SIDType,Description,FullName,Disabled,Lockout,PasswordChangeable,PasswordExpires,PasswordRequired,AccountType') EndIf $sPC_Info &= @CRLF Local $Groups = __PCinfo_Get_Groups() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Groups') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Groups') EndSwitch Else __Write_PCinfo($Groups, 'Groups', 'Name,Domain,Status,LocalAccount,SID,SIDType,Description') EndIf $sPC_Info &= @CRLF Local $sFilePath_SaveHTMLgedOnUser = __PCinfo_Get_LoggedOnUsers() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_LoggedOnUsers') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_LoggedOnUsers') EndSwitch Else __Write_PCinfo($sFilePath_SaveHTMLgedOnUser, 'Logged Users', 'DomainName,UserName,LogonID') EndIf Local $Desktop = __PCinfo_Get_Desktops() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Desktops') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Desktops') EndSwitch Else __Write_PCinfo($Desktop, 'Desktops', 'Name,BorderWidth,CoolSwitch,CursorBlinkRate,Description,DragFullWindows,GridGranularity,IconSpacing,IconTitleFaceName,IconTitleSize,IconTitleWrap,Pattern,ScreenSaverActive,ScreenSaverExecutable,ScreenSaverSecure,ScreenSaverTimeout,SettingID,WALLpaper,WALLpaperStretched,WALLpaperTiled') EndIf $sPC_Info &= @CRLF Local $Shares = __PCinfo_Get_Shares() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Shares') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Shares') EndSwitch Else __Write_PCinfo($Shares, 'Shares', 'Name,AccessMask,ALLowMaximum,MaximumALLowed,Description,Path,Status,Type') EndIf $sPC_Info &= @CRLF Local $Startup = __PCinfo_Get_Startup() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Startup') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Startup') EndSwitch Else __Write_PCinfo($Startup, 'Startup', 'Name,User,Location,Command,Description,SettingID') EndIf $sPC_Info &= @CRLF Local $System = __PCinfo_Get_System() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_System') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_System') EndSwitch Else __Write_PCinfo($System, 'System', 'Name,AdminPasswordStatus,AutomaticResetBootOption,AutomaticResetCapability,Description,BootOptionOnLimit,BootOptionOnWatchDog,BootROMSupported,BootupState,ChassisBootupState,CreationClassName,CurrentTimeZone,DaylightInEffect,Domain,DomainRole,EnableDaylightSavingsTime,FrontPanelResetStatus,InfraredSupported,InitiALLoadInfo,KeyboardPasswordStatus,LastLoadInfo,Manufacturer,Model,NameFormat,NetworkServerModeEnabled,NumberOfProcessors,OEMLogoBitmap,OEMStringArray,PartOfDomain,PauseAfterReset,PowerManagementCapabilities,PowerManagementSupported,PowerOnPasswordStatus,PowerState,PowerSupplyState,PrimaryOwnerContact,PrimaryOwnerName,ResetCapability,ResetCount,ResetLimit,Roles,Status,SupportContactDescription,SystemStartupDelay,SystemStartupOptions,SystemStartupSetting,SystemType,ThermalState,TotalPhysicalMemory,UserName,WakeUpType,Workgroup') EndIf $sPC_Info &= @CRLF Local $BIOS = __PCinfo_Get_BIOS() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_BIOS') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_BIOS') EndSwitch Else __Write_PCinfo($BIOS, 'BIOS', 'Name,Status,BIOSCharacteristics,BIOSVersion,Description,BuildNumber,CodeSet,CurrentLanguage,IdentificationCode,InstALLableLanguages,LanguageEdition,ListofLanguages,Manufacturer,OtherTargetOS,PrimaryBIOS,ReleaseDate,SerialNumber,SMBIOSBIOSVersion,SMBIOSMajorVersion,SMBIOSMinorVersion,SMBIOSPresent,SoftwareElementID,SoftwareElementState,TargetOperatingSystem,Version') EndIf $sPC_Info &= @CRLF Local $Keyboard = __PCinfo_Get_Keyboard() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Keyboard') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Keyboard') EndSwitch Else __Write_PCinfo($Keyboard, 'Keyboard', 'Name,Availability,ConfigManagerErrorCode,ConfigManagerUserConfig,Description,CreationClassName,DeviceID,ErrorCleared,ErrorDescription,IsLocked,LastErrorCode,Layout,NumberofFunctionKeys,Password,PNPDeviceID,PowerManagementCapabilities,PowerManagementSupported,Status,StatusInfo,SystemCreationClassName,SystemName') EndIf $sPC_Info &= @CRLF Local $Memory = __PCinfo_Get_Memory() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Memory') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Memory') EndSwitch Else __Write_PCinfo($Memory, 'Memory', 'Name,BankLabel,Capacity,CreationClassName,Description,DataWidth,DeviceLocator,FormFactor,HotSwappable,InterleaveDataDepth,InterleavePosition,Manufacturer,MemoryType,Model,OtherIdentifyingInfo,PartNumber,PositionInRow,PoweredOn,Removable,Replaceable,SerialNumber,SKU,Speed,Status,Tag,TotalWidth,TypeDetail,Version') EndIf $sPC_Info &= @CRLF Local $Monitor = __PCinfo_Get_Monitors() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Monitors') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Monitors') EndSwitch Else __Write_PCinfo($Monitor, 'Monitor', 'Name,Availability,Bandwidth,ConfigManagerErrorCode,Description,ConfigManagerUserConfig,CreationClassName,DeviceID,DisplayType,ErrorCleared,ErrorDescription,IsLocked,LastErrorCode,MonitorManufacturer,MonitorType,PixelsPerXLogicalInch,PixelsPerYLogicalInch,PNPDeviceID,PowerManagementCapabilities,PowerManagementSupported,ScreenHeight,ScreenWidth,Status,StatusInfo,SystemCreationClassName,SystemName') EndIf $sPC_Info &= @CRLF Local $Motherboard = __PCinfo_Get_Motherboard() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Motherboard') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Motherboard') EndSwitch Else __Write_PCinfo($Motherboard, 'Motherboard', 'Name,Availability,ConfigManagerErrorCode,ConfigManagerUserConfig,Description,CreationClassName,DeviceID,ErrorCleared,ErrorDescription,LastErrorCode,PNPDeviceID,PowerManagementCapabilities,PowerManagementSupported,PrimaryBusType,RevisionNumber,SecondaryBusType,Status,StatusInfo,SystemCreationClassName,SystemName') EndIf $sPC_Info &= @CRLF Local $Mouse = __PCinfo_Get_Mouse() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Mouse') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Mouse') EndSwitch Else __Write_PCinfo($Mouse, 'Mouse', 'Name,Availability,ConfigManagerErrorCode,ConfigManagerUserConfig,Description,CreationClassName,DeviceID,DeviceInterface,DoubleSpeedThreshold,ErrorCleared,ErrorDescription,Handedness,HardwareType,InfFileName,InfSection,IsLocked,LastErrorCode,Manufacturer,NumberOfButtons,PNPDeviceID,PointingType,PowerManagementCapabilities,PowerManagementSupported,QuadSpeedThreshold,Resolution,SampleRate,Status,StatusInfo,Synch,SystemCreationClassName,SystemName') EndIf $sPC_Info &= @CRLF Local $NetworkCards = __PCinfo_Get_NetworkCards() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_NetworkCards') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_NetworkCards') EndSwitch Else __Write_PCinfo($NetworkCards, 'NetworkCards', 'Name,AdapterType,AdapterTypeID,AutoSense,Description,Availability,ConfigManagerErrorCode,ConfigManagerUserConfig,CreationClassName,DeviceID,ErrorCleared,ErrorDescription,Index,InstALLed,LastErrorCode,MACAddress,Manufacturer,MaxNumberControlled,MaxSpeed,NetConnectionID,NetConnectionStatus,NetworkAddresses,PermanentAddress,PNPDeviceID,PowerManagementCapabilities,PowerManagementSupported,ProductName,ServiceName,Speed,Status,StatusInfo,SystemCreationClassName,SystemName,TimeOfLastReset') EndIf $sPC_Info &= @CRLF Local $Print = __PCinfo_Get_Printers() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Printers') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Printers') EndSwitch Else __Write_PCinfo($Print, 'Print', 'Name,Attributes,Availability,AvailableJobSheets,Description,AveragePagesPerMinute,Capabilities,CapabilityDescriptions,CharSetsSupported,Comment,ConfigManagerErrorCode,ConfigManagerUserConfig,CreationClassName,CurrentCapabilities,CurrentCharSet,CurrentLanguage,CurrentMimeType,CurrentNaturALLanguage,CurrentPaperType,Default,DefaultCapabilities,DefaultCopies,DefaultLanguage,DefaultMimeType,DefaultNumberUp,DefaultPaperType,DefaultPriority,DetectedErrorState,DeviceID,Direct,DoCompleteFirst,DriverName,EnableBIDI,EnableDevQueryPrint,ErrorCleared,ErrorDescription,ErrorInformation,ExtendedDetectedErrorState,ExtendedPrinttatus,Hidden,HorizontalResolution,JobCountSinceLastReset,KeepPrintedJobs,LanguagesSupported,LastErrorCode,Local,Location,MarkingTechnology,MaxCopies,MaxNumberUp,MaxSizeSupported,MimeTypesSupported,NaturALLanguagesSupported,Network,PaperSizesSupported,PaperTypesAvailable,Parameters,PNPDeviceID,PortName,PowerManagementCapabilities,PowerManagementSupported,PrinterPaperNames,Printtate,Printtatus,PrintJobDataType,PrintProcessor,Priority,Published,Queued,RawOnly,SeparatorFile,ServerName,Shared,ShareName,SpoolEnabled,Status,StatusInfo,SystemCreationClassName,SystemName,VerticalResolution,WorkOffline') EndIf $sPC_Info &= @CRLF Local $Processors = __PCinfo_Get_Processors() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Processors') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Processors') EndSwitch Else __Write_PCinfo($Processors, 'Processors', 'Name,AddressWidth,Architecture,Availability,Description,ConfigManagerErrorCode,ConfigManagerUserConfig,CPUStatus,CreationClassName,CurrentClockSpeed,CurrentVoltage,DataWidth,DeviceID,ErrorCleared,ErrorDescription,ExtClock,Family,L2CacheSize,L2CacheSpeed,LastErrorCode,Level,LoadPercentage,Manufacturer,MaxClockSpeed,OtherFamilyDescription,PNPDeviceID,PowerManagementCapabilities,PowerManagementSupported,ProcessorID,ProcessorType,Revision,Role,SocketDesignation,Status,StatusInfo,Stepping,SystemCreationClassName,SystemName,UniqueID,UpgradeMethod,Version,VoltageCaps') EndIf $sPC_Info &= @CRLF Local $SoundCards = __PCinfo_Get_SoundCards() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_SoundCards') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_SoundCards') EndSwitch Else __Write_PCinfo($SoundCards, 'SoundCards', 'Name,Availability,ConfigManagerErrorCode,ConfigManagerUserConfig,Description,CreationClassName,DeviceID,DMABufferSize,ErrorCleared,ErrorDescription,LastErrorCode,Manufacturer,MPU401Address,PNPDeviceID,PowerManagementCapabilities,PowerManagementSupported,ProductName,Status,StatusInfo,SystemCreationClassName,SystemName') EndIf $sPC_Info &= @CRLF Local $VideoCards = __PCinfo_Get_VideoCards() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_VideoCards') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_VideoCards') EndSwitch Else __Write_PCinfo($VideoCards, 'VideoCards', 'Name,AcceleratorCapabilities,AdapterCompatibility,AdapterDACType,Description,AdapterRAM,Availability,CapabilityDescriptions,ColorTableEntries,ConfigManagerErrorCode,ConfigManagerUserConfig,CreationClassName,CurrentBitsPerPixel,CurrentHorizontalResolution,CurrentNumberOfColors,CurrentNumberOfColumns,CurrentNumberOfRows,CurrentRefreshRate,CurrentScanMode,CurrentVerticalResolution,DeviceID,DeviceSpecificPens,DitherType,DriverDate,DriverVersion,ErrorCleared,ErrorDescription,ICMIntent,ICMMethod,InfFilename,InfSection,InstALLedDisplayDrivers,LastErrorCode,MaxMemorySupported,MaxNumberControlled,MaxRefreshRate,MinRefreshRate,Monochrome,NumberOfColorPlanes,NumberOfVideoPages,PNPDeviceID,PowerManagementCapabilities,PowerManagementSupported,ProtocolSupported,ReservedSystemPaletteEntries,SpecificationVersion,Status,StatusInfo,SystemCreationClassName,SystemName,SystemPaletteEntries,TimeOfLastReset,VideoArchitecture,VideoMemoryType,VideoMode,VideoModeDescription,VideoProcessor') EndIf $sPC_Info &= @CRLF Local $Software = __PCinfo_Get_Software() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Software') EndSwitch Else __Write_PCinfo($Software, 'Software', 'DisplayName,DisplayVersion,Publisher,InstALLDate,EstimatedSize,NoElevateOnModify,NoModify,NoRemove,NoRepair,InstALLLocation,UninstALLString') EndIf $sPC_Info &= @CRLF Local $Services = __PCinfo_Get_Services("ALL") If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Services') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Services') EndSwitch Else __Write_PCinfo($Services, 'Services', 'Name,State,Status,AcceptPause,AcceptStop,CheckPoint,CreationClassName,DesktopInteract,DisplayName,ErrorControl,ExitCode,PathName,ProcessId,ServiceSpecificExitCode,ServiceType,Started,StartMode,StartName,SystemCreationClassName,SystemName,TagId,WaitHint,Descriptiont') EndIf $sPC_Info &= @CRLF Local $Battery = __PCinfo_Get_Battery() If @error Then $error = @error $extended = @extended Switch $extended Case 1 __PCinfo_DebugMsg($ERR_NO_INFO, '__PCinfo_Get_Battery') Case 2 __PCinfo_DebugMsg($ERR_NOT_OBJ, '__PCinfo_Get_Battery') EndSwitch Else __Write_PCinfo($Battery, 'Battery', 'Name,Availability,BatteryRechargeTime,BatteryStatus,Description,Chemistry,ConfigManagerErrorCode,ConfigManagerUserConfig,CreationClassName,DesignCapacity,DesignVoltage,DeviceID,ErrorCleared,ErrorDescription,EstimatedChargeRemaining,EstimatedRunTime,ExpectedBatteryLife,ExpectedLife,FullChargeCapacity,LastErrorCode,MaxRechargeTime,PNPDeviceID,PowerManagementCapabilities,PowerManagementSupported,SmartBatteryVersion,Status,StatusInfo,SystemCreationClassName,SystemName,TimeOnBattery,TimeToFullCharge') EndIf __PCinfo_HTML_AddFooter() Global $hO_HTML = FileOpen($sFilePath_SaveHTML, 2 + 8 + 128) FileWrite($hO_HTML, $sHTML_Content) FileClose($hO_HTML) ShellExecute($sFilePath_SaveHTML) Global $hO_Logs = FileOpen($sFilePath_SaveLog, 2 + 8 + 128) FileWrite($hO_Logs, $sLogs_Content) FileClose($hO_Logs) ShellExecute($sFilePath_SaveLog) ToolTip('') Return $sPC_Info EndFunc ;==>_Get_PCinformation Func __Write_PCinfo(ByRef $iArray, $sTitle, $iHeader) __PCinfo_Write_Array2HTML($iArray, $sTitle, $iHeader) __PCinfo_Write_Array2CSVlog($iArray, $sTitle, $iHeader) EndFunc ;==>__Write_PCinfo Func __PCinfo_DebugMsg($message, $time = 0) ConsoleWrite("! Error: " & $message & ' - Time: ' & $time & @CRLF) EndFunc ;==>__PCinfo_DebugMsg Func __PCinfo_Get_Drives($sDriveType = "ALL") Local $cDrive Local $aArray = DriveGetDrive($sDriveType) If @error Then Return Else Dim $aDriveInfo[UBound($aArray)][11] $aDriveInfo[0][0] = $aArray[0] For $i = 1 To $aArray[0] $cDrive = StringUpper($aArray[$i]) $aDriveInfo[$i][0] = $cDrive & '\' $sDriveType = DriveGetType($cDrive) $aDriveInfo[$i][1] = $sDriveType $aDriveInfo[$i][2] = DriveStatus($cDrive) $aDriveInfo[$i][3] = DriveGetFileSystem($cDrive) $aDriveInfo[$i][4] = DriveGetLabel($cDrive) $aDriveInfo[$i][5] = DriveGetSerial($cDrive) $aDriveInfo[$i][6] = Round(DriveSpaceFree($cDrive) / 1024, 2) $aDriveInfo[$i][7] = Round(DriveSpaceTotal($cDrive) / 1024, 2) $aDriveInfo[$i][8] = DriveGetType($cDrive, 3) Switch $sDriveType Case "Network" $aDriveInfo[$i][9] = DriveMapGet($cDrive) $aDriveInfo[$i][8] = 'SMB' Case "Fixed" $aDriveInfo[$i][10] = (StringUpper(DriveGetType($cDrive, 2)) == 'SSD') ? True : False EndSwitch $sDriveType = '' Next Return $aDriveInfo EndIf Return SetError(1, 0, 0) EndFunc ;==>__PCinfo_Get_Drives Func __PCinfo_Get_Desktops() Local $colItems, $objWMIService, $objItem Dim $aDesktopInfo[1][20], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Desktop", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aDesktopInfo[UBound($aDesktopInfo) + 1][20] $aDesktopInfo[$i][0] = $objItem.Name $aDesktopInfo[$i][1] = $objItem.BorderWidth $aDesktopInfo[$i][2] = $objItem.CoolSwitch $aDesktopInfo[$i][3] = $objItem.CursorBlinkRate $aDesktopInfo[$i][4] = $objItem.Description $aDesktopInfo[$i][5] = $objItem.DragFullWindows $aDesktopInfo[$i][6] = $objItem.GridGranularity $aDesktopInfo[$i][7] = $objItem.IconSpacing $aDesktopInfo[$i][8] = $objItem.IconTitleFaceName $aDesktopInfo[$i][9] = $objItem.IconTitleSize $aDesktopInfo[$i][10] = $objItem.IconTitleWrap $aDesktopInfo[$i][11] = $objItem.Pattern $aDesktopInfo[$i][12] = $objItem.ScreenSaverActive $aDesktopInfo[$i][13] = $objItem.ScreenSaverExecutable $aDesktopInfo[$i][14] = $objItem.ScreenSaverSecure $aDesktopInfo[$i][15] = $objItem.ScreenSaverTimeout $aDesktopInfo[$i][16] = $objItem.SettingID $aDesktopInfo[$i][17] = $objItem.WALLpaper $aDesktopInfo[$i][18] = $objItem.WALLpaperStretched $aDesktopInfo[$i][19] = $objItem.WALLpaperTiled $i += 1 Next $aDesktopInfo[0][0] = UBound($aDesktopInfo) - 1 If $aDesktopInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aDesktopInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Desktops Func __PCinfo_Get_Groups() Local $colItems, $objWMIService, $objItem Dim $aGroupInfo[1][7], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Group", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aGroupInfo[UBound($aGroupInfo) + 1][7] $aGroupInfo[$i][0] = $objItem.Name $aGroupInfo[$i][1] = $objItem.Domain $aGroupInfo[$i][2] = $objItem.Status $aGroupInfo[$i][3] = $objItem.LocalAccount $aGroupInfo[$i][4] = $objItem.Description $aGroupInfo[$i][5] = $objItem.SID $aGroupInfo[$i][6] = $objItem.SIDType $i += 1 Next $aGroupInfo[0][0] = UBound($aGroupInfo) - 1 If $aGroupInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aGroupInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Groups Func __PCinfo_Get_LoggedOnUsers() Local $colItems, $objWMIService, $objItem Local $sFilePath_SaveHTMLgedOnUserInfo, $linePattern, $aExpRet Dim $aLoggedOnUserInfo[1][3], $i = 1 $linePattern = '(?i)(?:=")([^"]*)' $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_LoggedOnUser", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems $sFilePath_SaveHTMLgedOnUserInfo &= $objItem.Antecedent $sFilePath_SaveHTMLgedOnUserInfo &= $objItem.Dependent Next $aExpRet = StringRegExp($sFilePath_SaveHTMLgedOnUserInfo, $linePattern, 3) ReDim $aLoggedOnUserInfo[UBound($aExpRet) / 3 + 1][3] Local $j = 0 For $i = 1 To UBound($aLoggedOnUserInfo) - 1 Step 1 $aLoggedOnUserInfo[$i][0] = $aExpRet[$j] $aLoggedOnUserInfo[$i][1] = $aExpRet[$j + 1] $aLoggedOnUserInfo[$i][2] = $aExpRet[$j + 2] $j += 3 Next $aLoggedOnUserInfo[0][0] = UBound($aLoggedOnUserInfo) - 1 If $aLoggedOnUserInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aLoggedOnUserInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_LoggedOnUsers Func __PCinfo_Get_OSs() Local $colItems, $objWMIService, $objItem Dim $aOSInfo[1][60], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aOSInfo[UBound($aOSInfo) + 1][60] $aOSInfo[$i][0] = $objItem.Name $aOSInfo[$i][1] = $objItem.BootDevice $aOSInfo[$i][2] = $objItem.BuildNumber $aOSInfo[$i][3] = $objItem.BuildType $aOSInfo[$i][4] = $objItem.Description $aOSInfo[$i][5] = $objItem.CodeSet $aOSInfo[$i][6] = $objItem.CountryCode $aOSInfo[$i][7] = $objItem.CreationClassName $aOSInfo[$i][8] = $objItem.CSCreationClassName $aOSInfo[$i][9] = $objItem.CSDVersion $aOSInfo[$i][10] = $objItem.CSName $aOSInfo[$i][11] = $objItem.CurrentTimeZone $aOSInfo[$i][12] = $objItem.DataExecutionPrevention_32BitApplications $aOSInfo[$i][13] = $objItem.DataExecutionPrevention_Available $aOSInfo[$i][14] = $objItem.DataExecutionPrevention_Drivers $aOSInfo[$i][15] = $objItem.DataExecutionPrevention_SupportPolicy $aOSInfo[$i][16] = $objItem.Debug $aOSInfo[$i][17] = $objItem.Distributed $aOSInfo[$i][18] = $objItem.EncryptionLevel $aOSInfo[$i][19] = $objItem.ForegroundApplicationBoost $aOSInfo[$i][20] = $objItem.FreePhysicalMemory $aOSInfo[$i][21] = $objItem.FreeSpaceInPagingFiles $aOSInfo[$i][22] = $objItem.FreeVirtualMemory $aOSInfo[$i][23] = __StringToDate($objItem.InstALLDate) $aOSInfo[$i][24] = $objItem.LargeSystemCache $aOSInfo[$i][25] = __StringToDate($objItem.LastBootUpTime) $aOSInfo[$i][26] = __StringToDate($objItem.LocalDateTime) $aOSInfo[$i][27] = $objItem.Locale $aOSInfo[$i][28] = $objItem.Manufacturer $aOSInfo[$i][29] = $objItem.MaxNumberOfProcesses $aOSInfo[$i][30] = $objItem.MaxProcessMemorySize $aOSInfo[$i][31] = $objItem.NumberOfLicensedUsers $aOSInfo[$i][32] = $objItem.NumberOfProcesses $aOSInfo[$i][33] = $objItem.NumberOfUsers $aOSInfo[$i][34] = $objItem.Organization $aOSInfo[$i][35] = $objItem.OSLanguage $aOSInfo[$i][36] = $objItem.OSProductSuite $aOSInfo[$i][37] = $objItem.OSType $aOSInfo[$i][38] = $objItem.OtherTypeDescription $aOSInfo[$i][39] = $objItem.PlusProductID $aOSInfo[$i][40] = $objItem.PlusVersionNumber $aOSInfo[$i][41] = $objItem.Primary $aOSInfo[$i][42] = $objItem.ProductType $aOSInfo[$i][45] = $objItem.RegisteredUser $aOSInfo[$i][46] = $objItem.SerialNumber $aOSInfo[$i][47] = $objItem.ServicePackMajorVersion $aOSInfo[$i][48] = $objItem.ServicePackMinorVersion $aOSInfo[$i][49] = $objItem.SizeStoredInPagingFiles $aOSInfo[$i][50] = $objItem.Status $aOSInfo[$i][51] = $objItem.SuiteMask $aOSInfo[$i][52] = $objItem.SystemDevice $aOSInfo[$i][53] = $objItem.SystemDirectory $aOSInfo[$i][54] = $objItem.SystemDrive $aOSInfo[$i][55] = $objItem.TotalSwapSpaceSize $aOSInfo[$i][56] = $objItem.TotalVirtualMemorySize $aOSInfo[$i][57] = $objItem.TotalVisibleMemorySize $aOSInfo[$i][58] = $objItem.Version $aOSInfo[$i][59] = $objItem.WindowsDirectory $i += 1 Next $aOSInfo[0][0] = UBound($aOSInfo) - 1 If $aOSInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aOSInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_OSs Func __PCinfo_Get_Services($sState = "ALL") Local $wbemFlagReturnImmediately = 0x10, $wbemFlagForwardOnly = 0x20 Local $colItems, $objWMIService, $objItem Dim $aServicesInfo[1][23], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Service", "WQL", $wbemFlagReturnImmediately + $wbemFlagForwardOnly) If IsObj($colItems) Then For $objItem In $colItems If $sState <> "ALL" Then If $sState = "Stopped" And $objItem.State <> "Stopped" Then ContinueLoop If $sState = "Running" And $objItem.State <> "Running" Then ContinueLoop EndIf ReDim $aServicesInfo[UBound($aServicesInfo) + 1][23] $aServicesInfo[$i][0] = $objItem.Name $aServicesInfo[$i][1] = $objItem.State $aServicesInfo[$i][2] = $objItem.Status $aServicesInfo[$i][3] = $objItem.AcceptPause $aServicesInfo[$i][4] = $objItem.AcceptStop $aServicesInfo[$i][5] = $objItem.CheckPoint $aServicesInfo[$i][6] = $objItem.CreationClassName $aServicesInfo[$i][7] = $objItem.DesktopInteract $aServicesInfo[$i][8] = $objItem.DisplayName $aServicesInfo[$i][9] = $objItem.ErrorControl $aServicesInfo[$i][10] = $objItem.ExitCode $aServicesInfo[$i][11] = $objItem.PathName $aServicesInfo[$i][12] = $objItem.ProcessId $aServicesInfo[$i][13] = $objItem.ServiceSpecificExitCode $aServicesInfo[$i][14] = $objItem.ServiceType $aServicesInfo[$i][15] = $objItem.Started $aServicesInfo[$i][16] = $objItem.StartMode $aServicesInfo[$i][17] = $objItem.StartName $aServicesInfo[$i][18] = $objItem.SystemCreationClassName $aServicesInfo[$i][19] = $objItem.SystemName $aServicesInfo[$i][20] = $objItem.TagId $aServicesInfo[$i][21] = $objItem.WaitHint $aServicesInfo[$i][22] = $objItem.Description $i += 1 Next $aServicesInfo[0][0] = UBound($aServicesInfo) - 1 If $aServicesInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aServicesInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Services Func __PCinfo_Get_Shares() Local $colItems, $objWMIService, $objItem Dim $aShareInfo[1][8], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Share", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aShareInfo[UBound($aShareInfo) + 1][8] $aShareInfo[$i][0] = $objItem.Name $aShareInfo[$i][1] = $objItem.AccessMask $aShareInfo[$i][2] = $objItem.ALLowMaximum $aShareInfo[$i][3] = $objItem.MaximumALLowed $aShareInfo[$i][4] = $objItem.Description $aShareInfo[$i][5] = $objItem.Path $aShareInfo[$i][6] = $objItem.Status $aShareInfo[$i][7] = $objItem.Type $i += 1 Next $aShareInfo[0][0] = UBound($aShareInfo) - 1 If $aShareInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aShareInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Shares Func __PCinfo_Get_Software() Local Const $UnInstKey = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\UninstALL" Local $i = 1, $SoftName, $Count = 1, $AppKey Dim $aSoftwareInfo[1][11] While 1 $AppKey = RegEnumKey($UnInstKey, $i) If @error <> 0 Then ExitLoop $SoftName = StringStripWS(StringReplace(RegRead($UnInstKey & "\" & $AppKey, "DisplayName"), "(remove only)", ""), 3) $i += 1 If ($SoftName == '') Then ContinueLoop ReDim $aSoftwareInfo[UBound($aSoftwareInfo) + 1][11] $aSoftwareInfo[$Count][0] = $SoftName $aSoftwareInfo[$Count][1] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "DisplayVersion"), 3) $aSoftwareInfo[$Count][2] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "Publisher"), 3) $aSoftwareInfo[$Count][3] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "InstALLDate"), 3) $aSoftwareInfo[$Count][4] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "EstimatedSize"), 3) $aSoftwareInfo[$Count][5] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "NoElevateOnModify"), 3) $aSoftwareInfo[$Count][6] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "NoModify"), 3) $aSoftwareInfo[$Count][7] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "NoRemove"), 3) $aSoftwareInfo[$Count][8] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "NoRepair"), 3) $aSoftwareInfo[$Count][9] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "InstALLLocation"), 3) $aSoftwareInfo[$Count][10] = StringStripWS(RegRead($UnInstKey & "\" & $AppKey, "UninstALLString"), 3) $Count += 1 $AppKey = '' $SoftName = '' WEnd $aSoftwareInfo[0][0] = UBound($aSoftwareInfo, 1) - 1 If $aSoftwareInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aSoftwareInfo EndFunc ;==>__PCinfo_Get_Software Func __PCinfo_Get_Startup() Local $colItems, $objWMIService, $objItem Dim $aStartupInfo[1][6], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_StartupCommand", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aStartupInfo[UBound($aStartupInfo) + 1][6] $aStartupInfo[$i][0] = $objItem.Name $aStartupInfo[$i][1] = $objItem.User $aStartupInfo[$i][2] = $objItem.Location $aStartupInfo[$i][3] = $objItem.Command $aStartupInfo[$i][4] = $objItem.Description $aStartupInfo[$i][5] = $objItem.SettingID $i += 1 Next $aStartupInfo[0][0] = UBound($aStartupInfo) - 1 If $aStartupInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aStartupInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Startup Func __PCinfo_Get_Users() Local $colItems, $objWMIService, $objItem Dim $aUserInfo[1][14], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_UserAccount", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aUserInfo[UBound($aUserInfo) + 1][14] $aUserInfo[$i][0] = $objItem.Name $aUserInfo[$i][1] = $objItem.Domain $aUserInfo[$i][2] = $objItem.Status $aUserInfo[$i][3] = $objItem.LocalAccount $aUserInfo[$i][4] = $objItem.Description $aUserInfo[$i][5] = $objItem.SIDType $aUserInfo[$i][6] = $objItem.SID $aUserInfo[$i][7] = $objItem.FullName $aUserInfo[$i][8] = $objItem.Disabled $aUserInfo[$i][9] = $objItem.Lockout $aUserInfo[$i][10] = $objItem.PasswordChangeable $aUserInfo[$i][11] = $objItem.PasswordExpires $aUserInfo[$i][12] = $objItem.PasswordRequired $aUserInfo[$i][13] = $objItem.AccountType $i += 1 Next $aUserInfo[0][0] = UBound($aUserInfo) - 1 If $aUserInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aUserInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Users Func __PCinfo_Get_Battery() Local $colItems, $objWMIService, $objItem Dim $aBatteryInfo[1][31], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Battery", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aBatteryInfo[UBound($aBatteryInfo) + 1][31] $aBatteryInfo[$i][0] = $objItem.Name $aBatteryInfo[$i][1] = $objItem.Availability $aBatteryInfo[$i][2] = $objItem.BatteryRechargeTime $aBatteryInfo[$i][3] = $objItem.BatteryStatus $aBatteryInfo[$i][4] = $objItem.Description $aBatteryInfo[$i][5] = $objItem.Chemistry $aBatteryInfo[$i][6] = $objItem.ConfigManagerErrorCode $aBatteryInfo[$i][7] = $objItem.ConfigManagerUserConfig $aBatteryInfo[$i][8] = $objItem.CreationClassName $aBatteryInfo[$i][9] = $objItem.DesignCapacity $aBatteryInfo[$i][10] = $objItem.DesignVoltage $aBatteryInfo[$i][11] = $objItem.DeviceID $aBatteryInfo[$i][12] = $objItem.ErrorCleared $aBatteryInfo[$i][13] = $objItem.ErrorDescription $aBatteryInfo[$i][14] = $objItem.EstimatedChargeRemaining $aBatteryInfo[$i][15] = $objItem.EstimatedRunTime $aBatteryInfo[$i][16] = $objItem.ExpectedBatteryLife $aBatteryInfo[$i][17] = $objItem.ExpectedLife $aBatteryInfo[$i][18] = $objItem.FullChargeCapacity $aBatteryInfo[$i][19] = $objItem.LastErrorCode $aBatteryInfo[$i][20] = $objItem.MaxRechargeTime $aBatteryInfo[$i][21] = $objItem.PNPDeviceID $aBatteryInfo[$i][22] = $objItem.PowerManagementCapabilities(0) $aBatteryInfo[$i][23] = $objItem.PowerManagementSupported $aBatteryInfo[$i][24] = $objItem.SmartBatteryVersion $aBatteryInfo[$i][25] = $objItem.Status $aBatteryInfo[$i][26] = $objItem.StatusInfo $aBatteryInfo[$i][27] = $objItem.SystemCreationClassName $aBatteryInfo[$i][28] = $objItem.SystemName $aBatteryInfo[$i][29] = $objItem.TimeOnBattery $aBatteryInfo[$i][30] = $objItem.TimeToFullCharge $i += 1 Next $aBatteryInfo[0][0] = UBound($aBatteryInfo) - 1 If $aBatteryInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aBatteryInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Battery Func __PCinfo_Get_BIOS() Local $colItems, $objWMIService, $objItem Dim $aBIOSInfo[1][25], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_BIOS", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aBIOSInfo[UBound($aBIOSInfo) + 1][25] $aBIOSInfo[$i][0] = $objItem.Name $aBIOSInfo[$i][1] = $objItem.Status $aBIOSInfo[$i][2] = $objItem.BiosCharacteristics(0) $aBIOSInfo[$i][3] = $objItem.BIOSVersion(0) $aBIOSInfo[$i][4] = $objItem.Description $aBIOSInfo[$i][5] = $objItem.BuildNumber $aBIOSInfo[$i][6] = $objItem.CodeSet $aBIOSInfo[$i][7] = $objItem.CurrentLanguage $aBIOSInfo[$i][8] = $objItem.IdentificationCode $aBIOSInfo[$i][9] = $objItem.InstALLableLanguages $aBIOSInfo[$i][10] = $objItem.LanguageEdition $aBIOSInfo[$i][11] = $objItem.ListOfLanguages(0) $aBIOSInfo[$i][12] = $objItem.Manufacturer $aBIOSInfo[$i][13] = $objItem.OtherTargetOS $aBIOSInfo[$i][14] = $objItem.PrimaryBIOS $aBIOSInfo[$i][15] = __StringToDate($objItem.ReleaseDate) $aBIOSInfo[$i][16] = $objItem.SerialNumber $aBIOSInfo[$i][17] = $objItem.SMBIOSBIOSVersion $aBIOSInfo[$i][18] = $objItem.SMBIOSMajorVersion $aBIOSInfo[$i][19] = $objItem.SMBIOSMinorVersion $aBIOSInfo[$i][20] = $objItem.SMBIOSPresent $aBIOSInfo[$i][21] = $objItem.SoftwareElementID $aBIOSInfo[$i][22] = $objItem.SoftwareElementState $aBIOSInfo[$i][23] = $objItem.TargetOperatingSystem $aBIOSInfo[$i][24] = $objItem.Version $i += 1 Next $aBIOSInfo[0][0] = UBound($aBIOSInfo) - 1 If $aBIOSInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aBIOSInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_BIOS Func __PCinfo_Get_Keyboard() Local $colItems, $objWMIService, $objItem Dim $aKeyboardInfo[1][21], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Keyboard", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aKeyboardInfo[UBound($aKeyboardInfo) + 1][21] $aKeyboardInfo[$i][0] = $objItem.Name $aKeyboardInfo[$i][1] = $objItem.Availability $aKeyboardInfo[$i][2] = $objItem.ConfigManagerErrorCode $aKeyboardInfo[$i][3] = $objItem.ConfigManagerUserConfig $aKeyboardInfo[$i][4] = $objItem.Description $aKeyboardInfo[$i][5] = $objItem.CreationClassName $aKeyboardInfo[$i][6] = $objItem.DeviceID $aKeyboardInfo[$i][7] = $objItem.ErrorCleared $aKeyboardInfo[$i][8] = $objItem.ErrorDescription $aKeyboardInfo[$i][9] = $objItem.IsLocked $aKeyboardInfo[$i][10] = $objItem.LastErrorCode $aKeyboardInfo[$i][11] = $objItem.Layout $aKeyboardInfo[$i][12] = $objItem.NumberOfFunctionKeys $aKeyboardInfo[$i][13] = $objItem.Password $aKeyboardInfo[$i][14] = $objItem.PNPDeviceID $aKeyboardInfo[$i][15] = $objItem.PowerManagementCapabilities(0) $aKeyboardInfo[$i][16] = $objItem.PowerManagementSupported $aKeyboardInfo[$i][17] = $objItem.Status $aKeyboardInfo[$i][18] = $objItem.StatusInfo $aKeyboardInfo[$i][19] = $objItem.SystemCreationClassName $aKeyboardInfo[$i][20] = $objItem.SystemName $i += 1 Next $aKeyboardInfo[0][0] = UBound($aKeyboardInfo) - 1 If $aKeyboardInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aKeyboardInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Keyboard Func __PCinfo_Get_Memory() Local $colItems, $objWMIService, $objItem Dim $aMemoryInfo[1][28], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PhysicalMemory", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aMemoryInfo[UBound($aMemoryInfo) + 1][28] $aMemoryInfo[$i][0] = $objItem.Name $aMemoryInfo[$i][1] = $objItem.BankLabel $aMemoryInfo[$i][2] = $objItem.Capacity $aMemoryInfo[$i][3] = $objItem.CreationClassName $aMemoryInfo[$i][4] = $objItem.Description $aMemoryInfo[$i][5] = $objItem.DataWidth $aMemoryInfo[$i][6] = $objItem.DeviceLocator $aMemoryInfo[$i][7] = $objItem.FormFactor $aMemoryInfo[$i][8] = $objItem.HotSwappable $aMemoryInfo[$i][9] = $objItem.InterleaveDataDepth $aMemoryInfo[$i][10] = $objItem.InterleavePosition $aMemoryInfo[$i][11] = $objItem.Manufacturer $aMemoryInfo[$i][12] = $objItem.MemoryType $aMemoryInfo[$i][13] = $objItem.Model $aMemoryInfo[$i][14] = $objItem.OtherIdentifyingInfo $aMemoryInfo[$i][15] = $objItem.PartNumber $aMemoryInfo[$i][16] = $objItem.PositionInRow $aMemoryInfo[$i][17] = $objItem.PoweredOn $aMemoryInfo[$i][18] = $objItem.Removable $aMemoryInfo[$i][19] = $objItem.Replaceable $aMemoryInfo[$i][20] = $objItem.SerialNumber $aMemoryInfo[$i][21] = $objItem.SKU $aMemoryInfo[$i][22] = $objItem.Speed $aMemoryInfo[$i][23] = $objItem.Status $aMemoryInfo[$i][24] = $objItem.Tag $aMemoryInfo[$i][25] = $objItem.TotalWidth $aMemoryInfo[$i][26] = $objItem.TypeDetail $aMemoryInfo[$i][27] = $objItem.Version $i += 1 Next $aMemoryInfo[0][0] = UBound($aMemoryInfo) - 1 If $aMemoryInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aMemoryInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Memory Func __PCinfo_Get_Monitors() Local $colItems, $objWMIService, $objItem Dim $aMonitorInfo[1][26], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_DesktopMonitor", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aMonitorInfo[UBound($aMonitorInfo) + 1][26] $aMonitorInfo[$i][0] = $objItem.Name $aMonitorInfo[$i][1] = $objItem.Availability $aMonitorInfo[$i][2] = $objItem.Bandwidth $aMonitorInfo[$i][3] = $objItem.ConfigManagerErrorCode $aMonitorInfo[$i][4] = $objItem.Description $aMonitorInfo[$i][5] = $objItem.ConfigManagerUserConfig $aMonitorInfo[$i][6] = $objItem.CreationClassName $aMonitorInfo[$i][7] = $objItem.DeviceID $aMonitorInfo[$i][8] = $objItem.DisplayType $aMonitorInfo[$i][9] = $objItem.ErrorCleared $aMonitorInfo[$i][10] = $objItem.ErrorDescription $aMonitorInfo[$i][11] = $objItem.IsLocked $aMonitorInfo[$i][12] = $objItem.LastErrorCode $aMonitorInfo[$i][13] = $objItem.MonitorManufacturer $aMonitorInfo[$i][14] = $objItem.MonitorType $aMonitorInfo[$i][15] = $objItem.PixelsPerXLogicalInch $aMonitorInfo[$i][16] = $objItem.PixelsPerYLogicalInch $aMonitorInfo[$i][17] = $objItem.PNPDeviceID $aMonitorInfo[$i][18] = $objItem.PowerManagementCapabilities(0) $aMonitorInfo[$i][19] = $objItem.PowerManagementSupported $aMonitorInfo[$i][20] = $objItem.ScreenHeight $aMonitorInfo[$i][21] = $objItem.ScreenWidth $aMonitorInfo[$i][22] = $objItem.Status $aMonitorInfo[$i][23] = $objItem.StatusInfo $aMonitorInfo[$i][24] = $objItem.SystemCreationClassName $aMonitorInfo[$i][25] = $objItem.SystemName $i += 1 Next $aMonitorInfo[0][0] = UBound($aMonitorInfo) - 1 If $aMonitorInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aMonitorInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Monitors Func __PCinfo_Get_Motherboard() Local $colItems, $objWMIService, $objItem Dim $aMotherboardInfo[1][20], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_MotherboardDevice", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aMotherboardInfo[UBound($aMotherboardInfo) + 1][20] $aMotherboardInfo[$i][0] = $objItem.Name $aMotherboardInfo[$i][1] = $objItem.Availability $aMotherboardInfo[$i][2] = $objItem.ConfigManagerErrorCode $aMotherboardInfo[$i][3] = $objItem.ConfigManagerUserConfig $aMotherboardInfo[$i][4] = $objItem.Description $aMotherboardInfo[$i][5] = $objItem.CreationClassName $aMotherboardInfo[$i][6] = $objItem.DeviceID $aMotherboardInfo[$i][7] = $objItem.ErrorCleared $aMotherboardInfo[$i][8] = $objItem.ErrorDescription $aMotherboardInfo[$i][9] = $objItem.LastErrorCode $aMotherboardInfo[$i][10] = $objItem.PNPDeviceID $aMotherboardInfo[$i][11] = $objItem.PowerManagementCapabilities(0) $aMotherboardInfo[$i][12] = $objItem.PowerManagementSupported $aMotherboardInfo[$i][13] = $objItem.PrimaryBusType $aMotherboardInfo[$i][14] = $objItem.RevisionNumber $aMotherboardInfo[$i][15] = $objItem.SecondaryBusType $aMotherboardInfo[$i][16] = $objItem.Status $aMotherboardInfo[$i][17] = $objItem.StatusInfo $aMotherboardInfo[$i][18] = $objItem.SystemCreationClassName $aMotherboardInfo[$i][19] = $objItem.SystemName $i += 1 Next $aMotherboardInfo[0][0] = UBound($aMotherboardInfo) - 1 If $aMotherboardInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aMotherboardInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Motherboard Func __PCinfo_Get_Mouse() Local $colItems, $objWMIService, $objItem Dim $aMouseInfo[1][31], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_PointingDevice", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aMouseInfo[UBound($aMouseInfo) + 1][31] $aMouseInfo[$i][0] = $objItem.Name $aMouseInfo[$i][1] = $objItem.Availability $aMouseInfo[$i][2] = $objItem.ConfigManagerErrorCode $aMouseInfo[$i][3] = $objItem.ConfigManagerUserConfig $aMouseInfo[$i][4] = $objItem.Description $aMouseInfo[$i][5] = $objItem.CreationClassName $aMouseInfo[$i][6] = $objItem.DeviceID $aMouseInfo[$i][7] = $objItem.DeviceInterface $aMouseInfo[$i][8] = $objItem.DoubleSpeedThreshold $aMouseInfo[$i][9] = $objItem.ErrorCleared $aMouseInfo[$i][10] = $objItem.ErrorDescription $aMouseInfo[$i][11] = $objItem.Handedness $aMouseInfo[$i][12] = $objItem.HardwareType $aMouseInfo[$i][13] = $objItem.InfFileName $aMouseInfo[$i][14] = $objItem.InfSection $aMouseInfo[$i][15] = $objItem.IsLocked $aMouseInfo[$i][16] = $objItem.LastErrorCode $aMouseInfo[$i][17] = $objItem.Manufacturer $aMouseInfo[$i][18] = $objItem.NumberOfButtons $aMouseInfo[$i][19] = $objItem.PNPDeviceID $aMouseInfo[$i][20] = $objItem.PointingType $aMouseInfo[$i][21] = $objItem.PowerManagementCapabilities(0) $aMouseInfo[$i][22] = $objItem.PowerManagementSupported $aMouseInfo[$i][23] = $objItem.QuadSpeedThreshold $aMouseInfo[$i][24] = $objItem.Resolution $aMouseInfo[$i][25] = $objItem.SampleRate $aMouseInfo[$i][26] = $objItem.Status $aMouseInfo[$i][27] = $objItem.StatusInfo $aMouseInfo[$i][28] = $objItem.Synch $aMouseInfo[$i][29] = $objItem.SystemCreationClassName $aMouseInfo[$i][30] = $objItem.SystemName $i += 1 Next $aMouseInfo[0][0] = UBound($aMouseInfo) - 1 If $aMouseInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aMouseInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Mouse Func __PCinfo_Get_NetworkCards() Local $colItems, $objWMIService, $objItem Dim $aNetworkInfo[1][34], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapter", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aNetworkInfo[UBound($aNetworkInfo) + 1][34] $aNetworkInfo[$i][0] = $objItem.Name $aNetworkInfo[$i][1] = $objItem.AdapterType $aNetworkInfo[$i][2] = $objItem.AdapterTypeId $aNetworkInfo[$i][3] = $objItem.AutoSense $aNetworkInfo[$i][4] = $objItem.Description $aNetworkInfo[$i][5] = $objItem.Availability $aNetworkInfo[$i][6] = $objItem.ConfigManagerErrorCode $aNetworkInfo[$i][7] = $objItem.ConfigManagerUserConfig $aNetworkInfo[$i][8] = $objItem.CreationClassName $aNetworkInfo[$i][9] = $objItem.DeviceID $aNetworkInfo[$i][10] = $objItem.ErrorCleared $aNetworkInfo[$i][11] = $objItem.ErrorDescription $aNetworkInfo[$i][12] = $objItem.Index $aNetworkInfo[$i][13] = $objItem.InstALLed $aNetworkInfo[$i][14] = $objItem.LastErrorCode $aNetworkInfo[$i][15] = $objItem.MACAddress $aNetworkInfo[$i][16] = $objItem.Manufacturer $aNetworkInfo[$i][17] = $objItem.MaxNumberControlled $aNetworkInfo[$i][18] = $objItem.MaxSpeed $aNetworkInfo[$i][19] = $objItem.NetConnectionID $aNetworkInfo[$i][20] = $objItem.NetConnectionStatus $aNetworkInfo[$i][21] = $objItem.NetworkAddresses(0) $aNetworkInfo[$i][22] = $objItem.PermanentAddress $aNetworkInfo[$i][23] = $objItem.PNPDeviceID $aNetworkInfo[$i][24] = $objItem.PowerManagementCapabilities(0) $aNetworkInfo[$i][25] = $objItem.PowerManagementSupported $aNetworkInfo[$i][26] = $objItem.ProductName $aNetworkInfo[$i][27] = $objItem.ServiceName $aNetworkInfo[$i][28] = $objItem.Speed $aNetworkInfo[$i][29] = $objItem.Status $aNetworkInfo[$i][30] = $objItem.StatusInfo $aNetworkInfo[$i][31] = $objItem.SystemCreationClassName $aNetworkInfo[$i][32] = $objItem.SystemName $aNetworkInfo[$i][33] = __StringToDate($objItem.TimeOfLastReset) $i += 1 Next $aNetworkInfo[0][0] = UBound($aNetworkInfo) - 1 If $aNetworkInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aNetworkInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_NetworkCards Func __PCinfo_Get_Printers() Local $colItems, $objWMIService, $objItem Dim $aPrinterInfo[1][85], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Printer", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aPrinterInfo[UBound($aPrinterInfo) + 1][85] $aPrinterInfo[$i][0] = $objItem.Name $aPrinterInfo[$i][1] = $objItem.Attributes $aPrinterInfo[$i][2] = $objItem.Availability $aPrinterInfo[$i][3] = $objItem.AvailableJobSheets(0) $aPrinterInfo[$i][4] = $objItem.Description $aPrinterInfo[$i][5] = $objItem.AveragePagesPerMinute $aPrinterInfo[$i][6] = $objItem.Capabilities(0) $aPrinterInfo[$i][7] = $objItem.CapabilityDescriptions(0) $aPrinterInfo[$i][8] = $objItem.CharSetsSupported(0) $aPrinterInfo[$i][9] = $objItem.Comment $aPrinterInfo[$i][10] = $objItem.ConfigManagerErrorCode $aPrinterInfo[$i][11] = $objItem.ConfigManagerUserConfig $aPrinterInfo[$i][12] = $objItem.CreationClassName $aPrinterInfo[$i][13] = $objItem.CurrentCapabilities(0) $aPrinterInfo[$i][14] = $objItem.CurrentCharSet $aPrinterInfo[$i][15] = $objItem.CurrentLanguage $aPrinterInfo[$i][16] = $objItem.CurrentMimeType $aPrinterInfo[$i][17] = $objItem.CurrentNaturALLanguage $aPrinterInfo[$i][18] = $objItem.CurrentPaperType $aPrinterInfo[$i][19] = $objItem.Default $aPrinterInfo[$i][20] = $objItem.DefaultCapabilities(0) $aPrinterInfo[$i][21] = $objItem.DefaultCopies $aPrinterInfo[$i][22] = $objItem.DefaultLanguage $aPrinterInfo[$i][23] = $objItem.DefaultMimeType $aPrinterInfo[$i][24] = $objItem.DefaultNumberUp $aPrinterInfo[$i][25] = $objItem.DefaultPaperType $aPrinterInfo[$i][26] = $objItem.DefaultPriority $aPrinterInfo[$i][27] = $objItem.DetectedErrorState $aPrinterInfo[$i][28] = $objItem.DeviceID $aPrinterInfo[$i][29] = $objItem.Direct $aPrinterInfo[$i][30] = $objItem.DoCompleteFirst $aPrinterInfo[$i][31] = $objItem.DriverName $aPrinterInfo[$i][32] = $objItem.EnableBIDI $aPrinterInfo[$i][33] = $objItem.EnableDevQueryPrint $aPrinterInfo[$i][34] = $objItem.ErrorCleared $aPrinterInfo[$i][35] = $objItem.ErrorDescription $aPrinterInfo[$i][36] = $objItem.ErrorInformation(0) $aPrinterInfo[$i][37] = $objItem.ExtendedDetectedErrorState $aPrinterInfo[$i][38] = $objItem.ExtendedPrinterStatus $aPrinterInfo[$i][39] = $objItem.Hidden $aPrinterInfo[$i][40] = $objItem.HorizontalResolution $aPrinterInfo[$i][41] = __StringToDate($objItem.InstALLDate) $aPrinterInfo[$i][42] = $objItem.JobCountSinceLastReset $aPrinterInfo[$i][43] = $objItem.KeepPrintedJobs $aPrinterInfo[$i][44] = $objItem.LanguagesSupported(0) $aPrinterInfo[$i][45] = $objItem.LastErrorCode $aPrinterInfo[$i][46] = $objItem.Local $aPrinterInfo[$i][47] = $objItem.Location $aPrinterInfo[$i][48] = $objItem.MarkingTechnology $aPrinterInfo[$i][49] = $objItem.MaxCopies $aPrinterInfo[$i][50] = $objItem.MaxNumberUp $aPrinterInfo[$i][51] = $objItem.MaxSizeSupported $aPrinterInfo[$i][52] = $objItem.MimeTypesSupported(0) $aPrinterInfo[$i][53] = $objItem.NaturALLanguagesSupported(0) $aPrinterInfo[$i][54] = $objItem.Network $aPrinterInfo[$i][55] = $objItem.PaperSizesSupported(0) $aPrinterInfo[$i][56] = $objItem.PaperTypesAvailable(0) $aPrinterInfo[$i][57] = $objItem.Parameters $aPrinterInfo[$i][58] = $objItem.PNPDeviceID $aPrinterInfo[$i][59] = $objItem.PortName $aPrinterInfo[$i][60] = $objItem.PowerManagementCapabilities(0) $aPrinterInfo[$i][61] = $objItem.PowerManagementSupported $aPrinterInfo[$i][62] = $objItem.PrinterPaperNames(0) $aPrinterInfo[$i][63] = $objItem.PrinterState $aPrinterInfo[$i][64] = $objItem.PrinterStatus $aPrinterInfo[$i][65] = $objItem.PrintJobDataType $aPrinterInfo[$i][66] = $objItem.PrintProcessor $aPrinterInfo[$i][67] = $objItem.Priority $aPrinterInfo[$i][68] = $objItem.Published $aPrinterInfo[$i][69] = $objItem.Queued $aPrinterInfo[$i][70] = $objItem.RawOnly $aPrinterInfo[$i][71] = $objItem.SeparatorFile $aPrinterInfo[$i][72] = $objItem.ServerName $aPrinterInfo[$i][73] = $objItem.Shared $aPrinterInfo[$i][74] = $objItem.ShareName $aPrinterInfo[$i][75] = $objItem.SpoolEnabled $aPrinterInfo[$i][76] = __StringToDate($objItem.StartTime) $aPrinterInfo[$i][77] = $objItem.Status $aPrinterInfo[$i][78] = $objItem.StatusInfo $aPrinterInfo[$i][79] = $objItem.SystemCreationClassName $aPrinterInfo[$i][80] = $objItem.SystemName $aPrinterInfo[$i][81] = __StringToDate($objItem.TimeOfLastReset) $aPrinterInfo[$i][82] = __StringToDate($objItem.UntilTime) $aPrinterInfo[$i][83] = $objItem.VerticalResolution $aPrinterInfo[$i][84] = $objItem.WorkOffline $i += 1 Next $aPrinterInfo[0][0] = UBound($aPrinterInfo) - 1 If $aPrinterInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aPrinterInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Printers Func __PCinfo_Get_Processors() Local $colItems, $objWMIService, $objItem Dim $aProcessorInfo[1][42], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_Processor", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aProcessorInfo[UBound($aProcessorInfo) + 1][42] $aProcessorInfo[$i][0] = StringStripWS($objItem.Name, 1) $aProcessorInfo[$i][1] = $objItem.AddressWidth $aProcessorInfo[$i][2] = $objItem.Architecture $aProcessorInfo[$i][3] = $objItem.Availability $aProcessorInfo[$i][4] = $objItem.Description $aProcessorInfo[$i][5] = $objItem.ConfigManagerErrorCode $aProcessorInfo[$i][6] = $objItem.ConfigManagerUserConfig $aProcessorInfo[$i][7] = $objItem.CpuStatus $aProcessorInfo[$i][8] = $objItem.CreationClassName $aProcessorInfo[$i][9] = $objItem.CurrentClockSpeed $aProcessorInfo[$i][10] = $objItem.CurrentVoltage $aProcessorInfo[$i][11] = $objItem.DataWidth $aProcessorInfo[$i][12] = $objItem.DeviceID $aProcessorInfo[$i][13] = $objItem.ErrorCleared $aProcessorInfo[$i][14] = $objItem.ErrorDescription $aProcessorInfo[$i][15] = $objItem.ExtClock $aProcessorInfo[$i][16] = $objItem.Family $aProcessorInfo[$i][17] = $objItem.L2CacheSize $aProcessorInfo[$i][18] = $objItem.L2CacheSpeed $aProcessorInfo[$i][19] = $objItem.LastErrorCode $aProcessorInfo[$i][20] = $objItem.Level $aProcessorInfo[$i][21] = $objItem.LoadPercentage $aProcessorInfo[$i][22] = $objItem.Manufacturer $aProcessorInfo[$i][23] = $objItem.MaxClockSpeed $aProcessorInfo[$i][24] = $objItem.OtherFamilyDescription $aProcessorInfo[$i][25] = $objItem.PNPDeviceID $aProcessorInfo[$i][26] = $objItem.PowerManagementCapabilities(0) $aProcessorInfo[$i][27] = $objItem.PowerManagementSupported $aProcessorInfo[$i][28] = $objItem.ProcessorId $aProcessorInfo[$i][29] = $objItem.ProcessorType $aProcessorInfo[$i][30] = $objItem.Revision $aProcessorInfo[$i][31] = $objItem.Role $aProcessorInfo[$i][32] = $objItem.SocketDesignation $aProcessorInfo[$i][33] = $objItem.Status $aProcessorInfo[$i][34] = $objItem.StatusInfo $aProcessorInfo[$i][35] = $objItem.Stepping $aProcessorInfo[$i][36] = $objItem.SystemCreationClassName $aProcessorInfo[$i][37] = $objItem.SystemName $aProcessorInfo[$i][38] = $objItem.UniqueId $aProcessorInfo[$i][39] = $objItem.UpgradeMethod $aProcessorInfo[$i][40] = $objItem.Version $aProcessorInfo[$i][41] = $objItem.VoltageCaps $i += 1 Next $aProcessorInfo[0][0] = UBound($aProcessorInfo) - 1 If $aProcessorInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aProcessorInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_Processors Func __PCinfo_Get_SoundCards() Local $colItems, $objWMIService, $objItem Dim $aSoundCardInfo[1][21], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_SoundDevice", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aSoundCardInfo[UBound($aSoundCardInfo) + 1][21] $aSoundCardInfo[$i][0] = $objItem.Name $aSoundCardInfo[$i][1] = $objItem.Availability $aSoundCardInfo[$i][2] = $objItem.ConfigManagerErrorCode $aSoundCardInfo[$i][3] = $objItem.ConfigManagerUserConfig $aSoundCardInfo[$i][4] = $objItem.Description $aSoundCardInfo[$i][5] = $objItem.CreationClassName $aSoundCardInfo[$i][6] = $objItem.DeviceID $aSoundCardInfo[$i][7] = $objItem.DMABufferSize $aSoundCardInfo[$i][8] = $objItem.ErrorCleared $aSoundCardInfo[$i][9] = $objItem.ErrorDescription $aSoundCardInfo[$i][10] = $objItem.LastErrorCode $aSoundCardInfo[$i][11] = $objItem.Manufacturer $aSoundCardInfo[$i][12] = $objItem.MPU401Address $aSoundCardInfo[$i][13] = $objItem.PNPDeviceID $aSoundCardInfo[$i][14] = $objItem.PowerManagementCapabilities(0) $aSoundCardInfo[$i][15] = $objItem.PowerManagementSupported $aSoundCardInfo[$i][16] = $objItem.ProductName $aSoundCardInfo[$i][17] = $objItem.Status $aSoundCardInfo[$i][18] = $objItem.StatusInfo $aSoundCardInfo[$i][19] = $objItem.SystemCreationClassName $aSoundCardInfo[$i][20] = $objItem.SystemName $i += 1 Next $aSoundCardInfo[0][0] = UBound($aSoundCardInfo) - 1 If $aSoundCardInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aSoundCardInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_SoundCards Func __PCinfo_Get_System() Local $colItems, $objWMIService, $objItem Dim $aSystemInfo[1][52], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aSystemInfo[UBound($aSystemInfo) + 1][52] $aSystemInfo[$i][0] = $objItem.Name $aSystemInfo[$i][1] = $objItem.AdminPasswordStatus $aSystemInfo[$i][2] = $objItem.AutomaticResetBootOption $aSystemInfo[$i][3] = $objItem.AutomaticResetCapability $aSystemInfo[$i][4] = $objItem.Description $aSystemInfo[$i][5] = $objItem.BootOptionOnLimit $aSystemInfo[$i][6] = $objItem.BootOptionOnWatchDog $aSystemInfo[$i][7] = $objItem.BootROMSupported $aSystemInfo[$i][8] = $objItem.BootupState $aSystemInfo[$i][9] = $objItem.ChassisBootupState $aSystemInfo[$i][10] = $objItem.CreationClassName $aSystemInfo[$i][11] = $objItem.CurrentTimeZone $aSystemInfo[$i][12] = $objItem.DaylightInEffect $aSystemInfo[$i][13] = $objItem.Domain $aSystemInfo[$i][14] = $objItem.DomainRole $aSystemInfo[$i][15] = $objItem.EnableDaylightSavingsTime $aSystemInfo[$i][16] = $objItem.FrontPanelResetStatus $aSystemInfo[$i][17] = $objItem.InfraredSupported $aSystemInfo[$i][18] = $objItem.InitiALLoadInfo(0) $aSystemInfo[$i][19] = $objItem.KeyboardPasswordStatus $aSystemInfo[$i][20] = $objItem.LastLoadInfo $aSystemInfo[$i][21] = $objItem.Manufacturer $aSystemInfo[$i][22] = $objItem.Model $aSystemInfo[$i][23] = $objItem.NameFormat $aSystemInfo[$i][24] = $objItem.NetworkServerModeEnabled $aSystemInfo[$i][25] = $objItem.NumberOfProcessors $aSystemInfo[$i][26] = $objItem.OEMLogoBitmap(0) $aSystemInfo[$i][27] = $objItem.OEMStringArray(0) $aSystemInfo[$i][28] = $objItem.PartOfDomain $aSystemInfo[$i][29] = $objItem.PauseAfterReset $aSystemInfo[$i][30] = $objItem.PowerManagementCapabilities(0) $aSystemInfo[$i][31] = $objItem.PowerManagementSupported $aSystemInfo[$i][32] = $objItem.PowerOnPasswordStatus $aSystemInfo[$i][33] = $objItem.PowerState $aSystemInfo[$i][34] = $objItem.PowerSupplyState $aSystemInfo[$i][35] = $objItem.PrimaryOwnerContact $aSystemInfo[$i][36] = $objItem.PrimaryOwnerName $aSystemInfo[$i][37] = $objItem.ResetCapability $aSystemInfo[$i][38] = $objItem.ResetCount $aSystemInfo[$i][39] = $objItem.ResetLimit $aSystemInfo[$i][40] = $objItem.Roles(0) $aSystemInfo[$i][41] = $objItem.Status $aSystemInfo[$i][42] = $objItem.SupportContactDescription(0) $aSystemInfo[$i][43] = $objItem.SystemStartupDelay $aSystemInfo[$i][44] = $objItem.SystemStartupOptions(0) $aSystemInfo[$i][45] = $objItem.SystemStartupSetting $aSystemInfo[$i][46] = $objItem.SystemType $aSystemInfo[$i][47] = $objItem.ThermalState $aSystemInfo[$i][48] = $objItem.TotalPhysicalMemory $aSystemInfo[$i][49] = $objItem.UserName $aSystemInfo[$i][50] = $objItem.WakeUpType $aSystemInfo[$i][51] = $objItem.Workgroup $i += 1 Next $aSystemInfo[0][0] = UBound($aSystemInfo) - 1 If $aSystemInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aSystemInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_System Func __PCinfo_Get_SystemProduct() Local $colItems, $objWMIService, $objItem Dim $aSysProductInfo[1][7], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystemProduct", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aSysProductInfo[UBound($aSysProductInfo) + 1][7] $aSysProductInfo[$i][0] = $objItem.Name $aSysProductInfo[$i][1] = $objItem.IdentifyingNumber $aSysProductInfo[$i][2] = $objItem.SKUNumber $aSysProductInfo[$i][3] = $objItem.UUID $aSysProductInfo[$i][4] = $objItem.Description $aSysProductInfo[$i][5] = $objItem.Vendor $aSysProductInfo[$i][6] = $objItem.Version $i += 1 Next $aSysProductInfo[0][0] = UBound($aSysProductInfo) - 1 If $aSysProductInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aSysProductInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_SystemProduct Func __PCinfo_Get_VideoCards() Local $colItems, $objWMIService, $objItem Dim $aVideoInfo[1][59], $i = 1 $objWMIService = ObjGet("winmgmts:\\" & $cI_CompName & "\root\CIMV2") $colItems = $objWMIService.ExecQuery("SELECT * FROM Win32_VideoController", "WQL", 0x10 + 0x20) If IsObj($colItems) Then For $objItem In $colItems ReDim $aVideoInfo[UBound($aVideoInfo) + 1][59] $aVideoInfo[$i][0] = $objItem.Name $aVideoInfo[$i][1] = $objItem.AcceleratorCapabilities(0) $aVideoInfo[$i][2] = $objItem.AdapterCompatibility $aVideoInfo[$i][3] = $objItem.AdapterDACType $aVideoInfo[$i][4] = $objItem.Description $aVideoInfo[$i][5] = $objItem.AdapterRAM $aVideoInfo[$i][6] = $objItem.Availability $aVideoInfo[$i][7] = $objItem.CapabilityDescriptions(0) $aVideoInfo[$i][8] = $objItem.ColorTableEntries $aVideoInfo[$i][9] = $objItem.ConfigManagerErrorCode $aVideoInfo[$i][10] = $objItem.ConfigManagerUserConfig $aVideoInfo[$i][11] = $objItem.CreationClassName $aVideoInfo[$i][12] = $objItem.CurrentBitsPerPixel $aVideoInfo[$i][13] = $objItem.CurrentHorizontalResolution $aVideoInfo[$i][14] = $objItem.CurrentNumberOfColors $aVideoInfo[$i][15] = $objItem.CurrentNumberOfColumns $aVideoInfo[$i][16] = $objItem.CurrentNumberOfRows $aVideoInfo[$i][17] = $objItem.CurrentRefreshRate $aVideoInfo[$i][18] = $objItem.CurrentScanMode $aVideoInfo[$i][19] = $objItem.CurrentVerticalResolution $aVideoInfo[$i][20] = $objItem.DeviceID $aVideoInfo[$i][21] = $objItem.DeviceSpecificPens $aVideoInfo[$i][22] = $objItem.DitherType $aVideoInfo[$i][23] = __StringToDate($objItem.DriverDate) $aVideoInfo[$i][24] = $objItem.DriverVersion $aVideoInfo[$i][25] = $objItem.ErrorCleared $aVideoInfo[$i][26] = $objItem.ErrorDescription $aVideoInfo[$i][27] = $objItem.ICMIntent $aVideoInfo[$i][28] = $objItem.ICMMethod $aVideoInfo[$i][29] = $objItem.InfFilename $aVideoInfo[$i][30] = $objItem.InfSection $aVideoInfo[$i][31] = $objItem.InstALLedDisplayDrivers $aVideoInfo[$i][32] = $objItem.LastErrorCode $aVideoInfo[$i][33] = $objItem.MaxMemorySupported $aVideoInfo[$i][34] = $objItem.MaxNumberControlled $aVideoInfo[$i][35] = $objItem.MaxRefreshRate $aVideoInfo[$i][36] = $objItem.MinRefreshRate $aVideoInfo[$i][37] = $objItem.Monochrome $aVideoInfo[$i][38] = $objItem.NumberOfColorPlanes $aVideoInfo[$i][39] = $objItem.NumberOfVideoPages $aVideoInfo[$i][40] = $objItem.PNPDeviceID $aVideoInfo[$i][41] = $objItem.PowerManagementCapabilities(0) $aVideoInfo[$i][42] = $objItem.PowerManagementSupported $aVideoInfo[$i][43] = $objItem.ProtocolSupported $aVideoInfo[$i][44] = $objItem.ReservedSystemPaletteEntries $aVideoInfo[$i][45] = $objItem.SpecificationVersion $aVideoInfo[$i][46] = $objItem.Status $aVideoInfo[$i][47] = $objItem.StatusInfo $aVideoInfo[$i][48] = $objItem.SystemCreationClassName $aVideoInfo[$i][49] = $objItem.SystemName $aVideoInfo[$i][50] = $objItem.SystemPaletteEntries $aVideoInfo[$i][51] = __StringToDate($objItem.TimeOfLastReset) $aVideoInfo[$i][52] = $objItem.VideoArchitecture $aVideoInfo[$i][53] = $objItem.VideoMemoryType $aVideoInfo[$i][54] = $objItem.VideoMode $aVideoInfo[$i][55] = $objItem.VideoModeDescription $aVideoInfo[$i][56] = $objItem.VideoProcessor $i += 1 Next $aVideoInfo[0][0] = UBound($aVideoInfo) - 1 If $aVideoInfo[0][0] < 1 Then SetError(1, 1, 0) EndIf Return $aVideoInfo Else SetError(1, 2, 0) EndIf EndFunc ;==>__PCinfo_Get_VideoCards Func __StringToDate($dtmDate) Return (StringMid($dtmDate, 5, 2) & "/" & StringMid($dtmDate, 7, 2) & "/" & StringLeft($dtmDate, 4) & " " & StringMid($dtmDate, 9, 2) & ":" & StringMid($dtmDate, 11, 2) & ":" & StringMid($dtmDate, 13, 2)) EndFunc ;==>__StringToDate Func __PCinfo_Write_Array2HTML($iArray, $sTitle = '', $TableHeader = '') Local $varRowColorValue, $xDim = UBound($iArray, 1) - 1 Local $yDim = UBound($iArray, 2) - 1 $sHTML_Content &= "<div class=""container""><h3><a href='#" & StringReplace($sTitle, " ", "_") & "' data-toggle='collapse'>" & $sTitle & "</a></h3>" & @CRLF $sHTML_Content &= "<div id='" & StringReplace($sTitle, " ", "_") & "' class='collapse'><table border='0'>" & @CRLF If ($TableHeader <> "") And ($TableHeader <> Default) Then If StringInStr($TableHeader, ',') Then Local $aHeader = StringSplit($TableHeader, ',', 1) If IsArray($aHeader) Then $sHTML_Content &= '<tr bgcolor="#C4E1FF">' & @CRLF For $h = 1 To $aHeader[0] If ($h == 1) Then $sHTML_Content &= "<td><center>" & $aHeader[$h] & "</center></td>" & @CRLF Else $sHTML_Content &= "<td>" & $aHeader[$h] & "</td>" & @CRLF EndIf Next $sHTML_Content &= "</tr>" & @CRLF EndIf EndIf EndIf Local $varRowColor = 0 For $x = 0 To $xDim If $varRowColor = 0 Then $varRowColor = 1 $varRowColorValue = "#9BCDFF" Else $varRowColor = 0 $varRowColorValue = "#C4E1FF" EndIf $sHTML_Content &= "<tr bgcolor='" & $varRowColorValue & "'>" & @CRLF For $y = 0 To $yDim If ($y == 0) Then $sHTML_Content &= "<td><center>" & StringReplace($iArray[$x][$y], '|', @CRLF) & "</center></td>" & @CRLF Else $sHTML_Content &= "<td>" & StringReplace($iArray[$x][$y], '|', @CRLF) & "</td>" & @CRLF EndIf Next $sHTML_Content &= "</tr>" & @CRLF Next $sHTML_Content &= "</table></div></div></br>" & @CRLF & @CRLF EndFunc ;==>__PCinfo_Write_Array2HTML Func __PCinfo_Write_Array2CSVlog($iArray, $sTitle = '', $LogHeader = '') Local $xDim = UBound($iArray, 1) - 1 Local $yDim = UBound($iArray, 2) - 1 $sLogs_Content &= @CRLF & '# ' & $sTitle & ' :---------------------------------------------\' & @CRLF If ($LogHeader <> "") And ($LogHeader <> Default) Then $sLogs_Content &= $LogHeader & @CRLF For $x = 0 To $xDim For $y = 0 To $yDim If (StringStripWS($iArray[$x][$y], 8) == '') Then ContinueLoop $sLogs_Content &= '"' & $iArray[$x][$y] & '"' If $y < $yDim Then $sLogs_Content &= "," Else $sLogs_Content &= @CRLF EndIf Next Next $sLogs_Content &= @CRLF & '# ' & $sTitle & ' :---------------------------------------------/' & @CRLF & @CRLF EndFunc ;==>__PCinfo_Write_Array2CSVlog Func __PCinfo_HTML_AddHeader($sTitle = @ComputerName & " System Info") $sHTML_Content &= '<html>' & @CRLF $sHTML_Content &= '<head><meta http-equiv=""Content-Type"" content=""text/html; charset=utf-8"" /><title>' & $sTitle & '</title>' & @CRLF $sHTML_Content &= '<!--<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">' & @CRLF $sHTML_Content &= '<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>' & @CRLF $sHTML_Content &= '<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>' & @CRLF $sHTML_Content &= '<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>-->' & @CRLF $sHTML_Content &= '</head>' & @CRLF $sHTML_Content &= "<body><title>" & $sTitle & "</title>" & @CRLF & "<div class=""jumbotron jumbotron-fluid""><div class=""container""><center><h1>" & $sTitle & "</h1></div></div>" & "<div class=""container"">Scan Initiated: " & @MON & "/" & @MDAY & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & "</br></br></br></div>" & @CRLF EndFunc ;==>__PCinfo_HTML_AddHeader Func __PCinfo_HTML_AddFooter() $sHTML_Content &= "</div></br><div class=""container"">Scan Complete: " & @MON & "/" & @MDAY & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & "</div>" & @CRLF $sHTML_Content &= '</body></html>' & @CRLF EndFunc ;==>__PCinfo_HTML_AddFooter Func __PCinfo_Get_SysOverview() Dim $aWin_Info[13][2] $aWin_Info[0][0] = 12 $aWin_Info[1][0] = '' & 'ComputerName' $aWin_Info[1][1] = '' & @ComputerName $aWin_Info[2][0] = 'UserName' $aWin_Info[2][1] = @UserName Local $_winver = FileGetVersion(@SystemDir & "\ntoskrnl.exe") If @error Then $_winver = FileGetVersion(@SystemDir & "\winver.exe") If $isWin64 Then $aWin_Info[3][0] = '' & 'ProductName' $aWin_Info[3][1] = RegRead('HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'ProductName') & ' ' & RegRead('HKLM64\SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'DisplayVersion') & ' ' & $_winver & ' ' & @CPUArch & ((@OSServicePack <> '') ? ' ' & @OSServicePack : '') Else $aWin_Info[3][0] = '' & 'ProductName' $aWin_Info[3][1] = RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'ProductName') & ' ' & RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'DisplayVersion') & ' ' & $_winver & ' ' & @CPUArch & ((@OSServicePack <> '') ? ' ' & @OSServicePack : '') EndIf Local $cpu_ProcessorName = RegRead('HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0', "ProcessorNameString") Local $cpu_Identifier = RegRead('HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0', "Identifier") If $cpu_ProcessorName = '' Then $cpu_ProcessorName = RegRead('HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\1', "ProcessorNameString") If $cpu_Identifier = '' Then $cpu_Identifier = RegRead('HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\1', "Identifier") Local $main_Manufacturer = RegRead('HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS', "BaseBoardManufacturer") If $main_Manufacturer <> '' Then $main_Manufacturer = RegRead('HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS', "BIOSVendor") If $main_Manufacturer <> '' Then $main_Manufacturer = RegRead('HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS', "SystemManufacturer") Local $main_Family = RegRead('HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS', "SystemFamily") If $main_Family = '' Then $main_Family = RegRead('HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS', "SystemVersion") Local $main_ProductName = RegRead('HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\BIOS', "SystemProductName") If $cpu_ProcessorName <> '' Then If $cpu_Identifier <> '' Then $aWin_Info[4][0] = '' & 'ProcessorName' $aWin_Info[4][1] = '' & $cpu_ProcessorName & ' / ' & $cpu_Identifier Else $aWin_Info[4][0] = '' & 'ProcessorName' $aWin_Info[4][1] = '' & $cpu_ProcessorName EndIf EndIf Local $aMemStats = MemGetStats() If IsArray($aMemStats) Then If UBound($aMemStats) = 7 Then $aWin_Info[5][0] = '' & 'RAM' $aWin_Info[5][1] = 'Physical: ' & Round($aMemStats[1] / 1024 / 1024, 2) & ' GB (Free: ' & Round($aMemStats[2] / 1024 / 1024, 2) & ' GB) / Page Size: ' & Round($aMemStats[3] / 1024 / 1024, 2) & ' GB (Free: ' & Round($aMemStats[4] / 1024 / 1024, 2) & ' GB)' EndIf EndIf Local $sManufacturer If $main_Manufacturer <> '' Then If $main_Family <> '' Then $sManufacturer &= '' & $main_Manufacturer & ' / ' & $main_Family EndIf If $main_ProductName <> '' Then $sManufacturer &= '' & $main_Manufacturer & ' / ' & $main_Family & ' / ' & $main_ProductName EndIf $aWin_Info[6][0] = '' & 'Manufacturer' $aWin_Info[6][1] = $sManufacturer EndIf Local $tzinfo = __PCinfo_dtGetTimeZoneInformation() If IsArray($tzinfo) Then If $tzinfo[2] <> '' Then $aWin_Info[7][0] = 'TimeZone' $aWin_Info[7][1] = '' & $tzinfo[2] EndIf EndIf $aWin_Info[8][0] = '' & 'OS' $aWin_Info[8][1] = 'OSVersion: ' & @OSVersion & ' / OSArch: ' & @OSArch & ' / OSLang: ' & @OSLang & ' / OSType: ' & @OSType & ' / OSBuild: ' & @OSBuild & ' / MUILang: ' & @MUILang & ' / Keyboard Layout: ' & @KBLayout $aWin_Info[9][0] = '' & 'Desktop' $aWin_Info[9][1] = 'Width x Height: ' & @DesktopWidth & ' x ' & @DesktopHeight & ' / ColorDepth: ' & @DesktopDepth & ' / Refresh: ' & @DesktopRefresh $aWin_Info[10][0] = '' & 'Environment [Path]' $aWin_Info[10][1] = '' & EnvGet("Path") $aWin_Info[11][0] = '' & 'Home' $aWin_Info[11][1] = '[HomeDrive: ' & @HomeDrive & '] [HomePath: ' & @HomePath & '] [HomeShare: ' & @HomeShare & ']' $aWin_Info[12][0] = '' & 'Logon' $aWin_Info[12][1] = '[Domain: ' & @LogonDomain & '] [Server: ' & @LogonServer & '] [DNS: ' & @LogonDNSDomain & ']' Return $aWin_Info EndFunc ;==>__PCinfo_Get_SysOverview Func __PCinfo_StringStripCRWS($String, $removeSpace = 0) $String = StringStripCR($String) $String = StringStripWS($String, 7) $String = StringReplace($String, @LF, ' ') $String = StringReplace($String, @CRLF, ' ') $String = StringReplace($String, @CR, ' ') While StringInStr($String, ' ' & ' ') $String = StringReplace($String, ' ' & ' ', ' ') WEnd If $removeSpace > 0 Then Return StringStripWS($String, 8) If StringStripWS($String, 8) == '' Then Return '' Return $String EndFunc ;==>__PCinfo_StringStripCRWS Func __PCinfo_Get_AdaptersInfo($sComputer = ".") Local $Cols = 20, $strIndex, $objVAR, $objVARx, $zAdapter, $zAdapterName, $zSpeed, $zIndex, $zInterfaceIndex, $zGetIPType, $zAdapterStatus, $zIP, $zMAC, $zSubNetIP, $zGetwayIP, $zGetwayMAC Local $aReturn[1][$Cols] = [[0, $Cols]] If $sComputer = Default Then $sComputer = @ComputerName Local $sListIndexInterfaceName = __PCinfo_Get_ListIndexInterfaceName() Local $objwmi = ObjGet("winmgmts:\\" & $sComputer & "\root\cimv2") Local $objWQLx = $objwmi.ExecQuery("SELECT * FROM Win32_NetworkAdapter WHERE NetConnectionID != NULL", "WQL", 0x30) If Not @error And IsObj($objWQLx) Then For $objVARx In $objWQLx $zAdapterName = $objVARx.NetConnectionID If (__PCinfo_StringStripCRWS($zAdapterName) = "") Then ContinueLoop $zSpeed = __PCinfo_ByteSuffixRound($objVARx.Speed) If Int($zSpeed) <= 0 Then For $z = 0 To UBound($sListIndexInterfaceName) - 1 If $sListIndexInterfaceName[$z][1] = $zAdapterName Then $zSpeed = __PCinfo_ByteSuffixRound(__PCinfo_Get_InterfaceIndexSpeed($sListIndexInterfaceName[$z][0])) Next EndIf $zAdapterStatus = $objVARx.NetConnectionStatus Switch $zAdapterStatus Case 0, 3 $zAdapterStatus = "Disable" Case 1, 2 $zAdapterStatus = "Connected" Case $zAdapterStatus = 7 $zAdapterStatus = "unPlugged" Case Else $zAdapterStatus = "N/A" EndSwitch $strIndex = $objVARx.Index Local $objWQL = $objwmi.ExecQuery('SELECT * FROM Win32_NetworkAdapterConfiguration WHERE Index=' & $strIndex, "WQL", 0x30) If Not @error And IsObj($objWQL) Then For $objVAR In $objWQL $zAdapter = $objVAR.Description $aReturn[0][0] += 1 $zIndex = $aReturn[0][0] ReDim $aReturn[$zIndex * 2][$aReturn[0][1]] $zInterfaceIndex = $objVAR.InterfaceIndex If Int($zInterfaceIndex) <= 0 Then For $z = 0 To UBound($sListIndexInterfaceName) - 1 If $sListIndexInterfaceName[$z][1] = $zAdapterName Then $zInterfaceIndex = $sListIndexInterfaceName[$z][0] Next EndIf $aReturn[$zIndex][0] = $zInterfaceIndex $aReturn[$zIndex][1] = $zAdapter $aReturn[$zIndex][2] = $zAdapterName $aReturn[$zIndex][3] = $zAdapterStatus $zGetIPType = $objVAR.DHCPEnabled If $zGetIPType Then $zGetIPType = "DHCP" Else $zGetIPType = "StaticIP" EndIf $aReturn[$zIndex][4] = $zGetIPType $zIP = $objVAR.IPAddress(0) If __PCinfo_StringStripCRWS($zIP) = "" Then $zIP = "N/A" $aReturn[$zIndex][5] = $zIP $zSubNetIP = $objVAR.IPSubnet(0) If __PCinfo_StringStripCRWS($zSubNetIP) = "" Then $zSubNetIP = "N/A" $aReturn[$zIndex][6] = $zSubNetIP $zMAC = $objVAR.MACAddress If __PCinfo_StringStripCRWS($zMAC) = "" Then $zMAC = "N/A" $aReturn[$zIndex][7] = $zMAC $zGetwayIP = $objVAR.DefaultIPGateway(0) If __PCinfo_StringStripCRWS($zGetwayIP) = "" Then $zGetwayIP = "N/A" $aReturn[$zIndex][8] = $zGetwayIP $zGetwayMAC = "N/A" If __PCinfo_StringStripCRWS($zGetwayIP) <> "N/A" Then $zGetwayMAC = __PCinfo_Get_MACFromIP($zGetwayIP) $aReturn[$zIndex][9] = $zGetwayMAC If Number($zSpeed) = 0 Then $zSpeed = "N/A" $aReturn[$zIndex][10] = $zSpeed $aReturn[$zIndex][11] = "N/A" $aReturn[$zIndex][12] = "N/A" $aReturn[$zIndex][13] = "N/A" $aReturn[$zIndex][14] = "N/A" $aReturn[$zIndex][15] = "N/A" $aReturn[$zIndex][16] = "N/A" $aReturn[$zIndex][17] = "N/A" $aReturn[$zIndex][18] = "N/A" Local $zDNS = $objVAR.DNSServerSearchOrder() Local $dnsCount = UBound($zDNS) $aReturn[$zIndex][19] = $dnsCount If IsArray($zDNS) Then Switch $dnsCount Case 1 $aReturn[$zIndex][11] = $zDNS[0] Case 2 $aReturn[$zIndex][11] = $zDNS[0] $aReturn[$zIndex][12] = $zDNS[1] Case 3 $aReturn[$zIndex][11] = $zDNS[0] $aReturn[$zIndex][12] = $zDNS[1] $aReturn[$zIndex][13] = $zDNS[2] Case 4 $aReturn[$zIndex][11] = $zDNS[0] $aReturn[$zIndex][12] = $zDNS[1] $aReturn[$zIndex][13] = $zDNS[2] $aReturn[$zIndex][14] = $zDNS[3] Case 5 $aReturn[$zIndex][11] = $zDNS[0] $aReturn[$zIndex][12] = $zDNS[1] $aReturn[$zIndex][13] = $zDNS[2] $aReturn[$zIndex][14] = $zDNS[3] $aReturn[$zIndex][15] = $zDNS[4] Case 6 $aReturn[$zIndex][11] = $zDNS[0] $aReturn[$zIndex][12] = $zDNS[1] $aReturn[$zIndex][13] = $zDNS[2] $aReturn[$zIndex][14] = $zDNS[3] $aReturn[$zIndex][15] = $zDNS[4] $aReturn[$zIndex][16] = $zDNS[5] Case 7 $aReturn[$zIndex][11] = $zDNS[0] $aReturn[$zIndex][12] = $zDNS[1] $aReturn[$zIndex][13] = $zDNS[2] $aReturn[$zIndex][14] = $zDNS[3] $aReturn[$zIndex][15] = $zDNS[4] $aReturn[$zIndex][16] = $zDNS[5] $aReturn[$zIndex][17] = $zDNS[6] Case 8 $aReturn[$zIndex][11] = $zDNS[0] $aReturn[$zIndex][12] = $zDNS[1] $aReturn[$zIndex][13] = $zDNS[2] $aReturn[$zIndex][14] = $zDNS[3] $aReturn[$zIndex][15] = $zDNS[4] $aReturn[$zIndex][16] = $zDNS[5] $aReturn[$zIndex][17] = $zDNS[6] $aReturn[$zIndex][18] = $zDNS[7] Case Else $aReturn[$zIndex][11] = $zDNS[0] EndSwitch EndIf Next EndIf Next Return $aReturn EndIf Return SetError(1, 0, "") EndFunc ;==>__PCinfo_Get_AdaptersInfo Func __PCinfo_Get_ListIndexInterfaceName() Local Const $tagIP_ADAPTER_ADDRESSES = "ulong Length;dword IfIndex;ptr Next;ptr AdapterName;ptr FirstUnicastAddress;" & "ptr FirstAnycastAddress;ptr FirstMulticastAddress;ptr FirstDnsServerAddress;ptr DnsSuffix;ptr Description;" & "ptr FriendlyName;byte PhysicalAddress[8];dword PhysicalAddressLength;dword Flags;dword Mtu;dword IfType;int OperStatus;" & "dword Ipv6IfIndex;dword ZoneIndices[16];ptr FirstPrefix;" & "uint64 TransmitLinkSpeed;uint64 ReceiveLinkSpeed;ptr FirstWinsServerAddress;ptr FirstGatewayAddress;" & "ulong Ipv4Metric;ulong Ipv6Metric;uint64 Luid;STRUCT;ptr Dhcpv4ServerSockAddr;int Dhcpv4ServerSockAddrLen;ENDSTRUCT;" & "ulong CompartmentId;STRUCT;ulong NetworkGuidData1;word NetworkGuidData2;word NetworkGuidData3;byte NetworkGuidData4[8];ENDSTRUCT;" & "int ConnectionType;int TunnelType;STRUCT;ptr Dhcpv6ServerSockAddr;int Dhcpv6ServerSockAddrLen;ENDSTRUCT;byte Dhcpv6ClientDuid[130];" & "ulong Dhcpv6ClientDuidLength;ulong Dhcpv6Iaid;ptr FirstDnsSuffix;" Local $aret, $nBufSize, $stBuffer, $stIP_ADAPTER_ADDRESSES, $pIPAAStruct, $nIPAAStSize Local $pTemp, $nTemp, $nEntries, $aIndexEntries $aret = DllCall("iphlpapi.dll", "ulong", "GetAdaptersAddresses", "ulong", 0, "ulong", 0x86, "ptr", 0, "ptr", 0, "ulong*", 0) If @error Then Return SetError(1, @error, "") If $aret[0] Then If $aret[0] <> 111 Or Not $aret[5] Then Return SetError(2, $aret[0], "") EndIf $nBufSize = $aret[5] $stBuffer = DllStructCreate("int64;byte [" & $nBufSize & "];") $aret = DllCall("iphlpapi.dll", "ulong", "GetAdaptersAddresses", "ulong", 0, "ulong", 0x86, "ptr", 0, "ptr", DllStructGetPtr($stBuffer), "ulong*", $nBufSize) If @error Then Return SetError(1, @error, "") If $aret[0] Then Return SetError(2, $aret[0], "") Dim $aIndexEntries[Floor($nBufSize / 72)][2] $nEntries = 0 $pIPAAStruct = DllStructGetPtr($stBuffer) While $pIPAAStruct <> 0 $stIP_ADAPTER_ADDRESSES = DllStructCreate($tagIP_ADAPTER_ADDRESSES, $pIPAAStruct) $nIPAAStSize = DllStructGetData($stIP_ADAPTER_ADDRESSES, "Length") $nTemp = DllStructGetData($stIP_ADAPTER_ADDRESSES, "OperStatus") If ($nTemp = 2 And Not False) Or DllStructGetData($stIP_ADAPTER_ADDRESSES, "IfType") = 24 Then Else $pTemp = DllStructGetData($stIP_ADAPTER_ADDRESSES, "FirstUnicastAddress") If $pTemp <> 0 Then $aIndexEntries[$nEntries][0] = DllStructGetData($stIP_ADAPTER_ADDRESSES, "IfIndex") $aIndexEntries[$nEntries][1] = __PCinfo_Get_StringWFromPtr(DllStructGetData($stIP_ADAPTER_ADDRESSES, "FriendlyName")) $nEntries += 1 EndIf EndIf $pIPAAStruct = DllStructGetData($stIP_ADAPTER_ADDRESSES, "Next") WEnd If $nEntries = 0 Then Return SetError(-1, 0, "") ReDim $aIndexEntries[$nEntries][2] Return SetExtended($nEntries, $aIndexEntries) EndFunc ;==>__PCinfo_Get_ListIndexInterfaceName Func __PCinfo_Get_InterfaceIndexSpeed($IfIndex) Local $tBuffer, $pBuffer, $iResult, $iSpeed $tBuffer = DllStructCreate("wchar[256];dword[5];byte[8];dword[16];char[256]") $pBuffer = DllStructGetPtr($tBuffer) DllStructSetData($tBuffer, 2, $IfIndex, 1) $iResult = DllCall("iphlpapi.dll", "long", "GetIfEntry", "ptr", $pBuffer) If @error Then Return SetError(@error, @extended, 0) $iSpeed = DllStructGetData($tBuffer, 2, 4) $tBuffer = 0 Return SetError($iResult[0], $iSpeed / 1000 / 1000, $iSpeed) EndFunc ;==>__PCinfo_Get_InterfaceIndexSpeed Func __PCinfo_Get_StringWFromPtr($pStr) If Not IsPtr($pStr) Or $pStr = 0 Then Return SetError(1, 0, "") Local $aret = DllCall("kernel32.dll", "ptr", "lstrcpynW", "wstr", "", "ptr", $pStr, "int", 32767) If @error Or Not $aret[0] Then Return SetError(@error, 0, "") Return $aret[1] EndFunc ;==>__PCinfo_Get_StringWFromPtr Func __PCinfo_Get_MACFromIP($rMAC) If ($rMAC = "") Or ($rMAC = "N/A") Then Return "N/A" Local $sbMAC = DllStructCreate("byte[6]") Local $siMAC = DllStructCreate("int") DllStructSetData($siMAC, 1, 6) Local $rHexMAC = DllCall("Ws2_32.dll", "int", "inet_addr", "str", $rMAC) $rMAC = $rHexMAC[0] $rHexMAC = DllCall("iphlpapi.dll", "int", "SendARP", "int", $rMAC, "int", 0, "ptr", DllStructGetPtr($sbMAC), "ptr", DllStructGetPtr($siMAC)) $rMAC = "" For $i = 0 To 5 If $i Then $rMAC &= ":" $rMAC = $rMAC & Hex(DllStructGetData($sbMAC, 1, $i + 1), 2) Next If ($rMAC = "") Or ($rMAC = $sBlankMAC) Or ($rMAC = "N/A") Then Return "N/A" Return $rMAC EndFunc ;==>__PCinfo_Get_MACFromIP Func __PCinfo_ByteSuffixRound($iBytes, $iRound = 2) $iBytes = Number($iBytes) If $iBytes > 1000000000 Then Return "N/A" Local $a, $aArray[5] = ["Bps", "Kbps", "Mbps", "Gbps", "Tbps"] While $iBytes > 999 $a += 1 If $a > 3 Then ExitLoop $iBytes /= 1000 WEnd Return Round($iBytes, $iRound) & " " & $aArray[$a] EndFunc ;==>__PCinfo_ByteSuffixRound Func __PCinfo_Singleton($sOccurrenceName, $iFlag = 0) Local Const $ERROR_ALREADY_EXISTS = 183 Local Const $SECURITY_DESCRIPTOR_REVISION = 1 Local $tSecurityAttributes = 0 If BitAND($iFlag, 2) Then Local $tSecurityDescriptor = DllStructCreate("byte;byte;word;ptr[4]") Local $aCALL = DllCall("advapi32.dll", "bool", "InitializeSecurityDescriptor", "struct*", $tSecurityDescriptor, "dword", $SECURITY_DESCRIPTOR_REVISION) If @error Then Return SetError(@error, @extended, 0) If $aCALL[0] Then $aCALL = DllCall("advapi32.dll", "bool", "SetSecurityDescriptorDacl", "struct*", $tSecurityDescriptor, "bool", 1, "ptr", 0, "bool", 0) If @error Then Return SetError(@error, @extended, 0) If $aCALL[0] Then $tSecurityAttributes = DllStructCreate("dword Length;ptr Descriptor;bool InheritHandle") DllStructSetData($tSecurityAttributes, 1, DllStructGetSize($tSecurityAttributes)) DllStructSetData($tSecurityAttributes, 2, DllStructGetPtr($tSecurityDescriptor)) DllStructSetData($tSecurityAttributes, 3, 0) EndIf EndIf EndIf Local $aHandle = DllCall("kernel32.dll", "handle", "CreateMutexW", "struct*", $tSecurityAttributes, "bool", 1, "wstr", $sOccurrenceName) If @error Then Return SetError(@error, @extended, 0) Local $aLastError = DllCall("kernel32.dll", "dword", "GetLastError") If @error Then Return SetError(@error, @extended, 0) If $aLastError[0] = $ERROR_ALREADY_EXISTS Then If BitAND($iFlag, 1) Then DllCall("kernel32.dll", "bool", "CloseHandle", "handle", $aHandle[0]) If @error Then Return SetError(@error, @extended, 0) Return SetError($aLastError[0], $aLastError[0], 0) Else Exit -1 EndIf EndIf Return $aHandle[0] EndFunc ;==>__PCinfo_Singleton Func __PCinfo_dtCloneSystemTime($pSystemTime) Local $tagSYSTEMTIME = "struct;word Year;word Month;word Dow;word Day;word Hour;word Minute;word Second;word MSeconds;endstruct" Local $tSystemTime1 = DllStructCreate($tagSYSTEMTIME, $pSystemTime) Local $tSystemTime2 = DllStructCreate($tagSYSTEMTIME) DllStructSetData($tSystemTime2, "Month", DllStructGetData($tSystemTime1, "Month")) DllStructSetData($tSystemTime2, "Day", DllStructGetData($tSystemTime1, "Day")) DllStructSetData($tSystemTime2, "Year", DllStructGetData($tSystemTime1, "Year")) DllStructSetData($tSystemTime2, "Hour", DllStructGetData($tSystemTime1, "Hour")) DllStructSetData($tSystemTime2, "Minute", DllStructGetData($tSystemTime1, "Minute")) DllStructSetData($tSystemTime2, "Second", DllStructGetData($tSystemTime1, "Second")) DllStructSetData($tSystemTime2, "MSeconds", DllStructGetData($tSystemTime1, "MSeconds")) DllStructSetData($tSystemTime2, "DOW", DllStructGetData($tSystemTime1, "DOW")) Return $tSystemTime2 EndFunc ;==>__PCinfo_dtCloneSystemTime Func __PCinfo_dtGetTimeZoneInformation() Local $tagTIME_ZONE_INFORMATION = "struct;long Bias;wchar StdName[32];word StdDate[8];long StdBias;wchar DayName[32];word DayDate[8];long DayBias;endstruct" Local $tTimeZone = DllStructCreate($tagTIME_ZONE_INFORMATION) Local $aCALL = DllCall("kernel32.dll", "dword", "GetTimeZoneInformation", "struct*", $tTimeZone) If @error Then Return SetError(@error, @extended, 0) If $aCALL[0] = -1 Then Return SetError(10, 0, 0) Local $aInfo[8] $aInfo[0] = $aCALL[0] $aInfo[1] = DllStructGetData($tTimeZone, "Bias") $aInfo[2] = DllStructGetData($tTimeZone, "StdName") $aInfo[3] = __PCinfo_dtCloneSystemTime(DllStructGetPtr($tTimeZone, "StdDate")) $aInfo[4] = DllStructGetData($tTimeZone, "StdBias") $aInfo[5] = DllStructGetData($tTimeZone, "DayName") $aInfo[6] = __PCinfo_dtCloneSystemTime(DllStructGetPtr($tTimeZone, "DayDate")) $aInfo[7] = DllStructGetData($tTimeZone, "DayBias") Return $aInfo EndFunc ;==>__PCinfo_dtGetTimeZoneInformation Func __PCinfo_ObjErrorFunc() ConsoleWrite("! AutoItCOM Test - We intercepted a COM Error !" & @CRLF & @CRLF & "! Error.description is: " & @TAB & $oMyError.description & @CRLF & "! Error.windescription:" & @TAB & $oMyError.windescription & @CRLF & "! Error.number is: " & @TAB & Hex($oMyError.number, 8) & @CRLF & "! Error.lastdllError is: " & @TAB & $oMyError.lastdllError & @CRLF & "! Error.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & "! Error.source is: " & @TAB & $oMyError.source & @CRLF & "! Error.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & "! Error.helpcontext is: " & @TAB & $oMyError.helpcontext & @CRLF & @CRLF) EndFunc ;==>__PCinfo_ObjErrorFunc #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=iCon.ico #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_Comment=Dao Van Trong - TRONG.PRO #AutoIt3Wrapper_Res_Description=Get PC Information by Dao Van Trong - TRONG.PRO #AutoIt3Wrapper_Res_Fileversion=1.0.0.0 #AutoIt3Wrapper_Res_ProductName=Get PC Information #AutoIt3Wrapper_Res_ProductVersion=1.0.0.0 #AutoIt3Wrapper_Res_CompanyName=TRONG.PRO #AutoIt3Wrapper_Res_LegalCopyright=Dao Van Trong - TRONG.PRO #AutoIt3Wrapper_Res_LegalTradeMarks=Dao Van Trong - TRONG.PRO #AutoIt3Wrapper_Res_SaveSource=y #AutoIt3Wrapper_Res_Language=1066 #AutoIt3Wrapper_Res_requestedExecutionLevel=highestAvailable #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
  14. Maybe it will be useful to someone To use UDF you need to copy 2 files PLINK.EXE and PSCP.EXE and edit the path if needed! ;#include <AutoItConstants.au3> ;Opt("MustDeclareVars", 1) ;0=no, 1=require pre-declaration Global $Path_SSH_Plink_EXE = '"' & @ScriptDir & '\x86\plink.exe' & '"' Global $Path_PSCP_EXE = '"' & @ScriptDir & '\x86\pscp.exe' & '"' ;~ Global $iHost = 'x.x.x.x' ;~ Global $iPort = '22' ;~ Global $iUserName = 'root' ;~ Global $iUserPassword = 'passssssssss' ;~ ;----------------------------------------------------------------------------------------------- ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'ls -lS') ;~ ;----------------------------------------------------------------------------------------------- ;~ _EG_Run_Multi_Command($iHost, $iPort, $iUserName, $iUserPassword) ;~ ;----------------------------------------------------------------------------------------------- ;~ FileDelete(@ScriptDir & '\z.exe') ;~ _SSH_SendFile(@ScriptDir & '\putty.exe', '/tmp/z.exe', $iHost, 22, $iUserName, $iUserPassword) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'ls -lS /tmp/', False) ;~ _SSH_GetFile(@ScriptDir & '\z.exe', '/tmp/z.exe', $iHost, 22, $iUserName, $iUserPassword) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'rm -rf /tmp/*', False) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'ls -lS /tmp/', False) ;~ ConsoleWrite('- FileExists z.exe: ' & FileExists(@ScriptDir & '\z.exe') & @CRLF) ;~ FileDelete(@ScriptDir & '\z.exe') ;~ ;----------------------------------------------------------------------------------------------- ;~ DirRemove(@ScriptDir & '\_x88', 1) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'rm -rf /tmp/*', False) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'ls -lS /tmp/', False) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'mkdir /tmp/x86/', False) ;~ _SSH_SendFolder(@ScriptDir & '\x86', '/tmp/x86', $iHost, 22, $iUserName, $iUserPassword) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'ls -lS /tmp/', False) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'ls -lS /tmp/x86/', False) ;~ FileDelete(@ScriptDir & '\_x88') ;~ DirCreate(@ScriptDir & '\_x88') ;~ _SSH_GetFolder(@ScriptDir & '\_x88', '/tmp/x86', $iHost, 22, $iUserName, $iUserPassword) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'rm -rf /tmp/*', False) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'ls -lS /tmp/', False) ;~ ConsoleWrite('- FileExists _x88: ' & DirGetSize(@ScriptDir & '\_x88') & @CRLF) ;~ DirRemove(@ScriptDir & '\_x88', 1) ;~ ;----------------------------------------------------------------------------------------------- ;~ DirRemove(@ScriptDir & '\_x99', 1) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'rm -rf /tmp/*', False) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'ls -lS /tmp/', False) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'mkdir /tmp/_xx/', False) ;~ _SSH_SendFolder(@ScriptDir & '\_xx', '/tmp/', $iHost, 22, $iUserName, $iUserPassword, True) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'ls -lS /tmp/', False) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'ls -lS /tmp/_xx/', False) ;~ FileDelete(@ScriptDir & '\_x99') ;~ DirCreate(@ScriptDir & '\_x99') ;~ _SSH_GetFolder(@ScriptDir & '\_x99', '/tmp/_xx', $iHost, 22, $iUserName, $iUserPassword, True) ;~ ConsoleWrite('- FileExists _x99: ' & DirGetSize(@ScriptDir & '\_x99') & @CRLF) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'rm -rf /tmp/*', False) ;~ _SSH_SendCmd($iHost, 22, $iUserName, $iUserPassword, 'ls -lS /tmp/', False) ;~ DirRemove(@ScriptDir & '\_x99', 1) ;~ ;----------------------------------------------------------------------------------------------- Func _EG_Run_Multi_Command($iHost, $iPort, $iUserName, $iUserPassword) Local $Plink_PID = _SSH_Plink_Connect($iHost, $iPort, $iUserName, $iUserPassword) ConsoleWrite('! $Plink_PID: ' & $Plink_PID & @CRLF) Local $sOutput, $sOutput_tmp If $Plink_PID > 0 Then _SSH_Plink_SendCmd($Plink_PID, @CR) $sOutput_tmp = _SSH_Plink_SendCmd($Plink_PID, 'ls /tmp/') ConsoleWrite('- ' & $sOutput_tmp & @CRLF) For $i = 1 To 5 $sOutput_tmp = _SSH_Plink_SendCmd($Plink_PID, ' mkdir /tmp/Dir_' & $i) ConsoleWrite('- ' & $sOutput_tmp & @CRLF) $sOutput &= $sOutput_tmp & @CRLF Next ;$sOutput_tmp = _SSH_Plink_SendCmd($Plink_PID, 'rm -rf /tmp/*') ;ConsoleWrite('- ' & $sOutput_tmp & @CRLF) ;$sOutput &= $sOutput_tmp & @CRLF $sOutput_tmp = _SSH_Plink_SendCmd($Plink_PID, 'ls /tmp/') ConsoleWrite('- ' & $sOutput_tmp & @CRLF) $sOutput &= $sOutput_tmp & @CRLF If ProcessExists($Plink_PID) Then ProcessClose($Plink_PID) EndIf ClipPut($sOutput) EndFunc ;==>_EG_Run_Multi_Command Func _SSH_GetFile($LocalFilePath, $RemoteFilePath, $sHost, $sPort, $sUserName, $sUserPassword) ;Copy single file Local $sCommand = ' -P ' & $sPort & ' -l ' & $sUserName & ' -pw ' & $sUserPassword & ' ' & $sHost & ':' & $RemoteFilePath & ' "' & $LocalFilePath & '" ' Return __PSCP_Execute($sCommand) EndFunc ;==>_SSH_GetFile Func _SSH_GetFolder($LocalFolderPath, $RemoteFolderPath, $sHost, $sPort, $sUserName, $sUserPassword, $sRecur = False) If $sRecur Then ;Copy all files & folders in a folder Local $sCommand = ' -P ' & $sPort & ' -l ' & $sUserName & ' -pw ' & $sUserPassword & ' -r ' & $sHost & ':"' & $RemoteFolderPath & '" "' & $LocalFolderPath & '"' Return __PSCP_Execute($sCommand) Else ;Copy all files in a folder Local $sCommand = ' -P ' & $sPort & ' -l ' & $sUserName & ' -pw ' & $sUserPassword & ' ' & $sHost & ':"' & $RemoteFolderPath & '/*" "' & $LocalFolderPath & '"' Return __PSCP_Execute($sCommand) EndIf EndFunc ;==>_SSH_GetFolder Func _SSH_SendFile($LocalFilePath, $RemoteFilePath, $sHost, $sPort, $sUserName, $sUserPassword) ;Copy single file Local $sCommand = ' -P ' & $sPort & ' -l ' & $sUserName & ' -pw ' & $sUserPassword & ' "' & $LocalFilePath & '" ' & $sHost & ':' & $RemoteFilePath Return __PSCP_Execute($sCommand) EndFunc ;==>_SSH_SendFile Func _SSH_SendFolder($LocalFolderPath, $RemoteFolderPath, $sHost, $sPort, $sUserName, $sUserPassword, $sRecur = False) If $sRecur Then ;Copy all files & folders in a folder Local $sCommand = ' -P ' & $sPort & ' -l ' & $sUserName & ' -pw ' & $sUserPassword & ' -r "' & $LocalFolderPath & '" ' & $sHost & ':"' & $RemoteFolderPath & '"' Return __PSCP_Execute($sCommand) Else ;Copy all files in a folder Local $sCommand = ' -P ' & $sPort & ' -l ' & $sUserName & ' -pw ' & $sUserPassword & ' "' & $LocalFolderPath & '\*" ' & $sHost & ':"' & $RemoteFolderPath & '"' Return __PSCP_Execute($sCommand) EndIf EndFunc ;==>_SSH_SendFolder Func _SSH_SendCmd($sHost, $sPort, $sUserName, $sUserPassword, $sRequest, $sleep = True) Local $sCommand = '-ssh -no-antispoof ' & $sHost & ' -P ' & $sPort & ' -l ' & $sUserName & ' -pw ' & $sUserPassword & ' ' & $sRequest If $sleep Then $sCommand &= ' ; sleep 1' ; sleep prevents truncation of output by fast server disconnect ConsoleWrite($Path_SSH_Plink_EXE & ' ' & $sCommand & @CRLF) Local $Plink_PID = Run($Path_SSH_Plink_EXE & ' ' & $sCommand, '', @SW_HIDE, 9) Local $sStdoutRead, $sData While ProcessExists($Plink_PID) $sStdoutRead = StdoutRead($Plink_PID) If @error Then ExitLoop If $sStdoutRead <> '' Then $sData &= $sStdoutRead $sStdoutRead = '' WEnd $sStdoutRead = '' While ProcessExists($Plink_PID) $sStdoutRead = StderrRead($Plink_PID) If @error Then ExitLoop If $sStdoutRead <> '' Then $sData &= $sStdoutRead $sStdoutRead = '' WEnd ConsoleWrite($sData & @CRLF) If ProcessExists($Plink_PID) Then ProcessClose($Plink_PID) Return __SanitizeOutput($sData) ; returns the full plink command output EndFunc ;==>_SSH_SendCmd Func _SSH_Plink_Connect($sHost, $sPort, $sUserName, $sUserPassword) Local $sCommand = '-ssh -no-antispoof ' & $sHost & ' -P ' & $sPort & ' -l ' & $sUserName & ' -pw ' & $sUserPassword ; sleep prevents truncation of output by fast server disconnect ConsoleWrite($Path_SSH_Plink_EXE & ' ' & $sCommand & @CRLF) Local $Plink_PID = Run($Path_SSH_Plink_EXE & ' ' & $sCommand, '', @SW_HIDE, 7) Local $sStdoutRead, $sData, $error1, $error2 While True $sStdoutRead = StdoutRead($Plink_PID) $error1 = @error If $sStdoutRead <> '' Then $sData &= $sStdoutRead $sStdoutRead = '' $sStdoutRead = StderrRead($Plink_PID) $error2 = @error If $sStdoutRead <> '' Then $sData &= $sStdoutRead ;ConsoleWrite($sData & @CRLF) If StringInStr(StringRight($sData, 1), "#") Then Return $Plink_PID If StringInStr(StringRight($sData, 2), "# ") Then Return $Plink_PID If StringInStr($sData, "Welcome") Then Return $Plink_PID If $error2 And $error2 Then ExitLoop $sStdoutRead = '' $error1 = '' $error2 = '' WEnd Return SetError(1, 0, $Plink_PID) EndFunc ;==>_SSH_Plink_Connect Func _SSH_Plink_SendCmd($Plink_PID, $sCMD) Local $sStdoutRead, $sData, $error1, $error2 ConsoleWrite('> _SSH_Plink_SendCmd [' & $Plink_PID & ']: ' & $sCMD & @CRLF) StdinWrite($Plink_PID, $sCMD & @CR) Sleep(250) While True Sleep(100) $sStdoutRead = StdoutRead($Plink_PID) $error1 = @error ;If $error Then ExitLoop If $sStdoutRead <> '' Then $sData &= $sStdoutRead $sStdoutRead = '' $sStdoutRead = StderrRead($Plink_PID) $error2 = @error If $error2 And $error2 Then ExitLoop If $sStdoutRead <> '' Then $sData &= $sStdoutRead $sStdoutRead = '' $error1 = '' $error2 = '' ;ConsoleWrite($sData & @CRLF) If StringInStr(StringRight($sData, 1), "#") Then Return __SanitizeOutput($sData) If StringInStr(StringRight($sData, 2), "# ") Then Return __SanitizeOutput($sData) WEnd Return __SanitizeOutput($sData) EndFunc ;==>_SSH_Plink_SendCmd Func __SanitizeOutput($str) Local $sBell = BinaryToString("0x07", 4), $sESC = BinaryToString("0x1B", 4) $str = StringReplace($str, BinaryToString("0xC3A2E282ACCB9C", 4), "'") ; '‘' $str = StringReplace($str, BinaryToString("0xC3A2E282ACE284A2", 4), "'") ; '’' $str = StringReplace($str, $sESC & "[?2004h", "") $str = StringReplace($str, $sESC & "[?2004l" & @CR, "") If StringInStr($str, $sBell) Then ; � Local $lines = StringSplit($str, @CRLF) Local $p1, $p2 For $i = 1 To $lines[0] $p1 = StringInStr($str, $sESC & "]0;") ; � If $p1 <> 0 Then $p2 = StringInStr($str, $sBell, 1, 1, $p1) If $p2 <> 0 Then $str = StringLeft($str, $p1 - 1) & StringRight($str, StringLen($str) - $p2) EndIf EndIf Next EndIf ; Matching Pattern: ESC\[[0-107][;0-107][;0-255]m ; leading zeros are matched ; Matches ANSI Codes: SGR, 3-bit color, 4-bit color and 8-bit color $str = StringRegExpReplace($str, $sESC & "\[([0-1]0[0-7]|\d?\d)?(;[0-1]0[0-7]|;\d?\d)?(;[0-1]?\d?\d|;(0|2)[0-5][0-5])?m", "") ; Matching Pattern: ESC\[(38|48);2;[0-255];[0-255];[0-255]m ; leading zeros are matched ; Matches ANSI Codes: True Color (24-bit) $str = StringRegExpReplace($str, $sESC & "\[(38|48);2;([0-1]?\d?\d|(0|2)[0-5][0-5]);([0-1]?\d?\d|(0|2)[0-5][0-5]);([0-1]?\d?\d|(0|2)[0-5][0-5])m", "") Return $str EndFunc ;==>__SanitizeOutput Func __PSCP_Execute($sCommand) Local $sStdoutRead, $sData, $error1, $error2 Local $PSCP_PID = Run($Path_PSCP_EXE & ' ' & $sCommand, '', @SW_HIDE, 7) ConsoleWrite('> __PSCP_Execute [' & $PSCP_PID & ']: ' & $sCommand & @CRLF) Sleep(250) While True Sleep(100) $sStdoutRead = StdoutRead($PSCP_PID) $error1 = @error ;If $error Then ExitLoop If $sStdoutRead <> '' Then $sData &= $sStdoutRead $sStdoutRead = '' $sStdoutRead = StderrRead($PSCP_PID) $error2 = @error If $error2 And $error2 Then ExitLoop If $sStdoutRead <> '' Then $sData &= $sStdoutRead $sStdoutRead = '' $error1 = '' $error2 = '' ;ConsoleWrite($sData & @CRLF) WEnd Return __SanitizeOutput($sData) EndFunc ;==>__PSCP_Execute > Any suggestions and contributions are welcome!
  15. The_ImageSearch_Create_BMP() function is only used to quickly create an image file for searching instead of using Paint to cut and save as a file! EG: ;~ Opt("MustDeclareVars", 1) ;~ #AutoIt3Wrapper_UseX64=y ;~ #AutoIt3Wrapper_Change2CUI=y #RequireAdmin #include "_ImageSearch_UDF.au3" HotKeySet("{Esc}", "_Exit") ; Press ESC for exit Func _Exit() Exit 0 EndFunc ;==>_Exit Global Const $Ask_On_Found = 0 Global Const $Mouse_Move_On_Found = 1 Global Const $Mouse_Click_On_Found = 0 Global Const $iSleep_Time=500 Global $_Image_1 = @ScriptDir & "\example.bmp" ; Your Image to search ConsoleWrite("! Search for images: " & $_Image_1 & @CRLF & '! Searching on the screen ...' & @CRLF) Global $sCount = 0 While 1 ToolTip('(Press ESC for EXIT) Searching ...', 1, 1) Sleep($iSleep_Time) $sCount += 1 Local $return = _ImageSearch($_Image_1) If $return[0] = 1 Then ConsoleWrite('- [' & $sCount & '] Image found:' & " X=" & $return[1] & " Y=" & $return[2] & @CRLF) If $Mouse_Move_On_Found Then MouseMove($return[1], $return[2]) Sleep($iSleep_Time) EndIf If $Mouse_Click_On_Found Then MouseClick("left", $return[1], $return[2]) ToolTip('(Press ESC for EXIT) - [' & $sCount & "] Image found:" & " X=" & $return[1] & " Y=" & $return[2], 1, 1) If $Ask_On_Found Then Local $ask = MsgBox(6 + 262144, 'Success [' & $sCount & ']', 'Image found:' & " X=" & $return[1] & " Y=" & $return[2]) If $ask = 2 Or $ask = 3 Or $ask = 5 Or $ask = 7 Then Exit ;No, Abort, Cancel, and Ignore If $ask = 10 Then _ImageSearch_Create_BMP($_Image_1) ; Continue ;Try Again EndIf EndIf Sleep(200) WEnd
  16. I had a problem when opening image files downloaded from the internet for editing, it seems that the file extension does not represent the file correctly. For example: MyPic.png but it is a jpg file so I wrote this function to distinguish the correct extension for the files. If you have a better solution or function, please share: ;~ #include <File.au3> ;~ Global $sPathToFiles = 'C:\_Website_\random-img\img\horizontal' ;~ Local $aArray = _FileListToArrayRec($sPathToFiles, "*.*", $FLTAR_FILES, $FLTAR_RECUR, 0, $FLTAR_FULLPATH) ;~ Local $sFile, $orgTYPE, $curTYPE ;~ For $i = 1 To UBound($aArray) - 1 ;~ $sFile = $aArray[$i] ;~ $orgTYPE = _FileDetectType($sFile) ;~ $curTYPE = __GetEXT($sFile) ;~ If $curTYPE <> $orgTYPE Then ;~ ConsoleWrite('! [' & $i & '] ' & $sFile & ' - [' & $curTYPE & ' > ' & $orgTYPE & ']' & @CRLF) ;~ FileMove($sFile, StringReplace($sFile, $curTYPE, $orgTYPE), 1) ;~ Else ;~ ConsoleWrite('- [' & $i & '] ' & $sFile & ' - [' & $curTYPE & ' > ' & $orgTYPE & ']' & @CRLF) ;~ EndIf ;~ Next Func _FileDetectType($sFile) Local $iExt = __GetEXT($sFile) Local $sExt = __ExtHeaderProcessing($sFile, 16) If $sExt = '' Then $sExt = __ExtHeaderProcessing($sFile, 256) $sExt = StringLeft($sExt, 16) Local $2String = StringLeft($sExt, 2) If StringInStr($sExt, 'Exif') Or StringInStr($sExt, 'JFIF') Or StringInStr($sExt, 'Adobe_d') Then Return '.jpg' ElseIf StringInStr($sExt, 'avif') Then Return '.avif' ElseIf StringInStr($sExt, 'WEBP') Then Return '.webp' ElseIf StringInStr($sExt, 'GIF') Then Return '.gif' ElseIf $2String == 'BM' Then Return '.bmp' ElseIf StringInStr($sExt, '_II') Then Return '.eps' ElseIf StringInStr($sExt, 'PDF') Then Return '.pdf' ElseIf StringInStr($sExt, 'PNG') Then Return '.png' ElseIf StringInStr($sExt, 'II') Then Return '.tif' ElseIf StringInStr($sExt, '8BPS') Then Return '.psd' ElseIf StringInStr($sExt, 'L_F') Or $sExt == 'L' Then Return '.lnk' ElseIf StringInStr($sExt, 'ITSF') Then Return '.chm' ElseIf StringInStr($sExt, 'MSCF') Then Return '.cab' ElseIf StringInStr($sExt, 'ADBE') Then Return '.icc' ElseIf StringInStr($sExt, 'SQLite_f') Then Return '.db' ElseIf $sExt == 'MZ' Or $sExt == 'MZx' Or $sExt == 'MZP' Then If StringInStr($iExt, 'dll') Then Return '.dll' If StringInStr($iExt, 'tlb') Then Return '.tlb' Return '.exe' ElseIf StringInStr($sExt, 'PA30') Or StringInStr($sExt, 'TPA30') Or StringInStr($sExt, 'F_B') Or $sExt == 't_B' Or $sExt == 's_B' Or $sExt == 'z_B' Or $sExt == 'B_V' Or $sExt == '00_h' Or $sExt == 'f_h' Or $sExt == 'v' Or $sExt == 'h' Or $sExt == 'B' Then Return '.ico' Else Return $iExt EndIf EndFunc ;==>_FileDetectType Func __ExtHeaderProcessing($sFile, $rCount = Default) Local $hOpen = FileOpen($sFile, 16) Local $Header = FileRead($hOpen, $rCount) FileClose($hOpen) Local $RegExNonStandard = "(?i)([^a-z0-9-_])", $RegExNoUnicode = "(*UCP)\x{2019}" Local $sExt = BinaryToString($Header) $sExt = StringRegExpReplace($sExt, $RegExNonStandard, "_") $sExt = StringRegExpReplace($sExt, $RegExNoUnicode, "_") While StringInStr($sExt, '__') $sExt = StringReplace($sExt, '__', '_') WEnd If StringRight($sExt, 1) == '_' Then $sExt = StringTrimRight($sExt, 1) If StringLeft($sExt, 1) == '_' Then $sExt = StringTrimLeft($sExt, 1) Return $sExt EndFunc ;==>__ExtHeaderProcessing Func __GetEXT($sFile) Local $iExt = StringRegExpReplace($sFile, "^.*\.", "") If ($iExt = '') Then $iExt = StringMid($sFile, StringInStr($sFile, ".", 2, -1)) If StringRight($iExt, 1) == '.' Then $iExt = StringTrimRight($iExt, 1) If StringLeft($iExt, 1) == '.' Then $iExt = StringTrimLeft($iExt, 1) Return '.' & $iExt EndFunc ;==>__GetEXT
  17. You are confused about the functionality this UDF provides!
  18. I tested the code on Windows XP and other Windows versions! Of course it doesn't return any results so I just wrote this function! ARM "This constant is available starting with Windows 7 and Windows Server 2008 R2." ARM64 Little-Endian "This constant is available starting with Windows 8.1 and Windows Server 2012 R2." https://learn.microsoft.com/en-us/windows/win32/sysinfo/image-file-machine-constants
  19. Replacement function for _WinAPI_GetBinaryType() and _WinAPI_GetPEType() ! Using WinAPI depends on the version of Windows, so the results may not be accurate. So this UDF was born: #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** ; Eg: ConsoleWrite("-: " & _GetPeType("C:\Windows\System32\winver.exe") & " - Extended: " & @extended & " > Is_x64_Exe: " & _Is_x64_Exe("C:\Windows\System32\winver.exe") & @CRLF) ConsoleWrite("-: " & _GetPeType("C:\Windows\SysWOW64\winver.exe") & " - Extended: " & @extended & " > Is_x32_Exe: " & _Is_x32_Exe("C:\Windows\SysWOW64\winver.exe") & @CRLF) ConsoleWrite("-: " & _GetPeType("C:\Program Files\Microsoft Visual Studio\2022\VC\Tools\MSVC\14.40.33807\bin\arm64\pgosweep.exe") & " - Extended: " & @extended & " > Is_x64Arm_Exe: " & _Is_x64Arm_Exe("C:\Program Files\Microsoft Visual Studio\2022\VC\Tools\MSVC\14.40.33807\bin\arm64\pgosweep.exe") & @CRLF) Func _Is_x64_Exe($sPath) Local $peTYPE = _GetPeType($sPath) If ((@extended = 1) Or ($peTYPE = 'AMD64')) Then Return 1 Return 0 EndFunc ;==>_Is_x64_Exe Func _Is_x32_Exe($sPath) Local $peTYPE = _GetPeType($sPath) If ((@extended = 2) Or ($peTYPE = 'I386')) Then Return 1 Return 0 EndFunc ;==>_Is_x32_Exe Func _Is_x64Arm_Exe($sPath) Local $peTYPE = _GetPeType($sPath) If ((@extended = 3) Or ($peTYPE = 'ARM64')) Then Return 1 Return 0 EndFunc ;==>_Is_x64Arm_Exe Func _GetPeType($peFilePath) ; Retrieves a type of the machine for the specified portable executable (PE) ; The return value is the architecture name ; @extendedis a custom number for architecture Local $hFile = FileOpen($peFilePath, 16) If ($hFile = -1) Then Return SetError(1, 0, '') ; File does not exist or No permission to open file! If BinaryToString(FileRead($hFile, 2)) <> "MZ" Then FileClose($hFile) Return SetError(2, 0, 0) ; Not a PE file. EndIf FileSetPos($hFile, 60, 0) ; Move to Windows PE Signature Offset location Local $peTYPE = FileRead($hFile, 4) FileSetPos($hFile, Number($peTYPE) + 4, 0) ; Move to Windows PE Header Offset $peTYPE = FileRead($hFile, 2) ; Read PE data FileClose($hFile) ;~ Local $sFileName = StringRegExpReplace($peFilePath, "^.*\\", "") ; Get File name with ext Switch $peTYPE Case '0x6486', '0x8664' Return SetError(0, 1, 'AMD64') ; AMD64 (K8) x64 64-bit Case '0x4C01', '0x014C' Return SetError(0, 2, 'I386') ; Intel 386 x86 32-bit Case '0x64AA', '0xAA64' Return SetError(0, 3, 'ARM64') ; ARM64 Little-Endian Case '0x0002', '0x0200' Return SetError(0, 4, 'IA64') ; Intel 64 Case '0xC201', '0x01C2' Return SetError(0, 5, 'THUMB') ; ARM Thumb/Thumb-2 Little-Endian Case '0xC401', '0x01C4' Return SetError(0, 6, 'ARMNT') ; ARM Thumb-2 Little-Endian Case '0x6201', '0x0162' Return SetError(0, 7, 'R3000') ; MIPS little-endian, 0x160 big-endian Case '0x6601', '0x0166' Return SetError(0, 8, 'R4000') ; MIPS little-endian Case '0x6801', '0x0168' Return SetError(0, 9, 'R10000') ; MIPS little-endian Case '0x6901', '0x0169' Return SetError(0, 10, 'WCEMIPSV2') ; MIPS little-endian WCE v2 Case '0x8401', '0x0184' Return SetError(0, 11, 'ALPHA') ; Alpha_AXP Case '0xA201', '0x01A2' Return SetError(0, 12, 'SH3') ; SH3 little-endian Case '0xA301', '0x01A3' Return SetError(0, 13, 'SH3DSP') ; SH3DSP Case '0xA401', '0x01A4' Return SetError(0, 14, 'SH3E') ; SH3E little-endian Case '0xA601', '0x01A6' Return SetError(0, 15, 'SH4') ; SH4 little-endian Case '0xA801', '0x01A8' Return SetError(0, 16, 'SH5') ; SH5 Case '0xC001', '0x01C0' Return SetError(0, 17, 'ARM') ; ARM Little-Endian Case '0xD301', '0x01D3' Return SetError(0, 18, 'AM33') ; TAM33BD Case '0xF001', '0x01F0' Return SetError(0, 19, 'POWERPC') ; IBM PowerPC Little-Endian Case '0xF101', '0x01F1' Return SetError(0, 20, 'POWERPCFP') ; POWERPCFP Case '0x6602', '0x0266' Return SetError(0, 21, 'MIPS16') ; MIPS Case '0x8402', '0x0284' Return SetError(0, 22, 'ALPHA64') ; ALPHA64 Case '0x6603', '0x0366' Return SetError(0, 23, 'MIPSFPU') ; MIPS Case '0x6604', '0x0466' Return SetError(0, 24, 'MIPSFPU16') ; MIPS Case '0x8402', '0x0284' Return SetError(0, 25, 'AXP64') ; AXP64 Case '0x2005', '0x0520' Return SetError(0, 26, 'TRICORE') ; Infineon Case '0xEF0C', '0x0CEF' Return SetError(0, 27, 'CEF') ; CEF Case '0xBC0E', '0x0EBC' Return SetError(0, 28, 'EBC') ; EFI Byte Code Case '0x4190', '0x9041' Return SetError(0, 29, 'M32R') ; M32R little-endian Case '0xEEC0', '0xC0EE' Return SetError(0, 30, 'CEE') ; CEE Case Else Return SetError(3, 0, '') ; Unknown EndSwitch Return SetError(3, -1, '') EndFunc ;==>_GetPeType ; Dao Van Trong - TRONG.PRO
  20. Precompiled Dll is used in many viruses, edit it yourself from source! You can compile the dll yourself from open source: : https://github.com/M2TeamArchived/NSudo/
  21. Run as TrustedInstaller using DLL (NSudoDM.dll, NSudoAPI.dll) Is a tool for launching programs with similar privileges to TrustedInstaller. Itself or any other program. Below is an example that reruns itself under TrustedInstaller privileges: #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Compile_Both=y #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <File.au3> #include <Array.au3> #include <WinAPI.au3> #include <Constants.au3> Global Const $NSudo_Dll_Dir = (FileExists(@ScriptDir & '\NSudoAPI_x86.dll') And FileExists(@ScriptDir & '\NSudoAPI_x64.dll') And FileExists(@ScriptDir & '\NSudoDM_x86.dll') And FileExists(@ScriptDir & '\NSudoDM_x64.dll')) ? @ScriptDir : @TempDir OnAutoItExitRegister("_OnExit_Clean") Global Const $NSudoAPI_Dll_x86 = $NSudo_Dll_Dir & '\NSudoAPI_x86.dll' Global Const $NSudoAPI_Dll_x64 = $NSudo_Dll_Dir & '\NSudoAPI_x64.dll' Global Const $NSudoAPI_Dll = @AutoItX64 ? $NSudoAPI_Dll_x64 : $NSudoAPI_Dll_x86 Global Const $NSudoDM_Dll_x86 = $NSudo_Dll_Dir & '\NSudoDM_x86.dll' Global Const $NSudoDM_Dll_x64 = $NSudo_Dll_Dir & '\NSudoDM_x64.dll' Global Const $NSudoDM_Dll = @AutoItX64 ? $NSudoDM_Dll_x64 : $NSudoDM_Dll_x86 If $NSudo_Dll_Dir<> @ScriptDir Then FileInstall("NSudoDM_x86.dll",$NSudoDM_Dll_x86,1) FileInstall("NSudoDM_x64.dll",$NSudoDM_Dll_x64,1) FileInstall("NSudoAPI_x86.dll",$NSudoAPI_Dll_x86,1) FileInstall("NSudoAPI_x64.dll",$NSudoAPI_Dll_x64,1) EndIf Global Const $NSudoAPI_UserModeType_DEFAULT = 0 ; Run the program with the current user's access token. If User Account Control (UAC) is not disabled, the permissions of this mode are equivalent to those of a standard user Global Const $NSudoAPI_UserModeType_TRUSTED_INSTALLER = 1 ; Run the program with the TrustedInstaller access token Global Const $NSudoAPI_UserModeType_SYSTEM = 2 ; Run the program with the System access token Global Const $NSudoAPI_UserModeType_CURRENT_USER = 3 ; Run the program with the elevated current user's access token. The permissions of this mode are equivalent to those of the elevated user Global Const $NSudoAPI_UserModeType_CURRENT_PROCESS = 4 ; Run the program with the current process's access token. The permissions of this mode are equivalent to those of the elevated user Global Const $NSudoAPI_UserModeType_CURRENT_PROCESS_DROP_RIGHT = 5 ; Run the program with the current process's LUA mode access token. The permissions of this mode are equivalent to those of a standard user and this implementation is consistent with the corresponding implementation in iertutil.dll in Internet Explorer Global Const $NSudoAPI_PrivilegesModeType_DEFAULT = 0 ; default privileges Global Const $NSudoAPI_PrivilegesModeType_ENABLE_ALL_PRIVILEGES = 1 ; enable all privileges Global Const $NSudoAPI_PrivilegesModeType_DISABLE_ALL_PRIVILEGES = 2 ; disable all privileges Global Const $NSudoAPI_MandatoryLabelType_UNTRUSTED = 0 ;Untrusted Global Const $NSudoAPI_MandatoryLabelType_LOW = 1 ;Low Global Const $NSudoAPI_MandatoryLabelType_MEDIUM = 2 ;Medium Global Const $NSudoAPI_MandatoryLabelType_MEDIUM_PLUS = 3 ;Medium-high Global Const $NSudoAPI_MandatoryLabelType_HIGH = 4 ;High Global Const $NSudoAPI_MandatoryLabelType_SYSTEM = 5 ;System Global Const $NSudoAPI_MandatoryLabelType_PROTECTED_PROCESS = 6 ;Protected process Global Const $NSudoAPI_ProcessPriorityClassType_BELOW_NORMAL = 0 ;Below normal Global Const $NSudoAPI_ProcessPriorityClassType_NORMAL = 1 ;Normal Global Const $NSudoAPI_ProcessPriorityClassType_ABOVE_NORMAL = 2 ;Above normal Global Const $NSudoAPI_ProcessPriorityClassType_HIGH = 3 ;High Global Const $NSudoAPI_ProcessPriorityClassType_REALTIME = 4 ;Real time Global Const $NSudoAPI_ShowWindowModeType_DEFAULT = 0 ;Default Global Const $NSudoAPI_ShowWindowModeType_SHOW = 1 ;Show window Global Const $NSudoAPI_ShowWindowModeType_HIDE = 2 ;Hide window Global Const $NSudoAPI_ShowWindowModeType_MAXIMIZE = 3 ;Maximize Global Const $NSudoAPI_ShowWindowModeType_MINIMIZE = 4 ;Minimize Global $NSudoAPI_WaitInterval = 0 ; The time (in milliseconds) to wait for the created process. Global $NSudoAPI_CreateNewConsole = True ; the new process will run in a new console window, otherwise it will run directly in the console window corresponding to the process (default setting). If (@OSArch = "X64") And (@AutoItX64 = 0) Then _WinAPI_Wow64EnableWow64FsRedirection(False) DllCall("kernel32.dll", "boolean", "Wow64DisableWow64FsRedirection", "boolean", 1) ;~ Turns On 64 Bit Redirection EndIf ;The command line to be executed, the maximum length = MAX_PATH, i.e. 260 characters. Global $NSudoAPI_CommandLine = @ScriptFullPath ;Used to specify the current directory of the process. A full path is required. UNC paths can be used. If this parameter is nullptr, the new process will use the current path used by the process that called this function. Global $NSudoAPI_CurrentDirectory = @WorkingDir Global $ProcessOwner = _ProcessGetOwner(@AutoItPID) Global $DllCall_Error_Return = 0, $DllCall_Error_Name = 'unknow', $DllCall_Return = '' _ConsoleWrite("! " & @YEAR & "/" & @MON & "/" & @MDAY & "-" & @HOUR & ":" & @MIN & ":" & @SEC & " !") _ConsoleWrite("! " & @ScriptFullPath & " | User: " & @UserName & " | NSUDO_Dll_Dir: " & $NSudo_Dll_Dir) _ConsoleWrite("! " & "ProcessPID:" & @AutoItPID & " | ProcessOwner: " & $ProcessOwner) Global $NSudoDM_DllCall_Handle = _WinAPI_LoadLibrary($NSudoDM_Dll) If @UserName <> "SYSTEM" And @UserName <> 'LOCAL SERVICE' Then _NSudoAPI_RUN() Else ; TEST 1 ================================================================================================= If FileExists(@WindowsDir & '\System32\sethc_.exe') Then ; Restore FileDelete(@WindowsDir & '\System32\sethc.exe') FileMove(@WindowsDir & '\System32\sethc_.exe', @WindowsDir & '\System32\sethc.exe', 1) If @AutoItX64 Then FileDelete(@WindowsDir & '\SysWOW64\sethc.exe') FileMove(@WindowsDir & '\SysWOW64\sethc_.exe', @WindowsDir & '\SysWOW64\sethc.exe', 1) EndIf Else ; Replace FileMove(@WindowsDir & '\System32\sethc.exe', @WindowsDir & '\System32\sethc_.exe', 1) FileCopy(@WindowsDir & '\System32\cmd.exe', @WindowsDir & '\System32\sethc.exe', 1) If @AutoItX64 Then FileMove(@WindowsDir & '\SysWOW64\sethc.exe', @WindowsDir & '\SysWOW64\sethc_.exe', 1) FileCopy(@WindowsDir & '\SysWOW64\cmd.exe', @WindowsDir & '\SysWOW64\sethc.exe', 1) EndIf Run(@WindowsDir & '\System32\sethc.exe') EndIf ; TEST 2 ======================================================================================================== _ArrayDisplay(_FileListToArray(@HomeDrive & '\System Volume Information'), "ProcessOwner: " & $ProcessOwner) EndIf _WinAPI_FreeLibrary($NSudoDM_DllCall_Handle) Func _NSudoAPI_RUN() _ConsoleWrite("- Call NSudoCreateProcess in Dll: " & $NSudoAPI_Dll) ;~ Local $NSudoAPI_DllCall_Handle = DllOpen($NSudoAPI_Dll) Local $NSudoAPI_DllCall_Result = DllCall($NSudoAPI_Dll, 'int', 'NSudoCreateProcess', _ 'int', $NSudoAPI_UserModeType_TRUSTED_INSTALLER, _ ; NSUDO_USER_MODE_TYPE 'int', $NSudoAPI_PrivilegesModeType_ENABLE_ALL_PRIVILEGES, _ ; NSUDO_PRIVILEGES_MODE_TYPE 'int', $NSudoAPI_MandatoryLabelType_SYSTEM, _ ; NSUDO_MANDATORY_LABEL_TYPE 'int', $NSudoAPI_ProcessPriorityClassType_ABOVE_NORMAL, _ ; NSUDO_PROCESS_PRIORITY_CLASS_TYPE 'int', $NSudoAPI_ShowWindowModeType_SHOW, _ ; NSUDO_SHOW_WINDOW_MODE_TYPE 'dword', $NSudoAPI_WaitInterval, _ ; WaitInterval 'bool', $NSudoAPI_CreateNewConsole, _ ; CreateNewConsole 'wstr', $NSudoAPI_CommandLine, _ ; CommandLine 'wstr', $NSudoAPI_CurrentDirectory) ; CurrentDirectory $DllCall_Error_Return = @error If $DllCall_Error_Return > 0 Then _ConsoleWrite("! DllCall Error num: " & $DllCall_Error_Return) Switch $DllCall_Error_Return Case 1 $DllCall_Error_Name = 'unable to use the DLL file' Case 2 $DllCall_Error_Name = 'unknown "Return type"' Case 3 $DllCall_Error_Name = '"function" not found in the DLL file' Case 4 $DllCall_Error_Name = 'bad number of parameters' Case 5 $DllCall_Error_Name = 'bad parameter' EndSwitch _ConsoleWrite("! DllCall Error Name: " & $DllCall_Error_Name) EndIf If IsArray($NSudoAPI_DllCall_Result) Then For $i = 0 To UBound($NSudoAPI_DllCall_Result) - 1 $DllCall_Return &= $NSudoAPI_DllCall_Result[$i] & @CRLF Next EndIf _ConsoleWrite('- DllCall Return :(IsArray:' & IsArray($NSudoAPI_DllCall_Result) & ') > [[' & $DllCall_Return & ']]' & @CRLF & "- Error: " & $DllCall_Error_Name & @CRLF) EndFunc ;==>_NSudoAPI_RUN Func _ConsoleWrite($sText) ConsoleWrite($sText & @CRLF) FileWriteLine(@ScriptFullPath & ".logs", $sText) EndFunc ;==>_ConsoleWrite Func _ProcessGetOwner($ivPID) $ivPID = ProcessExists($ivPID) If Not $ivPID Then Return (SetError(1, 0, 0)) Local Const $TOKEN_READ = 0x00020000 + 0x0008 ; STANDARD_RIGHTS_READ+TOKEN_QUERY Local $hvProcess = _WinAPI_OpenProcess($PROCESS_QUERY_INFORMATION, False, $ivPID, False) Local $hvToken = _Security__OpenProcessToken($hvProcess, $TOKEN_READ) Local $bvSID = _Security__GetTokenInformation($hvToken, $TOKENOWNER) Local $avRet = DllStructCreate("ulong", DllStructGetPtr($bvSID)) $avRet = _Security__SidToStringSid(DllStructGetData($avRet, 1)) $avRet = _Security__LookupAccountSid($avRet) _WinAPI_CloseHandle($hvProcess) _WinAPI_CloseHandle($hvToken) If Not IsArray($avRet) Then Return (SetError(1, 0, _GetProcessOwner($ivPID))) Return (SetError(0, $avRet[2], $avRet[0])) EndFunc ;==>_ProcessGetOwner Func _GetProcessOwner($PID, $sComputer = ".") Local $objWMI, $colProcs, $sUserName, $sUserDomain $objWMI = ObjGet("winmgmts:\\" & $sComputer & "\root\cimv2") If IsObj($objWMI) Then $colProcs = $objWMI.ExecQuery("Select ProcessId From Win32_Process Where ProcessId=" & $PID) If IsObj($colProcs) Then For $Proc In $colProcs If $Proc.GetOwner($sUserName, $sUserDomain) = 0 Then Return $sUserName Next EndIf EndIf EndFunc ;==>_GetProcessOwner Func _OnExit_Clean() If StringLower($NSudo_Dll_Dir) = StringLower(@ScriptDir) Then Exit FileDelete($NSudoAPI_Dll_x86) FileDelete($NSudoAPI_Dll_x64) FileDelete($NSudoDM_Dll_x86) FileDelete($NSudoDM_Dll_x64) EndFunc ;==>_OnExit_Clean ; Launch processes with TrustedInstaller privilege by Dao Van Trong - TRONG.PRO ; Dll from NSudo: https://github.com/M2TeamArchived/NSudo/releases . Download DLL from HERE: https://github.com/M2TeamArchived/NSudo/releases/download/9.0-Preview1/NSudo_9.0_Preview1_9.0.2676.0.zip Attachments Maximum total size is: 4.26 kB 🤐
  22. This code runs a test on the computer - Windows 11 24H2 LTSC - Autoit version: 3.3.16.1 #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** If @Compiled < 1 Then MsgBox(48 + 262144, "TEST CUI - You have not compiled yet!", "Let's compile the script with CUI to try it out!", 10) Exit EndIf Local $hDOS = WinGetHandle("[CLASS:ConsoleWindowClass]") If Not $hDOS Then WinGetTitle("[active]") ConsoleWrite("Hello" & @CRLF) WinSetState($hDOS, '', @SW_HIDE) Sleep(2000) WinSetState($hDOS, '', @SW_SHOW) Sleep(2000) WinSetState($hDOS, '', @SW_MINIMIZE) Sleep(2000) WinSetState($hDOS, '', @SW_MAXIMIZE) Sleep(2000) WinSetState($hDOS, '', @SW_RESTORE) Sleep(2000) ConsoleWrite("Move" & WinMove($hDOS, '', @DesktopHeight, @DesktopWidth) & @CRLF) Sleep(2000) ConsoleWrite("Restore Move" & WinMove($hDOS, '', 10, 10) & @CRLF) Sleep(3000) ConsoleWrite("Move" & WinMove($hDOS, '', @DesktopHeight, @DesktopWidth) & @CRLF) Sleep(2000) ConsoleWrite("Restore Move" & WinMove($hDOS, '', 10, 10) & @CRLF) Sleep(3000) You should rewrite script using GUI to make it easier to control than using CUI
  23. You can delete it this way: #include <File.au3> #include <MsgBoxConstants.au3> If Delete_U() Then MsgBox($MB_ICONINFORMATION + $MB_TOPMOST, "Delete_U", "OK") Else MsgBox($MB_ICONWARNING + $MB_TOPMOST, "Delete_U", "Error") EndIf Func Delete_U() Local $sFilePath = 'G:\Session_Master' Local $sMask = "*.u*" Local $sNameLock = "Session_Undo" Local $iReturn = $FLTAR_FILES Local $aArrayF = _FileListToArrayRec($sFilePath, $sMask, $iReturn, $FLTAR_RECUR, $FLTAR_SORT, $FLTAR_FULLPATH) Local $F_Error = @error, $iDr = 0 If $F_Error < 1 And IsArray($aArrayF) Then For $i = 1 To $aArrayF[0] If StringInStr($aArrayF[$i], $sNameLock) Then $iDr = FileDelete($aArrayF[$i] & @CRLF) If $iDr > 0 Then ConsoleWrite("+ [" & $i & "] File Deleted: " & $aArrayF[$i] & @CRLF) Else ConsoleWrite("! [" & $i & "] File not Deleted: " & $aArrayF[$i] & @CRLF) $F_Error += 1 EndIf $iDr = 0 EndIf Next Return SetError($F_Error, 0, $F_Error > 1 ? 0 : 1) Else ConsoleWrite("Error (" & $F_Error & ") No " & $sMask & " files found in: " & $sFilePath & @CRLF) Return SetError(0, 0, 1) EndIf EndFunc ;==>Delete_U
×
×
  • Create New...