Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 03/13/2020 in all areas

  1. spudw2k

    System Scan Report Tool

    Was revisiting an old script I made for work years ago; it performs a local system scan and produces an HTML report. the report was very basic and ugly...now it's less ugly, so I thought I'd share. It collects system info (i.e. manufacturer, model, serial, CPU, RAM, BIOS ver., etc.), network card info, a device list & installed software list. Requires DeviceAPI.au3 UDF by Weaponx #NoTrayIcon ;#RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=n #AutoIt3Wrapper_Res_Fileversion=0.2.2.0 ;#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker #AutoIt3Wrapper_Run_Obfuscator=y #Obfuscator_Parameters=/cs=0 /cn=0 /cf=0 /cv=0 /sf=1 /sv=1 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #NoAutoIt3Execute Global $version = "0.2.2" #cs - Version History 0.2.2 Bug fix [*] Corrected _WriteArrayToLog() destination file for debug 0.2.1 Minor Updates [+] Added System Info Attributes (OS, OS Version, Organization and Registered Owner) 0.2.0 Misc Updates [+] HTML Report Format - Initial Bootstrap CSS support [*] Minor report changes [*] Changed log write logic 0.1.5 Minor Updates [+] Added Obfuscation to Reduce Script Size [+] Set FileVersion to Match Script Version [+] Disabled external AutoIt script/code execution. 0.1.4 Significant Updates / Script Cleanup [-] Removed Omitted code from version 0.1.3 [*] Code Cleanup [*] Optimized Network Info WMI Query [+] Added HTML Footer [*] Changed HTML Report Header and added timestamps [*] Changed Script name to SystemScan 0.1.3 Major Updates / Script Cleanup & HTML Report [-] Removed Omitted code from version 0.1.2 [+] Added HTML Report Functions [+] Added Data Array Sort [*] Omitted Software & Device Hash Checking and Scan Force and Scan Version Reg Key [*] Omitted Uninstall String 0.1.2 Minor Updates / Script Cleanup [*] Changed All Collection Functions to Output Data Arrays [+] Created Array to Log File Method [-] Removed TimeZone from System Info Collection [*] Omitted User Name from System Info Collection [*] Omitted GUID Generation [*] Changed Scan Force to not remove or check Software and Device Signatures [*] Misc Code Cleanup [*] Omitted Software install date conversions 0.1.1 Minor Updates / Script Cleanup 0.1 Alpha Build #ce #Region - Initialization ;#AutoIt3Wrapper_Change2CUI=Y #include <Array.au3> ;Include Native AutoIt Library for Array Functions #include <DeviceAPI.au3> ;By Weaponx - https://www.autoitscript.com/forum/topic/77731-device-management-api/ #include <Constants.au3> ;Include Native AutoIt Library for AutoIt Constants #include <Date.au3> ;Include Native AutoIt Library for Date/Time Functions #include <Misc.au3> ;Include Native AutoIt Library for Misc. Functions (_Singleton()) ;Initialize Global $exitTimer = 0, $host = @ComputerName, $debug = 0 ;Define Global Variables for Timer, Hostname & Debug Flags Global $destDir = @ScriptDir & "\" ;Define LogFile Destination If Not _Singleton("DomainScan") Then Exit ;Enforce Singleton Execution If Not FileExists($destDir) Then DirCreate($destDir) ;Create Destination Dir Local $log = $destdir & "\" & @ComputerName & ".htm" $log = FileOpen($log, 2) FileDelete($destDir & "DomainScanLog.txt") ;Remove Debug Logfile ;Parse Command-Line Arguments for Debug and ScanForce Options If $CMDLINE[0] Then If StringInStr($CMDLINERAW, "debug") Then $debug = 1 ;Unused Function with Example Usage ;If StringInstr($CMDLINERAW,"/fileinfolist") Then ;domainscan.exe /fileinfolist "C:\dir\file.txt" ;_FileInfoList($CMDLINE[$CMDLINE[0]]) ;EndIf EndIf ;==>Initialize #EndRegion - Initialization #Region - Main ;Establish Local WMI Connection $oMyError = ObjEvent("AutoIt.Error", "MyErrFunc") $objWMIService = ObjGet("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") If Not IsObj($objWMIService) Then If $debug Then _DebugLog("Failed to Establish WMI Connection") _Exit() EndIf If $debug Then _DebugLog("Established WMI Connection") ;==>Establish WMI Connection ;Timeout Timer $exitTimer = TimerInit() AdlibRegister("_ExitTimer", 30000) OnAutoItExitRegister("_Exit") ;==>Timeout Timer ;Collect System Data _WriteHTMLReportHeader($destDir) _AddSystemInfo($host) _AddSystemNetworkInfo($host) _AddSystemDevices($host) _AddSystemInstalledSoft($host) _WriteHTMLReportFooter($destDir) _Exit() ;==>Collect System Data ;Save log to NAS ;==>Save log to NAS #EndRegion - Main #Region - User Defined Functions Func _AddSystemInfo($hostname) ;Collect System Information If $debug Then _DebugLog("Collecting System Information") ;Execute WMI Queries $colItems = $objWMIService.ExecQuery("SELECT Name FROM Win32_Processor") For $objItem In $colItems $CPU = StringLeft(StringStripWS($objItem.name, 7), 64) Next $colItems = $objWMIService.ExecQuery("SELECT SerialNumber, SMBIOSBIOSVersion, ReleaseDate FROM Win32_BIOS") For $objItem In $colItems $Serial = $objItem.SerialNumber $BIOSVer = $objItem.SMBIOSBIOSVersion $ManufactureDate = $objItem.ReleaseDate $RealDate = ObjCreate("WbemScripting.SWbemDateTime") $RealDate.value = $ManufactureDate $ManufactureDate = StringRegExpReplace($RealDate.GetVarDate, "(\d{4,4})(\d{2,2})(\d{2,2})(\d{2,2})(\d{2,2})(\d{2,2})", "$2\/$3\/$1 $4:$5") $RealDate = 0 Next $colItems = $objWMIService.ExecQuery("SELECT TotalPhysicalMemory, Manufacturer, Model, Domain, UserName FROM Win32_ComputerSystem") For $objItem In $colItems $RAM = Round($objItem.TotalPhysicalMemory / 1024 / 1024) $Manufacturer = $objItem.Manufacturer $Model = StringLeft(StringStripWS($objItem.Model, 2), 30) $Domain = StringLeft($objItem.Domain, StringInStr($objItem.Domain, ".") - 1) Next $colItems = $objWMIService.ExecQuery("SELECT Caption, Version, Organization, RegisteredUser, LastBootUpTime, CurrentTimeZone FROM Win32_OperatingSystem") For $objItem In $colItems $OS = $objItem.Caption $OSVersion = $objItem.Version $Organization = $objItem.Organization $RegisteredUser = $objItem.RegisteredUser $LastBootTime = $objItem.LastBootUpTime $RealDate = ObjCreate("WbemScripting.SWbemDateTime") $RealDate.value = $LastBootTime $LastBootTime = StringRegExpReplace($RealDate.GetVarDate, "(\d{4,4})(\d{2,2})(\d{2,2})(\d{2,2})(\d{2,2})(\d{2,2})", "$2\/$3\/$1 $4:$5") $RealDate = 0 Next $colItems = 0 ;Collect Local Administrator Members $localadmins = "" Dim $filter[1] = ["Groups"] $colGroups = ObjGet("WinNT://" & $hostname & "") $colGroups.Filter = $filter For $objGroup In $colGroups If $objGroup.Name = "Administrators" Then For $objUser In $objGroup.Members If $objUser.Name Then $localadmins &= $objUser.Name & "|" Next EndIf Next If StringRight($localadmins, 1) = "|" Then $localadmins = StringTrimRight($localadmins, 1) $localadmins = StringLeft($localadmins, 255) ;Create Data Array Dim $arrSysInfo[2][14] = [["OS", "OS Version", "Owner", "Organization", "Manufacturer", "Model", "Serial", "BIOS Version", "BIOS Date", "CPU", "RAM", "Domain", "Last Boot Time", "Local Admins"], _ [$OS, $OSVersion, $RegisteredUser, $Organization, $Manufacturer, $Model, $Serial, $BIOSVer, $ManufactureDate, $CPU, $RAM, $Domain, $LastBootTime, $localadmins]] ;Save Collected Info If $debug Then _WriteArrayToLog($arrSysInfo, $destDir, "SystemInfo.CSV") $arrSysInfo[1][13] = StringReplace($arrSysInfo[1][13], "|", "</br>") _WriteArrayToHTML(__ArrayTranspose($arrSysInfo), $destDir, "System Information") If $debug Then _DebugLog("System Information Collected") EndFunc ;==>_AddSystemInfo Func _AddSystemNetworkInfo($hostname) ;Collect System Network Information If $debug Then _DebugLog("Collecting System Network Information") ;Execute WMI Queries Dim $arrNetInfo[1][8] = [["Interface Name", "MAC", "IP", "Subnet", "Gateway", "DNS1", "DNS2", "WINS"]] Dim $netIdx = 1 $colItems = $objWMIService.ExecQuery("SELECT IPAddress, Description, MACAddress, IPSubnet, DefaultIPGateway, DNSServerSearchOrder, WINSPrimaryServer FROM Win32_NetworkAdapterConfiguration Where IPEnabled = True") For $objItem In $colItems If $objItem.IPAddress(0) <> "0.0.0.0" Then $NIC = StringLeft($objItem.Description, 90) $MAC = $objItem.MACAddress $IP = $objItem.IPAddress(0) $Subnet = $objItem.IPSubnet(0) $Gateway = $objItem.DefaultIPGateway(0) $DNS1 = $objItem.DNSServerSearchOrder(0) $DNS2 = $objItem.DNSServerSearchOrder(1) $WINS = $objItem.WINSPrimaryServer(0) ReDim $arrNetInfo[$netIdx + 1][8] $arrNetInfo[$netIdx][0] = $NIC $arrNetInfo[$netIdx][1] = $MAC $arrNetInfo[$netIdx][2] = $IP $arrNetInfo[$netIdx][3] = $Subnet $arrNetInfo[$netIdx][4] = $Gateway $arrNetInfo[$netIdx][5] = $DNS1 $arrNetInfo[$netIdx][6] = $DNS2 $arrNetInfo[$netIdx][7] = $WINS $netIdx += 1 EndIf Next $colItems = 0 _ArraySort($arrNetInfo, 0, 1, UBound($arrNetInfo) - 1) ;Save Collected Data If $debug Then _WriteArrayToLog($arrNetInfo, $destDir, "NetworkInfo.CSV") _WriteArrayToHTML(__ArrayTranspose($arrNetInfo), $destDir, "Network Information") If $debug Then _DebugLog("System Network Information Collected") EndFunc ;==>_AddSystemNetworkInfo Func _AddSystemInstalledSoft($hostname) ;Collect Installed Software Listing If $debug Then _DebugLog("Collecting Installed Software") ;Populate Software Collection Array Dim $arrSoft[1][3] = [["Software Title", "Version", "Install Date"]] Dim $appIdx = 1 If @OSArch <> "X64" Then $y = 1 Else $y = 2 EndIf For $x = 1 To $y $keyIdx = 0 ;Index of Uninstall SubKeys If $x = 1 Then $regRoot = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" ;Registry Tree for Uninstall Info Else $regRoot = "HKLM64\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" ;Registry Tree for Uninstall Info EndIf While 1 $keyIdx += 1 ;Increment Index each loop $keyName = RegEnumKey($regRoot, $keyIdx) ;Query Registry Key at Index $keyIdx If @error Then ExitLoop ;If not end of registry tree Local $appName = StringLeft(StringStripWS(RegRead($regRoot & "\" & $keyName, "DisplayName"), 7), 80) ;Get Application Name If $appName Then Local $versionNum = RegRead($regRoot & "\" & $keyName, "DisplayVersion") ;Get Version Number Local $installdate = RegRead($regRoot & "\" & $keyName, "InstallDate") ;Get Install Date If Not $versionNum Then $versionNum = "" ReDim $arrSoft[$appIdx + 1][3] $arrSoft[$appIdx][0] = $appName $arrSoft[$appIdx][1] = $versionNum $arrSoft[$appIdx][2] = $installdate $appIdx += 1 EndIf WEnd Next _ArraySort($arrSoft, 0, 1, UBound($arrSoft) - 1) If $debug Then _DebugLog("Adding System Software") ;Save Collected Info If $debug Then _WriteArrayToLog($arrSoft, $destDir, "Software.CSV") _WriteArrayToHTML($arrSoft, $destDir, "Installed Software") EndFunc ;==>_AddSystemInstalledSoft Func _AddSystemDevices($hostname) ;Collect Installed System Devices If $debug Then _DebugLog("Collecting System Devices") ;Populate Installed System Devices Array Dim $arrHW[1][3] = [["Device Name", "Class", "Manufacturer"]] $devIDX = 1 _DeviceAPI_Open() _DeviceAPI_GetAllDevices() ;Build list of ALL device classes While _DeviceAPI_EnumDevices() ReDim $arrHW[$devIDX + 1][3] $arrHW[$devIDX][0] = _DeviceAPI_GetDeviceRegistryProperty($SPDRP_DEVICEDESC) $arrHW[$devIDX][1] = _DeviceAPI_GetClassName(_DeviceAPI_GetDeviceRegistryProperty($SPDRP_CLASSGUID)) $arrHW[$devIDX][2] = _DeviceAPI_GetDeviceRegistryProperty($SPDRP_MFG) $devIDX += 1 WEnd _DeviceAPI_DestroyDeviceInfoList() ;Cleanup for good measure _DeviceAPI_Close() _ArraySort($arrHW, 0, 1, UBound($arrHW) - 1) If $debug Then _DebugLog("Adding System Devices") ;Save Collected Info If $debug Then _WriteArrayToLog($arrHW, $destDir, "Devices.CSV") _WriteArrayToHTML($arrHW, $destDir, "System Devices") EndFunc ;==>_AddSystemDevices Func __ArrayTranspose(ByRef $arr) If Not IsArray($arr) Then Return SetError(1, 0, 0) If Not UBound($arr, 0) = 2 Then Return SetError(2, 0, 0) Dim $arrTrans[UBound($arr, 2)][UBound($arr, 1)] For $x = 0 To UBound($arrTrans, 2) - 1 For $y = 0 To UBound($arrTrans) - 1 $arrTrans[$y][$x] = $arr[$x][$y] Next Next Return $arrTrans EndFunc ;==>__ArrayTranspose Func _DebugLog($str) FileWriteLine($destDir & "DomainScanLog.txt", @HOUR & ":" & @MIN & ":" & @SEC & " - " & $str) EndFunc ;==>_DebugLog Func _Exit() $exitTimer = 0 $objWMI = 0 FileClose($log) Exit EndFunc ;==>_Exit Func _ExitTimer() $time = 1200000 If $debug Then _DebugLog("Timer Check: " & TimerDiff($exitTimer) & @TAB & $time) If TimerDiff($exitTimer) > $time Then Exit EndFunc ;==>_ExitTimer Func _Today() Return @YEAR & @MON & @MDAY EndFunc ;==>_Today Func _WriteArrayToHTML($arr, $dest, $title) $xDim = UBound($arr, 1) - 1 $yDim = UBound($arr, 2) - 1 FileWriteLine($log, "<div class=""container""><h3><a href='#" & StringReplace($title," ","_") & "' data-toggle='collapse'>" & $title & "</a></h3>") FileWriteLine($log, "<div id='" & StringReplace($title," ","_") & "' class='collapse'><table border='0'>") $varRowColor = 0 For $x = 0 To $xDim If $varRowColor = 0 Then $varRowColor = 1 $varRowColorValue = "#9BCDFF" Else $varRowColor = 0 $varRowColorValue = "#C4E1FF" EndIf FileWrite($log, "<tr bgcolor='" & $varRowColorValue & "'>") For $y = 0 To $yDim FileWrite($log, "<td>" & $arr[$x][$y] & "</td>") Next FileWrite($log, "</tr>" & @CRLF) Next FileWriteLine($log, "</table></div></div></br>") EndFunc ;==>_WriteArrayToHTML Func _WriteArrayToLog($arr, $dest, $filename) $xDim = UBound($arr, 1) - 1 $yDim = UBound($arr, 2) - 1 For $x = 0 To $xDim For $y = 0 To $yDim FileWrite($destdir & "\" & @ComputerName & "_" & $filename, '"' & $arr[$x][$y] & '"') If $y < $yDim Then FileWrite($destdir & "\" & @ComputerName & "_" & $filename, ",") Else FileWrite($destdir & "\" & @ComputerName & "_" & $filename, @CRLF) EndIf Next Next EndFunc ;==>_WriteArrayToLog Func _WriteHTMLReportHeader($dest) $title = @ComputerName & " System Scan" FileWriteLine($log, '<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">') FileWriteLine($log, '<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>') FileWriteLine($log, '<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js"></script>') FileWriteLine($log, '<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>') FileWriteLine($log, "<title>" & $title & "</title>" & @CRLF & _ "<div class=""jumbotron jumbotron-fluid""><div class=""container""><center><h1>" & $title & "</h1></div></div>" & _ "<div class=""container"">Scan Initiated: " & @MON & "/" & @MDAY & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & "</br></br></br></div>") EndFunc ;==>_WriteHTMLReportHeader Func _WriteHTMLReportFooter($dest) FileWriteLine($log, "</div></br><div class=""container"">Scan Complete: " & @MON & "/" & @MDAY & "/" & @YEAR & " " & @HOUR & ":" & @MIN & ":" & @SEC & "</div>") FileClose($log) ShellExecute($dest & "\" & @ComputerName & ".htm") EndFunc ;==>_WriteHTMLReportFooter Func MyErrFunc() If $oMyError.number = -2147352567 Then Return 0 If $debug Then _DebugLog("Intercepted a COM Error !" & @CRLF & @CRLF & "err.description is: " & @TAB & $oMyError.description) Local $err = $oMyError.number If $err = 0 Then $err = -1 $g_eventerror = $err ; to check for after this function returns EndFunc ;==>MyErrFunc #EndRegion - User Defined Functions #Region - Functions Not Implemented ;Func _AddFileInfo($hostname,$file) ; If Not FileExists($file) Then Return 0 ; $attribs = FileGetAttrib($file) ; $size = FileGetSize($file) ; $version = FileGetVersion($file) ; $modtime = FileGetTime($file,0,1) ; $cretime = FileGetTime($file,1,1) ; $acctime = FileGetTime($file,2,1) ;EndFunc ;Func _FileInfoList($filelist) ; If Not FileExists($filelist) Then Return 0 ; Dim $arrList ; _FileReadToArray($filelist,$arrList) ; For $x = 1 to $arrList[0] ; ;_AddFileInfo(@ComputerName,$arrList[$x]) ; Next ;EndFunc #EndRegion - Functions Not Implemented The script produces a report that looks like this.
    1 point
  2. junkew

    AutoIT

    Start with the first pages in the help they will explain
    1 point
  3. there you go #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GIFAnimation.au3" #include <GuiButton.au3> Global $sFileBin = '0xF0B200474946383961150000200083000000FFFF00734A00DC9200FFD4408E96620050320080FF000062966E6E6E00003096A0A0A40088090021FF000B4E4554534341504045322E3003010124FE000928432946756D6942650018F904090E00282C03015801C64304AD10C8090082A5180763CEF89B0011480551144091AC0049300485228F9916001CF48DD7DAEBD3BC00CAEBC0319C4EA0DA00B170C0E980C1A744001A9C0AAE5768559800DC563A9C90C805CB0014C809C429CC53A50057B06653CBBB8DA800552A3E1390CDA67E00747C588275571F0200857C1F8C8A14176400155A268F1D162F4500164B8F43451C675D003D30276A05638227002D2F09A66C4A2C0800644C73416E2BB372008E137615B45EBCBD003B79BE7B357ABE75001617C18ACACA53CE14191182600A89600304AC0010C849ABBD2068CC0083F80167791F285200E43008E12905032C00BBAF6AB734ACE2E700366F14420165301C006EC55641389C048C009A58D1A029589B4E0063721A0D609DB1C300B458D0F1C00131F900BABBC8AE082B15680029C712F14292634D00C8127A7B17050985007E31050A8A6713840085086F07928C128E0008855E92937C8680009A9B7C579369079400151AA519A01D9A2100A4A64EA0AF3DB2AB0018B3AAA922B8B8AC00BABD6E1A40AFA601008A8B2FC70A94C2C2282FCD671260A91F60A28000C170B80D79848AF000A0890D0DA110A1500040118F4FA88C5AAD00050ED9A72ED09DC800C059EE6E14E322B800050D4F9288C7126F00AE015348F865750500477C7E7F77050A0A0073137D7E08800507004C84787F54929317008D859198999A7092001AA22EA351A4419800A79F185F99AE8B4A00A8B03DB3A81DB6AC0017B419B7BB722DB000B1198989C1C58ABF30C02FC0737F2F6A2F9B64114B2F096475812F859293008B128D8505939F9A009B70995F943D5F5100993DA019AA41AEA500A166B0AE1DB4A6B600A6B1ABBAB517724000B1A10189892DC4C5E09AC0C1CB157F2FFF5EFF5E3FBF17BF17BF177F2F7F2F6B2F3B' Global $sFileBin1 = Binary(_LzntDecompress($sFileBin)) $hGUI = GUICreate("GUI", 700, 300, Default, Default, $WS_POPUP, BitOr($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) $hPic = GUICtrlCreatePic(@ScriptDir & "\tech.gif",50,50,600,200,$WS_CLIPSIBLINGS) _GUICtrlSetGIF($hPic, @ScriptDir & "\tech.gif") GUISetState() GUISetControlsVisible($hGUI) $hGUI = GUICreate("GUI", 700, 300, Default, Default, $WS_POPUP, BitOr($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST), $hGUI) ;~ Global $hGIF = _GUICtrlCreateGIF(@ScriptDir & "\tech.gif", "",50,50,600,200) ;~ GUICtrlSetPos($hGIF, 0, 0) $cExit = GUICtrlCreateButton(" Exit ", 10, 10, 80, 30) Global $buttoncx = GUICtrlCreateButton ("caixa", 65,65 , 110, 170, $BS_BITMAP) GUICtrlSetImage ($buttoncx, @ScriptDir & "\Dados\Imagens\caixa.bmp") GUICtrlSetTip(-1, "Conectar em PDV.") ;GUICtrlSetOnEvent(-1, "caixa") ;botão 2 atm Global $buttonatm = GUICtrlCreateButton ("atm", 195, 65, 110, 170, $BS_BITMAP) GUICtrlSetImage ($buttonatm, @ScriptDir & "\Dados\Imagens\atm.bmp") GUICtrlSetTip(-1, "Conectar em ATM/CONECTA.") ;GUICtrlSetOnEvent(-1, "atm") ;botão 3 mobile Global $buttonmbl = GUICtrlCreateButton ("mobile", 325, 65, 110, 170, $BS_BITMAP) GUICtrlSetImage ($buttonmbl, @ScriptDir & "\Dados\Imagens\mobile.bmp") GUICtrlSetTip(-1, "Conectar em MOBILE SERVER.") ;GUICtrlSetOnEvent(-1, "mobile") ; Must be within GUI window ;$cLabel = GUICtrlCreateLabel("", 600, 200, 100, 100) GUISetControlsVisible($hGUI) ; _GUICtrlCreateGIF($sFileBin1, "", 5, 5, 35, 35) ; _GUICtrlCreateGIF($sFileBin1, "", 80, 80, 55, 55) ;_GUICtrlCreateGIF($sFileBin1, "", 90, 170, 155, 155) ;GUICtrlSetTip(-1, "ESC to exit") GUISetState() ;~ GUIRegisterMsg($WM_MOVE, "_WM_MOVE") While 1 ;~ _ImageHover() ;If GUICtrlRead($Final) <> $OldInput Then ;$OldInput = GUICtrlRead($Final) ;_DestUpdate() ;Endif Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $cExit Exit EndSwitch WEnd Func GUISetControlsVisible($hWnd) Local $aM_Mask, $aCtrlPos, $aMask $aM_Mask = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0) $aLastID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", GUICtrlGetHandle(-1)) For $i = 3 To $aLastID[0] $aCtrlPos = ControlGetPos($hWnd, '', $i) If Not IsArray($aCtrlPos) Then ContinueLoop $aMask = DllCall("gdi32.dll", "long", "CreateRectRgn", _ "long", $aCtrlPos[0], _ "long", $aCtrlPos[1], _ "long", $aCtrlPos[0] + $aCtrlPos[2], _ "long", $aCtrlPos[1] + $aCtrlPos[3]) DllCall("gdi32.dll", "long", "CombineRgn", "long", $aM_Mask[0], "long", $aMask[0], "long", $aM_Mask[0], "int", 2) Next DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $hWnd, "long", $aM_Mask[0], "int", 1) EndFunc Func _LzntDecompress($bBinary); by trancexx $bBinary = Binary($bBinary) Local $tInput = DllStructCreate('byte[' & BinaryLen($bBinary) & ']') DllStructSetData($tInput, 1, $bBinary) Local $tBuffer = DllStructCreate('byte[' & 16 * DllStructGetSize($tInput) & ']') Local $a_Call = DllCall('ntdll.dll', 'int', 'RtlDecompressBuffer', 'ushort', 2, 'ptr', DllStructGetPtr($tBuffer), 'dword', DllStructGetSize($tBuffer), 'ptr', DllStructGetPtr($tInput), 'dword', DllStructGetSize($tInput), 'dword*', 0) If @error Or $a_Call[0] Then Return SetError(1, 0, '') Local $tOutput = DllStructCreate('byte[' & $a_Call[6] & ']', DllStructGetPtr($tBuffer)) Return SetError(0, 0, DllStructGetData($tOutput, 1)) EndFunc ;==>_LzntDecompress Func _ImageHover() Global $aCursor = GUIGetCursorInfo($hGUI) _ImageChange($buttoncx, @ScriptDir & "\Dados\Imagens\caixa2.bmp", @ScriptDir & "\Dados\Imagens\caixa1.bmp", $aCursor) _ImageChange($buttonatm, @ScriptDir & "\Dados\Imagens\atm2.bmp", @ScriptDir & "\Dados\Imagens\atm1.bmp", $aCursor) _ImageChange($buttonmbl, @ScriptDir & "\Dados\Imagens\mobile2.bmp", @ScriptDir & "\Dados\Imagens\mobile1.bmp", $aCursor) ;_ImageChange($buttonconnect, @ScriptDir & "\Dados\Imagens\connect2.bmp", @ScriptDir & "\Dados\Imagens\connect.bmp", $aCursor) EndFunc Func _ImageChange($iCtrl, $iIMG_1, $i_IMG2, ByRef $aCursor) If $aCursor = 0 Then Else If ($aCursor[4] = $iCtrl) Then GUICtrlSetImage($iCtrl, $iIMG_1) ElseIf ($aCursor[4] <> $iCtrl) Then GUICtrlSetImage($iCtrl, $i_IMG2) EndIf EndIf EndFunc hope it does it
    1 point
  4. seadoggie01

    Acro.au3 UDF

    Updated to version 0.0.0.2. I found that the JavaScript Object can be accessed and used, meaning that bookmarks are edit-able and so much more. Added Functions: _Acro_DocDisplay _Acro_PageRotate _Acro_AppShow _Acro_DocJSObject _Acro_DocBookmarkAdd Fixed: _Acro_PageCount - Actually returns page count now
    1 point
  5. @nooneclose The posted example runs as-is without any external source.
    1 point
  6. Iam pretty sure you aren't willing to cough up €100 per hour to do the coding for you ...right?
    1 point
  7. Hi guys what i am trying to do is have My Gui LIve update Out of focus, so i can have this on a 2nd monitor streaming live updates while i continue to work on other screen, i have been googling and looking at other threads about focus and stuff , but they do not seem to match what I'm after, to be clear - i am not wanting to put focus on the GUI for it to auto update values, if you have any positive feed back on the script while you read - i would be more then happy to accept - as im still building my Knowledge of this coding, and stream line is always better Garbage code writing, Kind regards Gngnut #include <MemoryConstants.au3> #include <MsgBoxConstants.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> Global $currentTime,$currentTimeValue,$v,$Label_Time,$Form1 Global $Label_C2_1,$Label_C2_2,$Label_C2_3,$Label_C2_4,$Label_C2_5,$Label_C2_6,$Label_C2_7 Global $Label_C3_1,$Label_C3_2,$Label_C3_3,$Label_C3_4,$Label_C3_5,$Label_C3_6,$Label_C3_7 ;~ Default Hight for boxs $Hight = 40 $lenght = 180 ;; As per nines comments moved out side of the While loop, AdlibRegister(UpdateTime,250) AdlibRegister(updateValues,500) AdlibRegister(Warning,250) hotkeyset ("{ESC}",Terminate) ;; <<< Used to Quit the programe $aMemStats = MemGetStats() MyGui() ;; running the GUI #Region ### START Koda GUI section ### Form= func MyGui() $ServerName=@ComputerName ; ### Change to your location of image $Image = "C:\Users\gngnut\OneDrive\Pictures\Computer.jpg" ; Creating the form With the Labels $Form1 = GUICreate("My System Status", 800, 750, 225, 173,BitOR($WS_SYSMENU,$WS_MAXIMIZEBOX,$WS_MINIMIZEBOX));$WS_POPUP)) $Pic1 = GUICtrlCreatePic($Image, 0, 0, 800, 750) ;;; #### Column 1 $Label_C1_1 = GUICtrlCreateLabel("Total load currently on RAM:", 71, 192, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C1_2 = GUICtrlCreateLabel("Total physical RAM:", 71, 248, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C1_3 = GUICtrlCreateLabel("Available physical RAM:", 71, 304, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C1_4 = GUICtrlCreateLabel("Total Page Size:", 71, 360, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C1_5 = GUICtrlCreateLabel("Available Page Size:", 71, 416, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C1_6 = GUICtrlCreateLabel("Total virtual Size:", 71, 472, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C1_7 = GUICtrlCreateLabel("Available virtual RAM:", 71, 528, 180, $Hight, BitOR($SS_CENTER,"")) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") ;;; #### Column 2 $Label_C2_1 = GUICtrlCreateLabel($aMemStats[$MEM_LOAD] & " %", 311, 192, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) $colour=0xFEF200 GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C2_2 = GUICtrlCreateLabel($aMemStats[$MEM_TOTALPHYSRAM] & ' Kb' , 311, 248, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C2_3 = GUICtrlCreateLabel($aMemStats[$MEM_AVAILPHYSRAM] & ' Kb', 311, 304, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C2_4 = GUICtrlCreateLabel($aMemStats[$MEM_TOTALPAGEFILE] & ' Kb', 311, 360, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C2_5 = GUICtrlCreateLabel($aMemStats[$MEM_AVAILPAGEFILE] & ' Kb', 311, 416, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C2_6 = GUICtrlCreateLabel($aMemStats[$MEM_TOTALVIRTUAL] & ' Kb' , 311, 472, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C2_7 = GUICtrlCreateLabel($aMemStats[$MEM_AVAILVIRTUAL] & ' Kb', 311, 528, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") ;;; #### Column 3 $Label_C3_2 = GUICtrlCreateLabel(Round($aMemStats[$MEM_TOTALPHYSRAM]/1024/1024, 2) & ' Gb', 551, 248, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C3_3 = GUICtrlCreateLabel(Round($aMemStats[$MEM_AVAILPHYSRAM]/1024/1024, 2) & ' Gb', 551, 304, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C3_4 = GUICtrlCreateLabel(Round($aMemStats[$MEM_TOTALPAGEFILE]/1024/1024, 2) & ' Gb', 551, 360, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C3_5 = GUICtrlCreateLabel(Round($aMemStats[$MEM_AVAILPAGEFILE]/1024/1024, 2) & ' Gb', 551, 416, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C3_6 = GUICtrlCreateLabel(Round($aMemStats[$MEM_TOTALVIRTUAL]/1024/1024, 2) & ' Gb', 551, 472, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_C3_7 = GUICtrlCreateLabel(Round($aMemStats[$MEM_AVAILVIRTUAL]/1024/1024, 2) & ' Gb', 551, 528, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_Server = GUICtrlCreateLabel($ServerName, 551, 600, 180, $Hight, BitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") $Label_Time = GUICtrlCreateLabel($currentTime , 71, 600, 180, $Hight, bitOR($SS_CENTER,$WS_BORDER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xFEF200) GUICtrlSetFont(-1, 12, 400, 0, "Lucida Console") GUISetState(@SW_SHOWNORMAL) #EndRegion ### END Koda GUI section ### EndFunc While 1 Sleep(1000) ; sets a delay of 1 sec per 1000 WEnd ;; close down the Application func Terminate() exit EndFunc ;; Updating Time func UpdateTime() $currentTime = @HOUR&":"& @MIN &":"& @SEC ControlSetText($Form1,"",$Label_Time, $currentTime) EndFunc ;; currently changing the CPU % lable Func Warning() if $aMemStats[$MEM_LOAD] <=40 Then ; Green GUICtrlSetbkColor($Label_C2_1,0x2BFC0B) ElseIf $aMemStats[$MEM_LOAD] >40 and $aMemStats[$MEM_LOAD] <= 80 Then GUICtrlSetbkColor($Label_C2_1,0xFDBE01) Elseif $aMemStats[$MEM_LOAD] > 80 Then GUICtrlSetBkColor($Label_C2_1, 0xEE0C0C) EndIf EndFunc ;; Updating The Lable values of column 2 Only if the values change func updateValues() $aMemStats = MemGetStats() if GUICtrlRead($Label_C2_1) <> $aMemStats[$MEM_LOAD] Then ControlSetText($Form1,"",$Label_C2_1,$aMemStats[$MEM_LOAD]) endif If GUICtrlRead($Label_C2_2) <> $aMemStats[$MEM_TOTALPHYSRAM] & ' Kb' then ControlSetText($Form1,"",$Label_C2_2,$aMemStats[$MEM_TOTALPHYSRAM] & ' Kb') endif If GUICtrlRead($Label_C2_3) <> $aMemStats[$MEM_AVAILPHYSRAM] & ' Kb' then ControlSetText($Form1,"",$Label_C2_3,$aMemStats[$MEM_AVAILPHYSRAM] & ' Kb') endif If GUICtrlRead($Label_C2_4) <> $aMemStats[$MEM_TOTALPAGEFILE] & ' Kb' then ControlSetText($Form1,"",$Label_C2_4,$aMemStats[$MEM_TOTALPAGEFILE] & ' Kb') endif If GUICtrlRead($Label_C2_5) <> $aMemStats[$MEM_AVAILPAGEFILE] & ' Kb' then ControlSetText($Form1,"",$Label_C2_5,$aMemStats[$MEM_AVAILPAGEFILE] & ' Kb') endif If GUICtrlRead($Label_C2_6) <> $aMemStats[$MEM_TOTALVIRTUAL] & ' Kb' then ControlSetText($Form1,"",$Label_C2_6,$aMemStats[$MEM_TOTALVIRTUAL] & ' Kb') endif If GUICtrlRead($Label_C2_7) <> $aMemStats[$MEM_AVAILVIRTUAL] & ' Kb' then ControlSetText($Form1,"",$Label_C2_7,$aMemStats[$MEM_AVAILVIRTUAL] & ' Kb') endif EndFunc
    1 point
  8. In this case look here: https://www.autoitscript.com/wiki/FAQ#Why_doesn.27t_my_script_work_on_a_locked_workstation.3F
    1 point
  9. What does the script do exactly? Does it Interact with a program via send() ? Jos
    1 point
×
×
  • Create New...