erik501 Posted April 28, 2023 Author Posted April 28, 2023 expandcollapse popup#NoTrayIcon ; Run Total Commander executable Run(@ScriptDir & '\TOTALCMD64.EXE') Sleep(100) ; Define constants for Total Commander's window class and new title Local $TTOTAL_CMD_class = "[CLASS:TTOTAL_CMD]" Local $TTOTAL_CMD_windows_new_title = "TC UltraPack X64" ; Check if a Total Commander window exists If WinExists($TTOTAL_CMD_class) Then Local $TTOTAL_CMD_windows_array Local $version = IniRead(@ScriptDir & "\version.ini", "Version", "v", "Default Value") ;Local $version = FileReadLine(@ScriptDir & "\version.ini", 1) Local $new_title_with_version = $TTOTAL_CMD_windows_new_title & " v" & $version ; Set the title for all Total Commander windows WinSetTitle($TTOTAL_CMD_class, '', $new_title_with_version) ; Get the process ID of the Total Commander window $process_id = WinGetProcess(WinGetHandle($TTOTAL_CMD_class)) ; Continuously update the title for new Total Commander windows While WinExists($TTOTAL_CMD_class) Sleep(10) $TTOTAL_CMD_windows_array = WinList($TTOTAL_CMD_class) If IsArray($TTOTAL_CMD_windows_array) Then For $i = 1 To UBound($TTOTAL_CMD_windows_array) - 1 ; Check if the window belongs to the Total Commander process If WinGetProcess($TTOTAL_CMD_windows_array[$i][1]) = $process_id And WinGetTitle($TTOTAL_CMD_windows_array[$i][1]) <> $new_title_with_version Then ; Get the list of all drive letters in use $drives = DriveGetDrive("ALL") $new_title_with_space = $new_title_with_version & " - Drives free Space: " For $j = 1 To $drives[0] ; Get the free space on the drive in percentage $free_space = DriveSpaceFree($drives[$j]) / DriveSpaceTotal($drives[$j]) * 100 $new_title_with_space &= StringUpper($drives[$j]) & " (" & Round($free_space, 2) & "%), " Next $new_title_with_space = StringTrimRight($new_title_with_space, 2) ; remove the trailing comma and space WinSetTitle($TTOTAL_CMD_windows_array[$i][1], '', $new_title_with_space) EndIf Next EndIf WEnd EndIf adding drives free space in title
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now