Sign in to follow this  
Followers 0
LAttilaD

FTP Checker for TCMD

1 post in this topic

Sorry for posting it here, but I wasn't allowed to start a topic in the Example Scripts category. Here I was. Many thanks for any moderator who would move this post to a more appropriate place.

Below is a small utility I made to watch how my up/downloads are going. It monitors Total Commander upload windows and displays data from them on the top of screen, with a BIG font to make it easy to view from a distance. It shows

the percentage of each file done;

the file name;

the bytes transferred so far;

the current speed;

the fastest speed measured for that file;

the estimated time left;

the estimated time when transfer will finish (an asterisk shows it will finish only after midnight; more asterisks show the process will finish several days later).

Information shown in bold aren't shown by Total Commander itself.

You may press Win-Q to hide and unhide the display.

It is designed for a black background what I'm using, but it's easy to change colors, font size, transparency etc. in the source code. Additionally, it's designed for recent versions of Total Commander, running in English language.

#include <guiconstants.au3>
dim $item[20][6], $prevcount

autoitsetoption("wintitlematchmode", 2)
$me=guicreate("", 800, 10, 0, 0, $WS_POPUP, $WS_EX_TOOLWINDOW)
guisetstate(@SW_SHOW)
$list=guictrlcreatelabel("", 0, 0, 800, 400)
guictrlsetcolor($list, 0xffff00)
guictrlsetfont($list, 22)
winsettrans($me, "", 192)
winsetontop($me, "", 1)

hotkeyset("#q", "onoff")

$begin=timerinit()
update()
while 1
    $msg=guigetmsg()
    if $msg=$GUI_EVENT_CLOSE then exitloop
    if timerdiff($begin)>500 then
        update()
        $begin=timerinit()
        endif
wend

func update()
global $list, $me, $item, $prevcount
$l=winlist("[CLASS:DOWNDLGLIST2]")
$count=$l[0][0]
if $count<>$prevcount then
    for $a=1 to $prevcount
    $item[$a][3]=0
    next
    endif
$prevcount=$count

for $i=1 to $count
$t=wingettitle($l[$i][0])
$t=stringleft($t, stringlen($t)-8)
$d=controlgettext($l[$i][0], "", "Static1")
$d=stringmid($d, stringinstr($d, " ")+1)
$e=stringsplit($d, ",")
if $e[0]>2 then
    $bytes=stringleft($e[1], stringlen($e[1])-5)
    $speed=stringstripws(stringleft($e[2], stringlen($e[2])-8), 7)
    
    $otim=stringleft($e[3], stringlen($e[3])-2)
    $time=stringsplit(stringstripws($otim, 7), ":")
    if $time[0]==1 then
        $hour=@HOUR
        $min=$time[1]+@MIN
        if stringright($otim, 2)==" s" then
            $min=$time[1]+1
            endif
        else
        $hour=$time[1]+@HOUR
        $min=$time[2]+@MIN
        endif
    $star=""
    while $min>59
        $hour+=1
        $min-=60
    wend
    while $hour>23
        $hour-=24
        $star&="*"
    wend
    $time=$otim&"|"&$star&$hour&":"&stringformat("%02i", $min)
    $item[$i][0]=stringleft($t, 15)
    $item[$i][1]=$bytes
    $item[$i][2]=$speed
    if ($speed+0)>$item[$i][3] then
        $item[$i][3]=$speed
        endif
    $item[$i][4]=$time
    else
    $time=""
    endif
next

$i=""
for $a=1 to $count
for $b=0 to 4
$i&=stringstripws($item[$a][$b], 7)&"|"
next
$i=stringtrimright($i, 1)&chr(13)
next
guictrlsetdata($list, $i)
winmove($me, "", 0, 0, 800, $count*40)
endfunc

func onoff()
global $me
if bitand(wingetstate($me, ""), 2) then
    winsetstate($me, "", @SW_HIDE)
    else
    winsetstate($me, "", @SW_SHOW)
    endif
endfunc

Láng Attila D., http://LAttilaD.org


Láng Attila D., LAttilaD.org

Share this post


Link to post
Share on other sites



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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0