im deutschen Forum habe ich keinen geeigneten Thread gefunden, um die folgende Spielerei (mehr ist es nicht) unterzubringen:
Es handelt sich um ein AutoIT-Script, welches die verstrichene Zeit, die geschätzte Restdauer und die geschätzte Gesamtdauer eines Vorgangs im Fenstertitel eines modalen TC-Dialogs mit Fortschrittsbalken anzeigt. Dieser Dialog wird z.B. bei Vorgängen wie Packen, Entpacken, Kopieren und Löschen, die im Vordergrund laufen, gezeigt.
Hier ein Screenshot, wie das dann aussieht.
Ein ReadMe, das Script (einmal mit Kommentaren und einmal ohne) und eine allein lauffähige kompilierte Version des Scripts könnt Ihr hier herunterladen.
Hier das Script in der unkommentierten Fassung (ist auch im o.g. ZIP enthalten):
Code: Select all
;====================================================================================================
;TCRestzeit V0.9.1, van Dusen, 2006-03-05 (van_dusen@email.de)
;Script für AutoIT3 V3.1.1.0 (http://www.autoitscript.com/autoit3/)
;Beschreibung: Addon für den Dateimanager TotalCommander (http://www.ghisler.com)
;Zeigt im Titel des Fensters der TC-Fortschrittsanzeige die verstrichene Zeit, Restdauer und Gesamtdauer
;eines Vorgangs (Packen, Entpacken, Kopieren, Löschen usw.) an.
;Script getestet mit mit TC V6.54a, WinXP HE SP1
;====================================================================================================
#include <GUIConstants.au3>
AutoItSetOption("WinTitleMatchMode", 4)
AutoItSetOption("GUIOnEventMode", 1)
AutoItSetOption("PixelCoordMode", 2)
;~ $frm_gui = GUICreate("", 400, 90, -1, -1, -1, $WS_EX_TOPMOST)
$frm_gui = GUICreate("", 400, 90)
$lbl_status = GUICtrlCreateLabel("", 10, 20, 380, 20, $SS_SUNKEN+$SS_CENTER)
$btn_cancel = GUICtrlCreateButton ("Beenden", 150, 50, 100, 30)
GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
GUICtrlSetOnEvent($btn_cancel, "_Exit")
GUISetState(@SW_SHOW)
Global $wh_tcprogress
Global $wt_tcprogress
While 1
WinSetTitle($frm_gui, "", "TCRestzeit 0.9 (Ruht)")
GUICtrlSetData($lbl_status, "Warte auf einen Vorgang mit TC-Fortschrittsdialog")
WinWait("classname=TDLG2FILEACTIONMIN")
$wh_tcprogress = WinGetHandle("classname=TDLG2FILEACTIONMIN")
$wt_tcprogress = WinGetTitle($wh_tcprogress)
$wh_activewin = WinGetHandle(WinGetTitle(""))
$pos_tcprogressbar = ControlGetPos($wh_tcprogress, "", "TPercentPanel2")
$err_tcprogressbar = 0
If @error Or Not ControlCommand($wh_tcprogress, "", "TPercentPanel2", "IsVisible", "") Then
$err_tcprogressbar = 1
$pos_tcprogressbar = ControlGetPos($wh_tcprogress, "", "TPercentPanel1")
If @error Or Not ControlCommand($wh_tcprogress, "", "TPercentPanel1", "IsVisible", "") Then
WinWaitClose($wh_tcprogress)
Else
$err_tcprogressbar = 0
EndIf
EndIf
If Not $err_tcprogressbar Then
$l = $pos_tcprogressbar[0]
$t = $pos_tcprogressbar[1] + $pos_tcprogressbar[3] - 2
$r = $pos_tcprogressbar[2] + $l
WinActivate($wh_tcprogress)
$px_poscurr = PixelSearch($l, $t, $r, $t, 0xFFFFFF)
WinActivate($wh_activewin)
$px_posinit = $px_poscurr[0] - 1 - $pos_tcprogressbar[0]
EndIf
$ts_init = TimerInit()
$ts_diff = 0
$ts_diffprev = 0
$px_diff = 0
$tm_remain = 0
$tm_total = 0
;$stichprobe = 0
While WinExists($wh_tcprogress)
$ts_diffprev = $ts_diff
$ts_diff = TimerDiff($ts_init)
$info_tmelapsed = _Milliseconds2Time($ts_diff)
If WinActive($wh_tcprogress) Then
;$stichprobe = $stichprobe + 1
$px_poscurr = PixelSearch($l, $t, $r, $t, 0xFFFFFF)
$px_elapsed = $px_poscurr[0] - 1 - $pos_tcprogressbar[0]
$px_remain = $pos_tcprogressbar[2] - $px_elapsed
$px_diffprev = $px_diff
$px_diff = $px_elapsed - $px_posinit
If $px_diffprev = $px_diff Then
$tm_remain = $tm_remain - ($ts_diff - $ts_diffprev)
Else
$tm_remain = $ts_diff * $px_remain / $px_diff
EndIf
$tm_total = $ts_diff + $tm_remain
If $tm_remain > 0 Then
$info_tmremain = _Milliseconds2Time($tm_remain)
$info_tmtotal = _Milliseconds2Time($tm_total)
Else
$info_tmremain = "??:??:??"
$info_tmtotal = "??:??:??"
EndIf
$info = "Bisher " & $info_tmelapsed & " • Rest " & $info_tmremain & " • Gesamt " & $info_tmtotal
GUICtrlSetData($lbl_status, Round($px_elapsed / $pos_tcprogressbar[2] * 100, 0) & "% • " & $info)
WinSetTitle($wh_tcprogress, "", $info)
WinSetTitle($frm_gui, "", "Rest " & $info_tmremain)
Else
WinSetTitle($frm_gui, "", "Bisher " & $info_tmelapsed)
GUICtrlSetData($lbl_status, "Bisher " & $info_tmelapsed)
EndIf
Sleep(1000)
WEnd
WEnd
Func _Exit()
GUIDelete($frm_gui)
If WinExists($wh_tcprogress) Then WinSetTitle($wh_tcprogress, "", $wt_tcprogress)
Exit(0)
EndFunc
Func _Milliseconds2Time($ms)
$hh = Int($ms / (1000 * 60 * 60))
$ms = $ms - $hh * (1000 * 60 * 60)
$mm = Int($ms / (1000 * 60))
$ms = $ms - $mm * (1000 * 60)
$ss = Int($ms / 1000)
Return StringFormat("%02d", $hh) & ":" & StringFormat("%02d", $mm) & ":" & StringFormat("%02d", $ss)
EndFunc

EDIT
Update auf V0.9.1 (o.g. Script und ZIP):
Fehlerabbruch bei Fortschrittsdialog für externen Packeraufruf beseitigt
EDIT 20.03.06
Update auf V0.9.5:
Seit V0.9.1 diverse Änderungen und Erweiterungen (siehe ReadMe)
Neu in V0.9.5 gegenüber V0.9.4:
Dialogfunktion zum Editieren des Archivdateinamens im TC-Dialog "Dateien packen" mit Platzhaltern ("[G]", "[P]", "[Y]", "[M]" usw.)
Abbildung des Dialogs TCRestzeit V0.9.5
Download TCRestzeit_0.9.5.zip (246.469 Bytes)