added a comment in Manager.ahk
added the cleanup-code for Bar_getDiskLoad in Main.ahk added two more status fields (included in the readinAny-field) in Bar.ahk and Config.ahk: | functions | configuration variables | |--------------------|--------------------------| | Bar_getDiskLoad | Config_readinDiskLoad | | Bar_getMemoryUsage | Config_readinMemoryUsage |
This commit is contained in:
parent
8a4bd53b4a
commit
582ea2b84e
4 changed files with 69 additions and 27 deletions
26
src/Bar.ahk
26
src/Bar.ahk
|
@ -167,6 +167,8 @@ Bar_init(m) {
|
||||||
DllCall("Shell32.dll\SHAppBarMessage", "UInt", (ABM_SETPOS := 0x3) , "UInt", &Bar_appBarData)
|
DllCall("Shell32.dll\SHAppBarMessage", "UInt", (ABM_SETPOS := 0x3) , "UInt", &Bar_appBarData)
|
||||||
; SKAN: Crazy Scripting : Quick Launcher for Portable Apps (http://www.autohotkey.com/forum/topic22398.html)
|
; SKAN: Crazy Scripting : Quick Launcher for Portable Apps (http://www.autohotkey.com/forum/topic22398.html)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bar_hDrive := DllCall("CreateFile", "Str", "\\.\PhysicalDrive0", "UInt", 0, "UInt", 3, "UInt", 0, "UInt", 3, "UInt", 0, "UInt", 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
Bar_initCmdGui() {
|
Bar_initCmdGui() {
|
||||||
|
@ -379,6 +381,23 @@ Bar_getBatteryStatus(ByRef batteryLifePercent, ByRef acLineStatus) {
|
||||||
}
|
}
|
||||||
; PhiLho: AC/Battery status (http://www.autohotkey.com/forum/topic7633.html)
|
; PhiLho: AC/Battery status (http://www.autohotkey.com/forum/topic7633.html)
|
||||||
|
|
||||||
|
Bar_getDiskLoad(ByRef readLoad, ByRef writeLoad) {
|
||||||
|
Global Bar_hDrive
|
||||||
|
Static oldReadCount, oldWriteCount
|
||||||
|
|
||||||
|
dpSize := 5 * 8 + 4 + 4 + 4 + 4 + 8 + 4 + 8 * (A_IsUnicode ? 2 : 1) + 12 ; 88?
|
||||||
|
VarSetCapacity(dp, dpSize)
|
||||||
|
DllCall("DeviceIoControl", "UInt", Bar_hDrive, "UInt", 0x00070020, "UInt", 0, "UInt", 0, "UInt", &dp, "UInt", dpSize, "UIntP", nReturn, "UInt", 0) ; IOCTL_DISK_PERFORMANCE
|
||||||
|
|
||||||
|
newReadCount := NumGet(dp, 40)
|
||||||
|
newWriteCount := NumGet(dp, 44)
|
||||||
|
readLoad := SubStr(" " Round((1 - 1 / (1 + newReadCount - oldReadCount)) * 100), -2)
|
||||||
|
writeLoad := SubStr(" " Round((1 - 1 / (1 + newWriteCount - oldWriteCount)) * 100), -2)
|
||||||
|
oldReadCount := newReadCount
|
||||||
|
oldWriteCount := newWriteCount
|
||||||
|
}
|
||||||
|
; fures: System + Network monitor - with net history graph (http://www.autohotkey.com/community/viewtopic.php?p=260329)
|
||||||
|
|
||||||
Bar_getHeight() {
|
Bar_getHeight() {
|
||||||
Global Bar_#0_#1, Bar_#0_#1H, Bar_#0_#2, Bar_#0_#2H, Bar_ctrlHeight, Bar_height, Bar_textHeight
|
Global Bar_#0_#1, Bar_#0_#1H, Bar_#0_#2, Bar_#0_#2H, Bar_ctrlHeight, Bar_height, Bar_textHeight
|
||||||
Global Config_fontName, Config_fontSize, Config_singleRowBar, Config_spaciousBar, Config_verticalBarPos
|
Global Config_fontName, Config_fontSize, Config_singleRowBar, Config_spaciousBar, Config_verticalBarPos
|
||||||
|
@ -413,6 +432,13 @@ Bar_getHeight() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Bar_getMemoryUsage() {
|
||||||
|
VarSetCapacity(memoryStatus, 4 + 4 + 4 + 4 + 4 + 4 + 4 + 4)
|
||||||
|
DllCall("kernel32.dll\GlobalMemoryStatus", "UInt", &memoryStatus)
|
||||||
|
Return, SubStr(" " Round(*(&memoryStatus + 4)), -2) ; LS byte is enough, 0..100
|
||||||
|
}
|
||||||
|
; fures: System + Network monitor - with net history graph (http://www.autohotkey.com/community/viewtopic.php?p=260329)
|
||||||
|
|
||||||
Bar_getSystemTimes() { ; Total CPU Load
|
Bar_getSystemTimes() { ; Total CPU Load
|
||||||
Static oldIdleTime, oldKrnlTime, oldUserTime
|
Static oldIdleTime, oldKrnlTime, oldUserTime
|
||||||
Static newIdleTime, newKrnlTime, newUserTime
|
Static newIdleTime, newKrnlTime, newUserTime
|
||||||
|
|
|
@ -37,6 +37,8 @@ Config_init() {
|
||||||
Config_readinBat := False ; If true, the system battery status is read in and displayed in the status bar. This only makes sense, if you have a system battery (notebook).
|
Config_readinBat := False ; If true, the system battery status is read in and displayed in the status bar. This only makes sense, if you have a system battery (notebook).
|
||||||
Config_readinCpu := False ; If true, the current CPU load is read in and displayed in the status bar.
|
Config_readinCpu := False ; If true, the current CPU load is read in and displayed in the status bar.
|
||||||
Config_readinDate := True ; If true, the current date is read in (format: "WW, DD. MMM. YYYY") and displayed in the status bar.
|
Config_readinDate := True ; If true, the current date is read in (format: "WW, DD. MMM. YYYY") and displayed in the status bar.
|
||||||
|
Config_readinDiskLoad := False ; If true, the current disk usage (read and write) is read in and displayed in the status bar.
|
||||||
|
Config_readinMemoryUsage := False ; If true, the system memory status is read in and displayed in the status bar.
|
||||||
Config_readinTime := True ; If true, the current time is read in (format: "HH:MM") and displayed in the status bar.
|
Config_readinTime := True ; If true, the current time is read in (format: "HH:MM") and displayed in the status bar.
|
||||||
Config_readinInterval := 30000 ; Time in milliseconds after which the above status values are refreshed.
|
Config_readinInterval := 30000 ; Time in milliseconds after which the above status values are refreshed.
|
||||||
|
|
||||||
|
@ -202,15 +204,27 @@ Config_hotkeyLabel:
|
||||||
Return
|
Return
|
||||||
|
|
||||||
Config_readinAny() { ; Add information to the variable "text" in this function to display it in the status bar.
|
Config_readinAny() { ; Add information to the variable "text" in this function to display it in the status bar.
|
||||||
Global Config_readinCpu, Config_readinDate
|
Global Config_readinCpu, Config_readinDate, Config_readinDiskLoad, Config_readinMemoryUsage
|
||||||
|
|
||||||
text := ""
|
text := ""
|
||||||
If Config_readinCpu
|
If Config_readinCpu
|
||||||
text .= " CPU: " Bar_getSystemTimes() "% "
|
text .= " CPU: " Bar_getSystemTimes() "% "
|
||||||
If Config_readinDate And Config_readinCpu
|
If Config_readinMemoryUsage {
|
||||||
|
If Config_readinCpu
|
||||||
|
text .= "|"
|
||||||
|
text .= " RAM: " Bar_getMemoryUsage() "% "
|
||||||
|
}
|
||||||
|
If Config_readinDiskLoad {
|
||||||
|
If (Config_readinCpu Or Config_readinMemoryUsage)
|
||||||
|
text .= "|"
|
||||||
|
Bar_getDiskLoad(rLoad, wLoad)
|
||||||
|
text .= " Dr: " rLoad "% | Dw: " wLoad "% "
|
||||||
|
}
|
||||||
|
If Config_readinDate {
|
||||||
|
If (Config_readinCpu Or Config_readinMemoryUsage Or Config_readinDiskLoad)
|
||||||
text .= "|"
|
text .= "|"
|
||||||
If Config_readinDate
|
|
||||||
text .= " " A_DDD ", " A_DD ". " A_MMM ". " A_YYYY " "
|
text .= " " A_DDD ", " A_DD ". " A_MMM ". " A_YYYY " "
|
||||||
|
}
|
||||||
|
|
||||||
Return, text
|
Return, text
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ Main_cleanup: ; The labels with "ExitApp" or "Return" at the end and hotkeys h
|
||||||
If Config_autoSaveSession
|
If Config_autoSaveSession
|
||||||
Config_saveSession()
|
Config_saveSession()
|
||||||
Manager_cleanup()
|
Manager_cleanup()
|
||||||
|
DllCall("CloseHandle", "UInt", Bar_hDrive) ; used in Bar_getDiskLoad
|
||||||
ExitApp
|
ExitApp
|
||||||
|
|
||||||
Main_help:
|
Main_help:
|
||||||
|
|
|
@ -247,6 +247,7 @@ Manager_lockWorkStation() {
|
||||||
Sleep, % 4 * Config_shellMsgDelay
|
Sleep, % 4 * Config_shellMsgDelay
|
||||||
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, DisableLockWorkstation, 1
|
RegWrite, REG_DWORD, HKEY_CURRENT_USER, Software\Microsoft\Windows\CurrentVersion\Policies\System, DisableLockWorkstation, 1
|
||||||
}
|
}
|
||||||
|
; Unambiguous: Re-use WIN+L as a hotkey in bug.n (http://www.autohotkey.com/community/viewtopic.php?p=500903&sid=eb3c7a119259b4015ff045ef80b94a81#p500903)
|
||||||
|
|
||||||
Manager_loop(index, increment, lowerBound, upperBound) {
|
Manager_loop(index, increment, lowerBound, upperBound) {
|
||||||
index += increment
|
index += increment
|
||||||
|
|
Loading…
Reference in a new issue