├── img ├── SysMeter.png ├── Screenshot.PNG ├── Example_GDIP.png └── SysMeter_Simple_NVIDIA.png ├── README.md └── src ├── SysMeter_Simple.ahk ├── SysMeter_Simple_NVIDIA.ahk ├── v1.1 └── SysMeter.ahk └── SysMeter_GDIP.ahk /img/SysMeter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jNizM/SysMeter/HEAD/img/SysMeter.png -------------------------------------------------------------------------------- /img/Screenshot.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jNizM/SysMeter/HEAD/img/Screenshot.PNG -------------------------------------------------------------------------------- /img/Example_GDIP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jNizM/SysMeter/HEAD/img/Example_GDIP.png -------------------------------------------------------------------------------- /img/SysMeter_Simple_NVIDIA.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/jNizM/SysMeter/HEAD/img/SysMeter_Simple_NVIDIA.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SysMeter by jNizM 2 | Shows ComputerInfo via AutoHotkey 3 | 4 | 5 | ## Features 6 | * Shows Date, Time & Uptime (Toggle) 7 | * Shows CPU Usage 8 | * Shows GPU Load / Memory / Temperature ([NVIDIA_NVML](https://github.com/jNizM/NVIDIA_NVML)) 9 | * Shows RAM & SWAP Usage 10 | * Shows Drives Usage 11 | * Toggle MB/GB to Percentage 12 | * Toggle & Reset Transparency 13 | * Toggle AlwaysOnTop 14 | * Color Scheme 15 | * Save Ini-Settings 16 | * Reload Gui on Device Changes 17 | 18 | 19 | ## Screenshot 20 | ![SysMeter](img/SysMeter.png) 21 | ![SysMeter_Simple_NVIDIA](img/SysMeter_Simple_NVIDIA.png) 22 | 23 | 24 | ## Info 25 | * Version: AHK v2 26 | * URL: [AHK Thread](https://www.autohotkey.com/boards/viewtopic.php?f=83&t=94947) 27 | * Version: AHK v1.1 (OLD) 28 | * URL: [AHK Thread](https://www.autohotkey.com/boards/viewtopic.php?f=6&t=3521) 29 | 30 | 31 | ## Changelog 32 | * NEW 0.1 | First v2 Release 33 | * 0.6 | Added toggle date, time & uptime; Added reload on device change 34 | * 0.5 | Some fixes; AlwaysOnTop now in saved .ini 35 | * 0.4 | Change text; Added Color Scheme 36 | * 0.3 | Save & Load Ini-Settings 37 | * 0.2 | Scale transparency with Strg+MWHEEL(UP|DOWN) 38 | * 0.1 | First Release 39 | 40 | 41 | ## Contributing 42 | * thanks to SKAN for CPULoad() function 43 | * thanks to AutoHotkey Community -------------------------------------------------------------------------------- /src/SysMeter_Simple.ahk: -------------------------------------------------------------------------------- 1 | ; SCRIPT DIRECTIVES ============================================================================================================= 2 | 3 | #Requires AutoHotkey v2.0-beta.1 4 | 5 | 6 | ; GLOBALS ======================================================================================================================= 7 | 8 | app := Map("name", "SysMeter", "version", "0.1", "release", "2021-09-14", "author", "jNizM", "licence", "MIT") 9 | 10 | 11 | GuiBG := "303030" 12 | GuiFont := "CCCCCC" 13 | 14 | ProgressBG := "686868" 15 | ProgressFG := "BEFF08" 16 | 17 | /* 18 | [Settings] 19 | LocationX= 20 | LocationY= 21 | */ 22 | 23 | 24 | ; INITIAL ======================================================================================================================= 25 | 26 | DLC := DriveList() 27 | Location := LoadLocation() 28 | GuiX := Location["X"] 29 | GuiY := Location["Y"] 30 | 31 | 32 | ; GUI =========================================================================================================================== 33 | 34 | OnMessage 0x0201, WM_LBUTTONDOWN 35 | 36 | Main := Gui("-Caption") 37 | Main.MarginX := 10 38 | Main.MarginY := 10 39 | Main.SetFont("s10 c" GuiFont, "Segoe UI") 40 | Main.BackColor := GuiBG 41 | 42 | Main.AddText("xm ym w100 0x200", "CPU") 43 | TxtCPU := Main.AddText("x+0 yp w100 0x202", "1%") 44 | Main.AddProgress("xm y+1 w200 h6 vPgrCPU Background" ProgressBG " c" ProgressFG) 45 | Main.AddText("xm y+5 w100 0x200", "RAM") 46 | TxtRAM := Main.AddText("x+0 yp w100 0x202", "1%") 47 | Main.AddProgress("xm y+1 w200 h6 vPgrRAM Background" ProgressBG " c" ProgressFG) 48 | 49 | for i, v in DLC 50 | { 51 | Main.AddText("xm y+5 w100 0x200", DLC[i]["Letter"]) 52 | Main.AddText("x+0 yp w100 0x202 vTxtDR" i, "1%") 53 | Main.AddProgress("xm y+1 w200 h6 vPgrDR" i " Background" ProgressBG " c" ProgressFG) 54 | } 55 | 56 | Main.OnEvent("Close", Gui_Close) 57 | Main.OnEvent("Escape", Gui_Close) 58 | if (GuiX != "") && (GuiY != "") 59 | Main.Show(" x" GuiX " y" GuiY) 60 | else 61 | Main.Show() 62 | SetTimer Refresh, 500 63 | 64 | 65 | ; WINDOW EVENTS ================================================================================================================= 66 | 67 | Gui_Close(*) 68 | { 69 | Main.GetPos(&NewX, &NewY) 70 | SaveLocation(NewX, NewY, GuiX, GuiY) 71 | ExitApp 72 | } 73 | 74 | 75 | WM_LBUTTONDOWN(wParam, lParam, msg, hwnd) 76 | { 77 | static WM_NCLBUTTONDOWN := 0x00A1 78 | static HTCAPTION := 2 79 | 80 | if (hWnd = Main.Hwnd) 81 | PostMessage WM_NCLBUTTONDOWN, HTCAPTION,,, "A" 82 | } 83 | 84 | 85 | Refresh() 86 | { 87 | CPU := CPULoad() 88 | RAM := GlobalMemoryStatusEx() 89 | DL := DriveList() 90 | if (DLC.Count != DL.Count) 91 | Reload 92 | 93 | TxtCPU.Text := CPU "%" 94 | Main["PgrCPU"].Value := CPU 95 | TxtRAM.Text := RAM "%" 96 | Main["PgrRAM"].Value := RAM 97 | 98 | for i, v in DL 99 | { 100 | Main["TxtDR" i].Text := DL[i]["Perc"] "%" 101 | Main["PgrDR" i].Value := DL[i]["Perc"] 102 | } 103 | } 104 | 105 | 106 | ; FUNCTIONS ===================================================================================================================== 107 | 108 | CPULoad() ; thx to SKAN 109 | { 110 | static PIT := 0, PKT := 0, PUT := 0 111 | 112 | DllCall("kernel32\GetSystemTimes", "int64*", &CIT := 0, "int64*", &CKT := 0, "int64*", &CUT := 0) 113 | IdleTime := PIT - CIT, KernelTime := PKT - CKT, UserTime := PUT - CUT 114 | SystemTime := KernelTime + UserTime 115 | 116 | PIT := CIT, PKT := CKT, PUT := CUT 117 | return ((SystemTime - IdleTime) * 100) // SystemTime 118 | } 119 | 120 | 121 | DriveList() 122 | { 123 | DRIVES := Map() 124 | for v in StrSplit(DriveGetList()) 125 | { 126 | DriveLetter := v ":" 127 | DriveType := DriveGetType(DriveLetter) 128 | if (DriveType != "Fixed") && (DriveType != "Removable") 129 | continue 130 | try { 131 | DRIVE := Map() 132 | DRIVE["Letter"] := DriveLetter 133 | DriveCapacity := DriveGetCapacity(DriveLetter) 134 | DriveFreeSpace := DriveGetSpaceFree(DriveLetter) 135 | DRIVE["Cap"] := Round(DriveCapacity / 1024, 2) " GB" 136 | DRIVE["Free"] := Round(DriveFreeSpace / 1024, 2) " GB" 137 | DRIVE["Used"] := Round((DriveCapacity - DriveFreeSpace) / 1024, 2) " GB" 138 | DRIVE["Perc"] := Round((1 - DriveFreeSpace / DriveCapacity) * 100, 0) 139 | } catch { 140 | continue ; skip full encrypted drives (bitlocker / veracrypt / ...) 141 | } 142 | DRIVES[A_Index] := DRIVE 143 | } 144 | return DRIVES 145 | } 146 | 147 | 148 | GlobalMemoryStatusEx() 149 | { 150 | MEMORYSTATUSEX := Buffer(64, 0) 151 | NumPut("uint", 64, MEMORYSTATUSEX) 152 | if (DllCall("kernel32\GlobalMemoryStatusEx", "ptr", MEMORYSTATUSEX)) 153 | return NumGet(MEMORYSTATUSEX, 4, "uint") 154 | ;return Round(100 - NumGet(MEMORYSTATUSEX, 16, "uint64") / NumGet(MEMORYSTATUSEX, 8, "uint64") * 100, 2) 155 | return false 156 | } 157 | 158 | 159 | SaveLocation(NewX, NewY, OldX, OldY) 160 | { 161 | if (A_IsCompiled) 162 | return 163 | 164 | if (NewX != OldX) 165 | IniWrite NewX, A_ScriptFullPath, "Settings", "LocationX" 166 | if (NewY != OldY) 167 | IniWrite NewY, A_ScriptFullPath, "Settings", "LocationY" 168 | } 169 | 170 | 171 | LoadLocation() 172 | { 173 | if (A_IsCompiled) 174 | return MapX("X", "", "Y", "") 175 | 176 | X := IniRead(A_ScriptFullPath, "Settings", "LocationX", "") 177 | Y := IniRead(A_ScriptFullPath, "Settings", "LocationY", "") 178 | return MapX("X", X, "Y", Y) 179 | } 180 | 181 | 182 | class MapX extends Map { 183 | CaseSense := "Off" 184 | Default := "" 185 | } 186 | 187 | ; =============================================================================================================================== 188 | -------------------------------------------------------------------------------- /src/SysMeter_Simple_NVIDIA.ahk: -------------------------------------------------------------------------------- 1 | ; SCRIPT DIRECTIVES ============================================================================================================= 2 | 3 | #Requires AutoHotkey v2.0- 4 | 5 | 6 | ; GLOBALS ======================================================================================================================= 7 | 8 | app := Map("name", "SysMeter", "version", "0.1", "release", "2021-10-04", "author", "jNizM", "licence", "MIT") 9 | 10 | 11 | GuiBG := "303030" 12 | GuiFont := "CCCCCC" 13 | 14 | ProgressBG := "686868" 15 | ProgressFG := "BEFF08" 16 | 17 | /* 18 | [Settings] 19 | LocationX= 20 | LocationY= 21 | */ 22 | 23 | 24 | ; INITIAL ======================================================================================================================= 25 | 26 | DLC := DriveList() 27 | Location := LoadLocation() 28 | GuiX := Location["X"] 29 | GuiY := Location["Y"] 30 | 31 | 32 | ; GUI =========================================================================================================================== 33 | 34 | OnMessage 0x0201, WM_LBUTTONDOWN 35 | 36 | Main := Gui("-Caption") 37 | Main.MarginX := 10 38 | Main.MarginY := 10 39 | Main.SetFont("s10 c" GuiFont, "Segoe UI") 40 | Main.BackColor := GuiBG 41 | 42 | Main.AddText("xm ym w120 0x200", "CPU") 43 | TxtCPU := Main.AddText("x+0 yp w80 0x202", "1%") 44 | Main.AddProgress("xm y+1 w200 h6 vPgrCPU Background" ProgressBG " c" ProgressFG) 45 | 46 | Main.AddText("xm y+5 w120 0x200", "RAM") 47 | TxtRAM := Main.AddText("x+0 yp w80 0x202", "1%") 48 | Main.AddProgress("xm y+1 w200 h6 vPgrRAM Background" ProgressBG " c" ProgressFG) 49 | 50 | Main.AddText("xm y+5 w120 0x200", "GPU Load") 51 | TxtGPUL := Main.AddText("x+0 yp w80 0x202", "1%") 52 | Main.AddProgress("xm y+1 w200 h6 vPgrGPUL Background" ProgressBG " c" ProgressFG) 53 | 54 | Main.AddText("xm y+5 w120 0x200", "GPU Memory") 55 | TxtGPUM := Main.AddText("x+0 yp w80 0x202", "1%") 56 | Main.AddProgress("xm y+1 w200 h6 vPgrGPUM Background" ProgressBG " c" ProgressFG) 57 | 58 | Main.AddText("xm y+5 w120 0x200", "GPU Temperature") 59 | TxtGPUT := Main.AddText("x+0 yp w80 0x202", "1%") 60 | Main.AddProgress("xm y+1 w200 h6 vPgrGPUT Background" ProgressBG " c" ProgressFG) 61 | 62 | for i, v in DLC 63 | { 64 | Main.AddText("xm y+5 w120 0x200", DLC[i]["Letter"]) 65 | Main.AddText("x+0 yp w80 0x202 vTxtDR" i, "1%") 66 | Main.AddProgress("xm y+1 w200 h6 vPgrDR" i " Background" ProgressBG " c" ProgressFG) 67 | } 68 | 69 | Main.OnEvent("Close", Gui_Close) 70 | Main.OnEvent("Escape", Gui_Close) 71 | if (GuiX != "") && (GuiY != "") 72 | Main.Show(" x" GuiX " y" GuiY) 73 | else 74 | Main.Show() 75 | SetTimer Refresh, 500 76 | 77 | 78 | ; WINDOW EVENTS ================================================================================================================= 79 | 80 | Gui_Close(*) 81 | { 82 | Main.GetPos(&NewX, &NewY) 83 | SaveLocation(NewX, NewY, GuiX, GuiY) 84 | ExitApp 85 | } 86 | 87 | 88 | WM_LBUTTONDOWN(wParam, lParam, msg, hwnd) 89 | { 90 | static WM_NCLBUTTONDOWN := 0x00A1 91 | static HTCAPTION := 2 92 | 93 | if (hWnd = Main.Hwnd) 94 | PostMessage WM_NCLBUTTONDOWN, HTCAPTION,,, "A" 95 | } 96 | 97 | 98 | Refresh() 99 | { 100 | CPU := CPULoad() 101 | RAM := GlobalMemoryStatusEx() 102 | GPUL := DEVICE.GetUtilizationRates()["GPU"] 103 | GPUM := DEVICE.GetUtilizationRates()["MEMORY"] 104 | GPUT := DEVICE.GetTemperature() 105 | DL := DriveList() 106 | if (DLC.Count != DL.Count) 107 | Reload 108 | 109 | TxtCPU.Text := CPU "%" 110 | Main["PgrCPU"].Value := CPU 111 | TxtRAM.Text := RAM "%" 112 | Main["PgrRAM"].Value := RAM 113 | TxtGPUL.Text := GPUL "%" 114 | Main["PgrGPUL"].Value := GPUL 115 | TxtGPUM.Text := GPUM "%" 116 | Main["PgrGPUM"].Value := GPUM 117 | TxtGPUT.Text := GPUT "°C" 118 | Main["PgrGPUT"].Value := GPUT 119 | 120 | for i, v in DL 121 | { 122 | Main["TxtDR" i].Text := DL[i]["Perc"] "%" 123 | Main["PgrDR" i].Value := DL[i]["Perc"] 124 | } 125 | } 126 | 127 | 128 | ; FUNCTIONS ===================================================================================================================== 129 | 130 | CPULoad() ; thx to SKAN 131 | { 132 | static PIT := 0, PKT := 0, PUT := 0 133 | 134 | DllCall("kernel32\GetSystemTimes", "int64*", &CIT := 0, "int64*", &CKT := 0, "int64*", &CUT := 0) 135 | IdleTime := PIT - CIT, KernelTime := PKT - CKT, UserTime := PUT - CUT 136 | SystemTime := KernelTime + UserTime 137 | 138 | PIT := CIT, PKT := CKT, PUT := CUT 139 | return ((SystemTime - IdleTime) * 100) // SystemTime 140 | } 141 | 142 | 143 | DriveList() 144 | { 145 | DRIVES := Map() 146 | for v in StrSplit(DriveGetList()) 147 | { 148 | DriveLetter := v ":" 149 | DriveType := DriveGetType(DriveLetter) 150 | if (DriveType != "Fixed") && (DriveType != "Removable") 151 | continue 152 | try { 153 | DRIVE := Map() 154 | DRIVE["Letter"] := DriveLetter 155 | DriveCapacity := DriveGetCapacity(DriveLetter) 156 | DriveFreeSpace := DriveGetSpaceFree(DriveLetter) 157 | DRIVE["Cap"] := Round(DriveCapacity / 1024, 2) " GB" 158 | DRIVE["Free"] := Round(DriveFreeSpace / 1024, 2) " GB" 159 | DRIVE["Used"] := Round((DriveCapacity - DriveFreeSpace) / 1024, 2) " GB" 160 | DRIVE["Perc"] := Round((1 - DriveFreeSpace / DriveCapacity) * 100, 0) 161 | } catch { 162 | continue ; skip full encrypted drives (bitlocker / veracrypt / ...) 163 | } 164 | DRIVES[A_Index] := DRIVE 165 | } 166 | return DRIVES 167 | } 168 | 169 | 170 | GlobalMemoryStatusEx() 171 | { 172 | MEMORYSTATUSEX := Buffer(64, 0) 173 | NumPut("uint", 64, MEMORYSTATUSEX) 174 | if (DllCall("kernel32\GlobalMemoryStatusEx", "ptr", MEMORYSTATUSEX)) 175 | return NumGet(MEMORYSTATUSEX, 4, "uint") 176 | return false 177 | } 178 | 179 | 180 | SaveLocation(NewX, NewY, OldX, OldY) 181 | { 182 | if (A_IsCompiled) 183 | return 184 | 185 | if (NewX != OldX) 186 | IniWrite NewX, A_ScriptFullPath, "Settings", "LocationX" 187 | if (NewY != OldY) 188 | IniWrite NewY, A_ScriptFullPath, "Settings", "LocationY" 189 | } 190 | 191 | 192 | LoadLocation() 193 | { 194 | if (A_IsCompiled) 195 | return MapX("X", "", "Y", "") 196 | 197 | X := IniRead(A_ScriptFullPath, "Settings", "LocationX", "") 198 | Y := IniRead(A_ScriptFullPath, "Settings", "LocationY", "") 199 | return MapX("X", X, "Y", Y) 200 | } 201 | 202 | 203 | class MapX extends Map { 204 | CaseSense := "Off" 205 | Default := "" 206 | } 207 | 208 | 209 | ; INCLUDES ================================================================================================================================================================== 210 | 211 | #Include Class_NVML.ahk ; https://github.com/jNizM/NVIDIA_NVML 212 | 213 | 214 | ; =========================================================================================================================================================================== 215 | -------------------------------------------------------------------------------- /src/v1.1/SysMeter.ahk: -------------------------------------------------------------------------------- 1 | ; =================================================================================== 2 | ; AHK Version ...: AHK_L 1.1.15.00 x64 Unicode 3 | ; Win Version ...: Windows 7 Professional x64 SP1 4 | ; Description ...: Shows Info about Total, Free, Used Memory in MB; 5 | ; Total Memory in Percentage & Clear unused Memory Function 6 | ; Version .......: v0.6 7 | ; Modified ......: 2014.05.14-1948 8 | ; Author ........: jNizM 9 | ; =================================================================================== 10 | ;@Ahk2Exe-SetName SysMeter 11 | ;@Ahk2Exe-SetDescription SysMeter 12 | ;@Ahk2Exe-SetVersion v0.6 13 | ;@Ahk2Exe-SetCopyright Copyright (c) 2013-2014`, jNizM 14 | ;@Ahk2Exe-SetOrigFilename SysMeter.ahk 15 | ; =================================================================================== 16 | 17 | ; GLOBAL SETTINGS =================================================================== 18 | 19 | ;#Warn 20 | #NoEnv 21 | #SingleInstance Force 22 | SetBatchLines -1 23 | 24 | global name := "sysmeter" ; gui name 25 | global version := "v0.6" ; version number 26 | global inifile := "sysmeter.ini" ; filename of .ini 27 | global showDate := 0 ; toggle show date, time & uptime (0 = Off | 1 = On) 28 | global showPerc := 1 ; toggle between % and GB (0 = GB | 1 = % ) 29 | global aot := 0 ; toggle alwaysontop (0 = Off | 1 = On) 30 | global cgbg := "464646" ; gui background color 31 | global cpcpu := "13a7c7" ; progressbar color cpu 32 | global cpmem := "13a7c7" ; progressbar color ram & swp 33 | global cphdd := "13a7c7" ; progressbar color hdd 34 | global cpbg := "686868" ; progressbar background color 35 | 36 | ; LOAD INI SETTINGS ================================================================= 37 | 38 | if FileExist(inifile) 39 | { 40 | IniRead, winx, % inifile, settings, winPosX 41 | IniRead, winy, % inifile, settings, winPosY 42 | IniRead, showDate, % inifile, settings, showDate 43 | IniRead, showPerc, % inifile, settings, showPerc 44 | IniRead, aot, % inifile, settings, alwaysOnTop 45 | IniRead, tran, % inifile, settings, transparency 46 | IniRead, cgbg, % inifile, colors, color_guibg 47 | IniRead, cpcpu, % inifile, colors, color_pgbar_cpu 48 | IniRead, cpmem, % inifile, colors, color_pgbar_mem 49 | IniRead, cphdd, % inifile, colors, color_pgbar_hdd 50 | IniRead, cpbg, % inifile, colors, color_pgbg 51 | } 52 | 53 | ; MENU ============================================================================== 54 | 55 | Menu, Tray, DeleteAll 56 | Menu, Tray, NoStandard 57 | Menu, Tray, Add, Save Settings, Menu_SaveSettings 58 | Menu, Tray, Add, 59 | Menu, Menu_color, Add, Blue, Menu_Color_Blue 60 | Menu, Menu_color, Add, Lime, Menu_Color_Lime 61 | Menu, Menu_color, Add, Red, Menu_Color_Red 62 | Menu, Menu_color, Add, Purple, Menu_Color_Purple 63 | Menu, Menu_color, Add, Mix, Menu_Color_Mix 64 | Menu, Tray, Add, Color Scheme, :Menu_Color 65 | Menu, Tray, Add, 66 | Menu, Tray, Add, Toggle Time / Uptime, Menu_Time 67 | Menu, Tray, % ((showDate = "1") ? "Check" : "Uncheck"), Toggle Time / Uptime 68 | Menu, Tray, Add, Toggle Percentage, Menu_Percentage 69 | Menu, Tray, % ((showPerc = "1") ? "Check" : "Uncheck"), Toggle Percentage 70 | Menu, Tray, Add, 71 | Menu, Tray, Add, Reset Transparency, Menu_Transparency 72 | Menu, Tray, Add, Toggle AlwaysOnTop, Menu_AlwaysOnTop 73 | Menu, Tray, % ((aot = "1") ? "Check" : "Uncheck"), Toggle AlwaysOnTop 74 | Menu, Tray, Add, Show/Hide, Menu_ShowHide 75 | Menu, Tray, Add, 76 | Menu, Tray, Add, Exit, Close 77 | Menu, Tray, Default, Show/Hide 78 | 79 | ; GUI MAIN ========================================================================== 80 | 81 | Create_Gui: 82 | Gui +LastFound -Caption +ToolWindow +hwndhMain 83 | Gui, Margin, 10, 10 84 | Gui, Color, % cgbg 85 | Gui, Font, s10 cFFFFFF bold, Agency FB 86 | if (showDate = 1) 87 | { 88 | Gui, Add, Text, xm ym w120 0x200 vTTIM, 89 | Gui, Add, Text, x+5 yp w75 0x202 vTUPT, 90 | Gui, Add, Text, xm y+7 w50 0x200, % "CPU" 91 | } 92 | else 93 | { 94 | Gui, Add, Text, xm ym w50 0x200, % "CPU" 95 | } 96 | Gui, Add, Text, x+5 yp w145 0x202 vTCPU, 97 | Gui, Add, Progress, xm y+2 w200 h6 c%cpcpu% Background%cpbg% vPCPU, 98 | Gui, Add, Text, xm y+7 w50 0x200, % "RAM" 99 | Gui, Add, Text, x+5 yp w145 0x202 vTRAM, 100 | Gui, Add, Progress, xm y+2 w200 h6 c%cpmem% Background%cpbg% vPRAM, 101 | Gui, Add, Text, xm y+7 w50 0x200, % "SWAP" 102 | Gui, Add, Text, x+5 yp w145 0x202 vTSWP, 103 | Gui, Add, Progress, xm y+2 w200 h6 c%cpmem% Background%cpbg% vPSWP, 104 | DriveGet, DrvLstFxd, List, FIXED 105 | loop, Parse, DrvLstFxd 106 | { 107 | Gui, Add, Text, xm y+7 w50 0x200, %A_Loopfield%:\ 108 | Gui, Add, Text, x+5 yp w145 0x202 vP%A_Loopfield%RV, 109 | Gui, Add, Progress, xm y+2 w200 h6 c%cphdd% Background%cpbg% vT%A_Loopfield%RV, 110 | } 111 | Gui, Show, % ((winX != "") ? winX : "") ((winY != "") ? winY : "") AutoSize, % name 112 | WinSet, Transparent, % ((tran != "") ? tran : 200), % name 113 | WinSet, AlwaysOnTop, % ((aot = "1") ? "On" : "Off"), % name 114 | OnMessage(0x201, "WM_LBUTTONDOWN") 115 | OnMessage(0x219, "WM_DEVICECHANGE") 116 | SetTimer, Update, 1000 117 | return 118 | 119 | ; SCRIPT ============================================================================ 120 | 121 | Update: 122 | if (showDate = 1) 123 | { 124 | GuiControl,, TTIM, % A_DD ". " A_MMMM " " A_YYYY " " A_Hour ":" A_Min ":" A_Sec 125 | GuiControl,, TUPT, % "UP: " GetDurationFormat(DllCall("Kernel32.dll\GetTickCount64", "UInt64") / 1000) 126 | } 127 | 128 | CPU := CPULoad() 129 | GuiControl,, TCPU, % CPU " %" 130 | GuiControl,, PCPU, % CPU 131 | 132 | GMSEx := GlobalMemoryStatusEx() 133 | GMSExM01 := GMSEx[1] ; MemoryLoad in % 134 | GMSExM02 := Round(GMSEx[2] / 1024**3, 2) ; Total Physical Memory in MB 135 | GMSExM03 := Round(GMSEx[3] / 1024**3, 2) ; Available Physical Memory in MB 136 | GMSExM04 := Round(GMSExM02 - GMSExM03, 2) ; Used Physical Memory in MB 137 | GMSExM05 := Round(GMSExM04 / GMSExM02 * 100, 2) ; Used Physical Memory in % 138 | GMSExS01 := Round(GMSEx[4] / 1024**3, 2) ; Total PageFile in MB 139 | GMSExS02 := Round(GMSEx[5] / 1024**3, 2) ; Available PageFile in MB 140 | GMSExS03 := Round(GMSExS01 - GMSExS02, 2) ; Used PageFile in MB 141 | GMSExS04 := Round(GMSExS03 / GMSExS01 * 100, 2) ; Used PageFile in % 142 | GuiControl,, TRAM, % ((showPerc = "1") ? GMSExM05 " %" : GMSExM04 "/" GMSExM02 " GB") 143 | GuiControl,, PRAM, % GMSExM05 144 | GuiControl,, TSWP, % ((showPerc = "1") ? GMSExS04 " %" : GMSExS03 "/" GMSExS01 " GB") 145 | GuiControl,, PSWP, % GMSExS04 146 | 147 | loop, Parse, DrvLstFxd 148 | { 149 | i := A_LoopField 150 | DriveGet, cap%i%, Capacity, %i%:\ 151 | DriveSpaceFree, free%i%, %i%:\ 152 | used%i% := cap%i% - free%i% 153 | perc%i% := used%i% / cap%i% * 100 154 | GuiControl,, P%i%RV, % ((showPerc = "1") ? round(perc%i%, 2) " %" : round((used%i% / 1024), 2) "/" round((cap%i% / 1024), 2) " GB") 155 | GuiControl,, T%i%RV, % perc%i% 156 | } 157 | return 158 | 159 | Menu_SaveSettings: 160 | IniSettings(showDate, showPerc, cgbg, cpcpu, cpmem, cphdd, cpbg) 161 | return 162 | 163 | Menu_Color_Blue: 164 | cgbg := "464646" 165 | cpcpu := "13a7c7" 166 | cpmem := "13a7c7" 167 | cphdd := "13a7c7" 168 | cpbg := "686868" 169 | Gui, Destroy 170 | gosub Create_Gui 171 | return 172 | 173 | Menu_Color_Lime: 174 | cgbg := "464646" 175 | cpcpu := "b7fe36" 176 | cpmem := "b7fe36" 177 | cphdd := "b7fe36" 178 | cpbg := "686868" 179 | Gui, Destroy 180 | gosub Create_Gui 181 | return 182 | 183 | Menu_Color_Red: 184 | cgbg := "464646" 185 | cpcpu := "ff4444" 186 | cpmem := "ff4444" 187 | cphdd := "ff4444" 188 | cpbg := "686868" 189 | Gui, Destroy 190 | gosub Create_Gui 191 | return 192 | 193 | Menu_Color_Purple: 194 | cgbg := "464646" 195 | cpcpu := "aa66cc" 196 | cpmem := "aa66cc" 197 | cphdd := "aa66cc" 198 | cpbg := "686868" 199 | Gui, Destroy 200 | gosub Create_Gui 201 | return 202 | 203 | Menu_Color_Mix: 204 | cgbg := "464646" 205 | cpcpu := "32cd32" 206 | cpmem := "ff8c00" 207 | cphdd := "1e90ff" 208 | cpbg := "686868" 209 | Gui, Destroy 210 | gosub Create_Gui 211 | return 212 | 213 | Menu_Time: 214 | showdate := (showdate = "0") ? "1" : "0" 215 | Menu, Tray, ToggleCheck, Toggle Time / Uptime 216 | Gui, Destroy 217 | gosub Create_Gui 218 | return 219 | 220 | Menu_Percentage: 221 | showPerc := (showPerc = "0") ? "1" : "0" 222 | Menu, Tray, ToggleCheck, Toggle Percentage 223 | return 224 | 225 | Menu_Transparency: 226 | WinSet, Transparent, 200, % name 227 | return 228 | 229 | Menu_AlwaysOnTop: 230 | ToggleAlwaysOnTop() 231 | return 232 | 233 | Menu_ShowHide: 234 | ToggleShowHide() 235 | return 236 | 237 | ^WheelUp::GUITrans(1) 238 | ^WheelDown::GUITrans(0) 239 | 240 | ; FUNCTIONS ========================================================================= 241 | 242 | WM_LBUTTONDOWN(wParam, lParam, msg, hwnd) ; WM_LBUTTONDOWN() by an AHK-Member 243 | { 244 | global hMain 245 | if (hwnd = hMain) 246 | { 247 | PostMessage, 0xA1, 2,,, % name 248 | } 249 | } 250 | 251 | WM_DEVICECHANGE(wParam, lParam, msg, hwnd) 252 | { 253 | global hMain 254 | if (wParam = 0x8000 || wParam = 0x8004) 255 | { 256 | Thread, NoTimers 257 | Gui, Destroy 258 | gosub Create_Gui 259 | } 260 | } 261 | 262 | GUITrans(b := 1) ; GUITrans() by jNizM 263 | { 264 | WinGet, ct, Transparent, % name 265 | WinSet, Transparent, % ((b = 1) ? ct + 1 : ct - 1), % name 266 | } 267 | 268 | ToggleAlwaysOnTop() ; ToggleAlwaysOnTop() by jNizM 269 | { 270 | WinGet, WS_EX_TOPMOST, ExStyle, % name 271 | if (WS_EX_TOPMOST & 0x8) 272 | { 273 | WinSet, AlwaysOnTop, Off, % name 274 | Menu, Tray, Uncheck, Toggle AlwaysOnTop 275 | aot := 0 276 | } 277 | else 278 | { 279 | WinSet, AlwaysOnTop, On, % name 280 | Menu, Tray, Check, Toggle AlwaysOnTop 281 | aot := 1 282 | } 283 | } 284 | 285 | ToggleShowHide() 286 | { 287 | WinGet, WS_VISIBLE, Style, % name 288 | if (WS_VISIBLE & 0x10000000) 289 | { 290 | WinHide, % name 291 | } 292 | else 293 | { 294 | WinShow, % name 295 | WinSet, AlwaysOnTop, Toggle, % name 296 | WinSet, AlwaysOnTop, Toggle, % name 297 | } 298 | } 299 | 300 | IniSettings(showDate, showPerc, cgbg, cpcpu, cpmem, cphdd, cpbg) ; IniSettings() by jNizM 301 | { 302 | WinGetPos, winX, winY,,, % name 303 | IniWrite, % "X" winX, % inifile, settings, winPosX 304 | IniWrite, % "Y" winY, % inifile, settings, winPosY 305 | IniWrite, % showDate, % inifile, settings, showDate 306 | IniWrite, % showPerc, % inifile, settings, showPerc 307 | WinGet, ct, Transparent, % name 308 | IniWrite, % ct, % inifile, settings, transparency 309 | IniWrite, % aot, % inifile, settings, alwaysontop 310 | 311 | IniWrite, % cgbg, % inifile, colors, color_guibg 312 | IniWrite, % cpcpu, % inifile, colors, color_pgbar_cpu 313 | IniWrite, % cpmem, % inifile, colors, color_pgbar_mem 314 | IniWrite, % cphdd, % inifile, colors, color_pgbar_hdd 315 | IniWrite, % cpbg, % inifile, colors, color_pgbg 316 | } 317 | 318 | GetDurationFormat(ullDuration, lpFormat := "d'd 'hh:mm:ss") ; GetDurationFormat() by jNizM 319 | { 320 | if (ullDuration < 86400) 321 | { 322 | lpFormat := SubStr(lpFormat, - 7) 323 | } 324 | VarSetCapacity(lpDurationStr, 128, 0) 325 | DllCall("GetDurationFormat", "UInt", 0x400 326 | , "UInt", 0 327 | , "Ptr", 0 328 | , "Int64", ullDuration * 10000000 329 | , "WStr", lpFormat 330 | , "WStr", lpDurationStr 331 | , "Int", 2048) 332 | return lpDurationStr 333 | } 334 | 335 | CPULoad() ; CPULoad() by SKAN 336 | { 337 | static PIT, PKT, PUT 338 | if (Pit = "") 339 | { 340 | return 0, DllCall("GetSystemTimes", "Int64P", PIT, "Int64P", PKT, "Int64P", PUT) 341 | } 342 | DllCall("GetSystemTimes", "Int64P", CIT, "Int64P", CKT, "Int64P", CUT) 343 | IdleTime := PIT - CIT, KernelTime := PKT - CKT, UserTime := PUT - CUT 344 | SystemTime := KernelTime + UserTime 345 | return ((SystemTime - IdleTime) * 100) // SystemTime, PIT := CIT, PKT := CKT, PUT := CUT 346 | } 347 | 348 | GlobalMemoryStatusEx() ; GlobalMemoryStatusEx() by jNizM 349 | { 350 | static MSEX, init := VarSetCapacity(MSEX, 64, 0) && NumPut(64, MSEX, "UInt") 351 | if (DllCall("GlobalMemoryStatusEx", "Ptr", &MSEX)) 352 | { 353 | return { 1 : NumGet(MSEX, 4, "UInt") 354 | , 2 : NumGet(MSEX, 8, "UInt64"), 3 : NumGet(MSEX, 16, "UInt64") 355 | , 4 : NumGet(MSEX, 24, "UInt64"), 5 : NumGet(MSEX, 32, "UInt64") } 356 | } 357 | } 358 | 359 | ; EXIT ============================================================================== 360 | 361 | Close: 362 | GuiClose: 363 | GuiEscape: 364 | ExitApp -------------------------------------------------------------------------------- /src/SysMeter_GDIP.ahk: -------------------------------------------------------------------------------- 1 | ; SCRIPT DIRECTIVES ============================================================================================================= 2 | 3 | #Requires AutoHotkey v2.0-beta.1 4 | #DllLoad "gdiplus.dll" 5 | 6 | 7 | ; GLOBALS ======================================================================================================================= 8 | 9 | app := Map("name", "SysMeter", "version", "0.5", "release", "2021-09-14", "author", "jNizM", "licence", "MIT") 10 | 11 | GuiBG := 0xFF303030 12 | 13 | CircleBG := 0x33DDDDDD 14 | CircleFG := 0xFFBEFF08 15 | 16 | PieBG := 0x33DDDDDD 17 | PieFG := 0xFFBEFF08 18 | 19 | FontDark := 0xC0E7E7E7 20 | FontLight := 0xFFBEFF08 21 | 22 | Animation := false 23 | 24 | /* 25 | [Settings] 26 | LocationX= 27 | LocationY= 28 | */ 29 | 30 | ; INITIAL ======================================================================================================================= 31 | 32 | GDIPToken := GdiplusStartup() 33 | 34 | 35 | DLC := DriveList().Count 36 | GuiWidth := 30 + (120 * 2) + 15 + 30 37 | GuiHeight := 200 + (120 * DLC) + (15 * (DLC - 1)) + 30 38 | Location := LoadLocation() 39 | GuiX := Location["X"] 40 | GuiY := Location["Y"] 41 | 42 | 43 | ; GUI =========================================================================================================================== 44 | 45 | OnMessage 0x0201, WM_LBUTTONDOWN 46 | 47 | Main := Gui("-Caption") 48 | Main.MarginX := 0 49 | Main.MarginY := 0 50 | Main.SetFont("s10", "Segoe UI") 51 | 52 | Main.OnEvent("Close", Gui_Close) 53 | Main.OnEvent("Escape", Gui_Close) 54 | if (GuiX != "") && (GuiY != "") 55 | Main.Show("w" GuiWidth " h" GuiHeight " x" GuiX " y" GuiY) 56 | else 57 | Main.Show("w" GuiWidth " h" GuiHeight) 58 | 59 | 60 | hGraphics := GdipCreateFromHWND(Main.hWnd) 61 | hBitmap := GdipCreateBitmapFromGraphics(hGraphics, GuiWidth, GuiHeight) 62 | hGraphicsCtxt := GdipGetImageGraphicsContext(hBitmap) 63 | 64 | hCircleBG := GdipCreatePen1(CircleBG, 5, 2) 65 | hCircleFG := GdipCreatePen1(CircleFG, 5, 2) 66 | 67 | hPieBG := GdipCreateSolidFill(PieBG) 68 | hPieFG := GdipCreateSolidFill(PieFG) 69 | 70 | hFontDark := GdipCreateSolidFill(FontDark) 71 | hFontLight := GdipCreateSolidFill(FontLight) 72 | 73 | hFormatC := GdipCreateStringFormat(0) 74 | hFormatL := GdipCreateStringFormat(0) 75 | hFamily := GdipCreateFontFamilyFromName("Tahoma") 76 | hFontB := GdipCreateFont(hFamily, 12, 0) 77 | hFontM := GdipCreateFont(hFamily, 11, 0) 78 | hFontS := GdipCreateFont(hFamily, 7, 0) 79 | 80 | rCPU := GdipCreateRectF( 30, 120, 120, 20) 81 | rCPU_Usage := GdipCreateRectF( 30, 84, 120, 20) 82 | rRAM := GdipCreateRectF(165, 120, 120, 20) 83 | rRAM_Usage := GdipCreateRectF(165, 84, 120, 20) 84 | 85 | 86 | GdipSetStringFormatAlign(hFormatC, 1) 87 | GdipSetStringFormatAlign(hFormatL, 0) 88 | GdipSetSmoothingMode(hGraphics, 2) 89 | GdipSetSmoothingMode(hGraphicsCtxt, 2) 90 | 91 | 92 | if (Animation) 93 | { 94 | DllCall("winmm\timeBeginPeriod", "uint", 3) 95 | loop 200 96 | { 97 | Init := (A_Index <= 100) ? (0 + A_Index) : (200 - A_Index) 98 | GdipGraphicsClear(hGraphicsCtxt, GuiBG) 99 | 100 | GdipDrawArc(hGraphicsCtxt, hCircleBG, 30, 30, 120, 120, 0, 360) 101 | GdipDrawArc(hGraphicsCtxt, hCircleFG, 30, 30, 120, 120, 90, 360 / 100 * Init) 102 | GdipDrawString(hGraphicsCtxt, "CPU", hFontB, rCPU, hFormatC, hFontLight) 103 | GdipDrawString(hGraphicsCtxt, Init "%", hFontM, rCPU_Usage, hFormatC, hFontDark) 104 | 105 | GdipDrawArc(hGraphicsCtxt, hCircleBG, 165, 30, 120, 120, 0, 360) 106 | GdipDrawArc(hGraphicsCtxt, hCircleFG, 165, 30, 120, 120, 90, 360 / 100 * Init) 107 | GdipDrawString(hGraphicsCtxt, "RAM", hFontB, rRAM, hFormatC, hFontLight) 108 | GdipDrawString(hGraphicsCtxt, Init "%", hFontM, rRAM_Usage, hFormatC, hFontDark) 109 | 110 | loop DLC 111 | { 112 | offset := 200 + ((A_Index - 1) * 135) 113 | GdipFillPie(hGraphicsCtxt, hPieBG, 30, offset, 120, 120, 0, 360) 114 | GdipFillPie(hGraphicsCtxt, hPieFG, 30, offset, 120, 120, 90, 360 / 100 * Init) 115 | } 116 | 117 | GdipDrawImage(hGraphics, hBitmap, 0, 0) 118 | DllCall("kernel32\Sleep", "uint", 1) 119 | } 120 | DllCall("winmm\timeEndPeriod", "uint", 3) 121 | } 122 | 123 | 124 | loop 125 | { 126 | CPU := CPULoad() 127 | RAM := GlobalMemoryStatusEx() 128 | DL := DriveList() 129 | if (DLC != DL.Count) 130 | Reload 131 | 132 | GdipGraphicsClear(hGraphicsCtxt, GuiBG) 133 | 134 | GdipDrawArc(hGraphicsCtxt, hCircleBG, 30, 30, 120, 120, 0, 360) 135 | GdipDrawArc(hGraphicsCtxt, hCircleFG, 30, 30, 120, 120, 90, 360 / 100 * CPU) 136 | GdipDrawString(hGraphicsCtxt, "CPU", hFontB, rCPU, hFormatC, hFontLight) 137 | GdipDrawString(hGraphicsCtxt, CPU "%", hFontM, rCPU_Usage, hFormatC, hFontDark) 138 | 139 | GdipDrawArc(hGraphicsCtxt, hCircleBG, 165, 30, 120, 120, 0, 360) 140 | GdipDrawArc(hGraphicsCtxt, hCircleFG, 165, 30, 120, 120, 90, 360 / 100 * RAM) 141 | GdipDrawString(hGraphicsCtxt, "RAM", hFontB, rRAM, hFormatC, hFontLight) 142 | GdipDrawString(hGraphicsCtxt, RAM "%", hFontM, rRAM_Usage, hFormatC, hFontDark) 143 | 144 | for i, v in DL 145 | { 146 | offset := 200 + ((A_Index - 1) * 135) 147 | GdipFillPie(hGraphicsCtxt, hPieBG, 30, offset, 120, 120, 0, 360) 148 | GdipFillPie(hGraphicsCtxt, hPieFG, 30, offset, 120, 120, 90, 360 / 100 * DL[i]["Perc"]) 149 | 150 | rLetter := GdipCreateRectF(157, offset + 20, 80, 20) 151 | GdipDrawString(hGraphicsCtxt, DL[i]["Letter"], hFontM, rLetter, hFormatL, hFontLight) 152 | 153 | GdipFillRectangle(hGraphicsCtxt, hPieFG, 160, offset + 45, 6, 6) 154 | rUsed := GdipCreateRectF(170, offset + 43, 80, 10) 155 | GdipDrawString(hGraphicsCtxt, "Used: " DL[i]["Used"], hFontS, rUsed, hFormatL, hFontDark) 156 | 157 | GdipFillRectangle(hGraphicsCtxt, hPieBG, 160, offset + 65, 6, 6) 158 | rFree := GdipCreateRectF(170, offset + 63, 80, 10) 159 | GdipDrawString(hGraphicsCtxt, "Free: " DL[i]["Free"], hFontS, rFree, hFormatL, hFontDark) 160 | } 161 | 162 | GdipDrawImage(hGraphics, hBitmap, 0, 0) 163 | sleep 500 164 | } 165 | 166 | 167 | ; WINDOW EVENTS ================================================================================================================= 168 | 169 | Gui_Close(*) 170 | { 171 | Main.GetPos(&NewX, &NewY) 172 | SaveLocation(NewX, NewY, GuiX, GuiY) 173 | 174 | GdipDeleteFont(hFontB) 175 | GdipDeleteFont(hFontM) 176 | GdipDeleteFont(hFontS) 177 | 178 | GdipDeleteBrush(hPieBG) 179 | GdipDeleteBrush(hPieFG) 180 | GdipDeleteBrush(hFontDark) 181 | GdipDeleteBrush(hFontLight) 182 | 183 | GdipDeletePen(hCircleBG) 184 | GdipDeletePen(hCircleFG) 185 | 186 | GdipDeleteFontFamily(hFamily) 187 | GdipDeleteStringFormat(hFormatC) 188 | GdipDeleteStringFormat(hFormatL) 189 | 190 | GdipDeleteGraphics(hGraphicsCtxt) 191 | GdipDisposeImage(hBitmap) 192 | GdipDeleteGraphics(hGraphics) 193 | GdiplusShutdown(GDIPToken) 194 | ExitApp 195 | } 196 | 197 | 198 | WM_LBUTTONDOWN(wParam, lParam, msg, hwnd) 199 | { 200 | static WM_NCLBUTTONDOWN := 0x00A1 201 | static HTCAPTION := 2 202 | 203 | if (hWnd = Main.Hwnd) 204 | PostMessage WM_NCLBUTTONDOWN, HTCAPTION,,, "A" 205 | } 206 | 207 | 208 | ; GDI+ ========================================================================================================================== 209 | 210 | GdiplusStartup() 211 | { 212 | GDIPSTARTUPINPUT := Buffer(24, 0) 213 | NumPut("uint", 1, GDIPSTARTUPINPUT) 214 | if (STATUS := DllCall("gdiplus\GdiplusStartup", "uptr*", &GDIPToken := 0, "ptr", GDIPSTARTUPINPUT, "ptr", 0, "uint")) 215 | { 216 | MsgBox("GDI+ could not be startet!`n`nThe program will exit!", STATUS) 217 | ExitApp 218 | } 219 | return GDIPToken 220 | } 221 | 222 | 223 | GdiplusShutdown(GDIPToken) 224 | { 225 | if (GDIPToken) 226 | DllCall("gdiplus\GdiplusShutdown", "uptr", GDIPToken) 227 | return 228 | } 229 | 230 | 231 | GdipCreateBitmapFromGraphics(hGraphics, Width, Height) 232 | { 233 | if !(DllCall("gdiplus\GdipCreateBitmapFromGraphics", "int", Width 234 | , "int", Height 235 | , "ptr", hGraphics 236 | , "ptr*", &hBitmap := 0)) 237 | return hBitmap 238 | throw Error("GdipCreateBitmapFromGraphics failed", -1) 239 | } 240 | 241 | 242 | GdipCreateFont(hFamily, Size, Style := 0, Unit := 3) 243 | { 244 | if !(DllCall("gdiplus\GdipCreateFont", "ptr", hFamily 245 | , "float", Size 246 | , "int", Style 247 | , "int", Unit 248 | , "ptr*", &hFont := 0)) 249 | return hFont 250 | throw Error("GdipCreateFont failed", -1) 251 | } 252 | 253 | 254 | GdipCreateFontFamilyFromName(Family, Collection := 0) 255 | { 256 | if !(DllCall("gdiplus\GdipCreateFontFamilyFromName", "wstr", Family 257 | , "ptr", Collection 258 | , "ptr*", &hFamily := 0)) 259 | return hFamily 260 | throw Error("GdipCreateFontFamilyFromName failed", -1) 261 | } 262 | 263 | 264 | GdipCreateFromHWND(hWnd) 265 | { 266 | if !(DllCall("gdiplus\GdipCreateFromHWND", "ptr", hWnd 267 | , "ptr*", &hGraphics := 0)) 268 | return hGraphics 269 | throw Error("GdipCreateFromHWND failed", -1) 270 | } 271 | 272 | 273 | GdipCreatePen1(ARGB := 0xFF000000, Width := 1, Unit := 2) 274 | { 275 | if !(DllCall("gdiplus\GdipCreatePen1", "uint", ARGB 276 | , "float", Width 277 | , "int", Unit 278 | , "ptr*", &hPen := 0)) 279 | return hPen 280 | throw Error("GdipCreatePen1 failed", -1) 281 | } 282 | 283 | 284 | GdipCreateRectF(X := 0, Y := 0, Width := 0, Height := 0) 285 | { 286 | RectF := Buffer(16) 287 | NumPut("float", X, "float", Y, "float", Width, "float", Height, RectF) 288 | return RectF 289 | } 290 | 291 | 292 | GdipCreateSolidFill(ARGB := 0xFF000000) 293 | { 294 | if !(DllCall("gdiplus\GdipCreateSolidFill", "int", ARGB 295 | , "ptr*", &hBrush := 0)) 296 | return hBrush 297 | throw Error("GdipCreateSolidFill failed", -1) 298 | } 299 | 300 | 301 | GdipCreateStringFormat(Format := 0, LangID := 0) 302 | { 303 | if !(DllCall("gdiplus\GdipCreateStringFormat", "int", Format 304 | , "int", LangID 305 | , "ptr*", &hFormat := 0)) 306 | return hFormat 307 | throw Error("GdipCreateStringFormat failed", -1) 308 | } 309 | 310 | 311 | GdipDeleteBrush(hBrush) 312 | { 313 | if !(DllCall("gdiplus\GdipDeleteBrush", "ptr", hBrush)) 314 | return true 315 | throw Error("GdipDeleteBrush failed", -1) 316 | } 317 | 318 | 319 | GdipDeleteFont(hFont) 320 | { 321 | if !(DllCall("gdiplus\GdipDeleteFont", "ptr", hFont)) 322 | return true 323 | throw Error("GdipDeleteFont failed", -1) 324 | } 325 | 326 | 327 | GdipDeleteFontFamily(hFamily) 328 | { 329 | if !(DllCall("gdiplus\GdipDeleteFontFamily", "ptr", hFamily)) 330 | return true 331 | throw Error("GdipDeleteFontFamily failed", -1) 332 | } 333 | 334 | 335 | GdipDeleteGraphics(hGraphics) 336 | { 337 | if !(DllCall("gdiplus\GdipDeleteGraphics", "ptr", hGraphics)) 338 | return true 339 | throw Error("GdipDeleteGraphics failed", -1) 340 | } 341 | 342 | 343 | GdipDeletePen(hPen) 344 | { 345 | if !(DllCall("gdiplus\GdipDeletePen", "ptr", hPen)) 346 | return true 347 | throw Error("GdipDeletePen failed", -1) 348 | } 349 | 350 | 351 | GdipDeleteStringFormat(hFormat) 352 | { 353 | if !(DllCall("gdiplus\GdipDeleteStringFormat", "ptr", hFormat)) 354 | return true 355 | throw Error("GdipDeleteStringFormat failed", -1) 356 | } 357 | 358 | 359 | GdipDisposeImage(hImage) 360 | { 361 | if !(DllCall("gdiplus\GdipDisposeImage", "ptr", hImage)) 362 | return true 363 | throw Error("GdipDisposeImage failed", -1) 364 | } 365 | 366 | 367 | GdipDrawArc(hGraphics, hPen, X, Y, Width, Height, StartAngle, SweepAngle) 368 | { 369 | if !(DllCall("gdiplus\GdipDrawArc", "ptr", hGraphics 370 | , "ptr", hPen 371 | , "float", X 372 | , "float", Y 373 | , "float", Width 374 | , "float", Height 375 | , "float", StartAngle 376 | , "float", SweepAngle)) 377 | return true 378 | throw Error("GdipDrawArc failed", -1) 379 | } 380 | 381 | 382 | GdipDrawImage(hGraphics, hImage, X, Y) 383 | { 384 | if !(DllCall("gdiplus\GdipDrawImage", "ptr", hGraphics 385 | , "ptr", hImage 386 | , "float", X 387 | , "float", Y)) 388 | return true 389 | throw Error("GdipDrawImage failed", -1) 390 | } 391 | 392 | 393 | GdipDrawLine(hGraphics, hPen, X1, Y1, X2, Y2) 394 | { 395 | if !(DllCall("gdiplus\GdipDrawLine", "ptr", hGraphics 396 | , "ptr", hPen 397 | , "float", X1 398 | , "float", Y1 399 | , "float", X2 400 | , "float", Y2)) 401 | return true 402 | throw Error("GdipDrawLine failed", -1) 403 | } 404 | 405 | 406 | GdipDrawString(hGraphics, String, hFont, Layout, hFormat, hBrush) 407 | { 408 | if !(DllCall("gdiplus\GdipDrawString", "ptr", hGraphics 409 | , "wstr", String 410 | , "int", -1 411 | , "ptr", hFont 412 | , "ptr", Layout 413 | , "ptr", hFormat 414 | , "ptr", hBrush)) 415 | return true 416 | throw Error("GdipDrawString failed", -1) 417 | } 418 | 419 | 420 | GdipFillPie(hGraphics, hBrush, X, Y, Width, Height, StartAngle, SweepAngle) 421 | { 422 | if !(DllCall("gdiplus\GdipFillPie", "ptr", hGraphics 423 | , "ptr", hBrush 424 | , "float", X 425 | , "float", Y 426 | , "float", Width 427 | , "float", Height 428 | , "float", StartAngle 429 | , "float", SweepAngle)) 430 | return true 431 | throw Error("GdipFillPie failed", -1) 432 | } 433 | 434 | 435 | GdipFillRectangle(hGraphics, hBrush, X, Y, Width, Height) 436 | { 437 | if !(DllCall("gdiplus\GdipFillRectangle", "ptr", hGraphics 438 | , "ptr", hBrush 439 | , "float", X 440 | , "float", Y 441 | , "float", Width 442 | , "float", Height)) 443 | return true 444 | throw Error("GdipFillRectangle failed", -1) 445 | } 446 | 447 | 448 | GdipGetImageGraphicsContext(hImage) 449 | { 450 | if !(DllCall("gdiplus\GdipGetImageGraphicsContext", "ptr", hImage 451 | , "ptr*", &hGraphics := 0)) 452 | return hGraphics 453 | throw Error("GdipGetImageGraphicsContext failed", -1) 454 | } 455 | 456 | 457 | GdipGraphicsClear(hGraphics, ARGB := 0xFF000000) 458 | { 459 | if !(DllCall("gdiplus\GdipGraphicsClear", "ptr", hGraphics 460 | , "uint", ARGB)) 461 | return true 462 | throw Error("GdipGraphicsClear failed", -1) 463 | } 464 | 465 | 466 | GdipSetSmoothingMode(hGraphics, SmoothingMode) 467 | { 468 | if !(DllCall("gdiplus\GdipSetSmoothingMode", "ptr", hGraphics 469 | , "int", SmoothingMode)) 470 | return true 471 | throw Error("GdipSetSmoothingMode failed", -1) 472 | } 473 | 474 | 475 | GdipSetStringFormatAlign(hStringFormat, Flag) 476 | { 477 | if !(DllCall("gdiplus\GdipSetStringFormatAlign", "ptr", hStringFormat 478 | , "int", Flag)) 479 | return true 480 | throw Error("GdipSetStringFormatAlign failed", -1) 481 | } 482 | 483 | 484 | ; FUNCTIONS ===================================================================================================================== 485 | 486 | CPULoad() ; thx to SKAN 487 | { 488 | static PIT := 0, PKT := 0, PUT := 0 489 | 490 | DllCall("kernel32\GetSystemTimes", "int64*", &CIT := 0, "int64*", &CKT := 0, "int64*", &CUT := 0) 491 | IdleTime := PIT - CIT, KernelTime := PKT - CKT, UserTime := PUT - CUT 492 | SystemTime := KernelTime + UserTime 493 | 494 | PIT := CIT, PKT := CKT, PUT := CUT 495 | return ((SystemTime - IdleTime) * 100) // SystemTime 496 | } 497 | 498 | 499 | DriveList() 500 | { 501 | DRIVES := Map() 502 | for v in StrSplit(DriveGetList()) 503 | { 504 | DriveLetter := v ":" 505 | DriveType := DriveGetType(DriveLetter) 506 | if (DriveType != "Fixed") && (DriveType != "Removable") 507 | continue 508 | try { 509 | DRIVE := Map() 510 | DRIVE["Letter"] := DriveLetter 511 | DriveCapacity := DriveGetCapacity(DriveLetter) 512 | DriveFreeSpace := DriveGetSpaceFree(DriveLetter) 513 | DRIVE["Cap"] := Round(DriveCapacity / 1024, 2) " GB" 514 | DRIVE["Free"] := Round(DriveFreeSpace / 1024, 2) " GB" 515 | DRIVE["Used"] := Round((DriveCapacity - DriveFreeSpace) / 1024, 2) " GB" 516 | DRIVE["Perc"] := Round((1 - DriveFreeSpace / DriveCapacity) * 100, 0) 517 | } catch { 518 | continue ; skip full encrypted drives (bitlocker / veracrypt / ...) 519 | } 520 | DRIVES[A_Index] := DRIVE 521 | } 522 | return DRIVES 523 | } 524 | 525 | 526 | GlobalMemoryStatusEx() 527 | { 528 | MEMORYSTATUSEX := Buffer(64, 0) 529 | NumPut("uint", 64, MEMORYSTATUSEX) 530 | if (DllCall("kernel32\GlobalMemoryStatusEx", "ptr", MEMORYSTATUSEX)) 531 | return NumGet(MEMORYSTATUSEX, 4, "uint") 532 | ;return Round(100 - NumGet(MEMORYSTATUSEX, 16, "uint64") / NumGet(MEMORYSTATUSEX, 8, "uint64") * 100, 2) 533 | return false 534 | } 535 | 536 | 537 | SaveLocation(NewX, NewY, OldX, OldY) 538 | { 539 | if (A_IsCompiled) 540 | return 541 | 542 | if (NewX != OldX) 543 | IniWrite NewX, A_ScriptFullPath, "Settings", "LocationX" 544 | if (NewY != OldY) 545 | IniWrite NewY, A_ScriptFullPath, "Settings", "LocationY" 546 | } 547 | 548 | 549 | LoadLocation() 550 | { 551 | if (A_IsCompiled) 552 | return MapX("X", "", "Y", "") 553 | 554 | X := IniRead(A_ScriptFullPath, "Settings", "LocationX", "") 555 | Y := IniRead(A_ScriptFullPath, "Settings", "LocationY", "") 556 | return MapX("X", X, "Y", Y) 557 | } 558 | 559 | 560 | class MapX extends Map { 561 | CaseSense := "Off" 562 | Default := "" 563 | } 564 | 565 | ; =============================================================================================================================== 566 | --------------------------------------------------------------------------------