Sign in to follow this  
Followers 0
GodlessSinner

Timer v1.0 Dark SensoRed

1 post in this topic

#1 ·  Posted (edited)

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile_type=a3x
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Res_Fileversion=1.0.0.0
#AutoIt3Wrapper_Res_LegalCopyright= powered by Godless, 2009-2010, www.vgtulz.com.ua
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include "Misc.au3"
$run = _Singleton(@ScriptName,1)
If $run = 0 Then
Exit
EndIf

#include <Process.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <sendmessage.au3>
HotKeySet("+!x", "WinHide")  ;Shift-Alt-x

;_GUICtrl_SetOnHover Global Variables
Global $aHOVER_CONTROLS_ARRAY[1][1]
Global $aLAST_HOVERED_ELEMENT[2]    = [-1, -1]
Global $aLAST_HOVERED_ELEMENT_MARK  = -1
Global $hLAST_CLICKED_ELEMENT_MARK  = -1
Global $pTimerProc                  = 0
Global $uiTimer                     = 0



Global $st[20], $trimmed = 0, $alltrimmed = 0, $stout = "", $iS, $iS1 = -1, $secunda = 0, $current = -1, $afftermin = -1


Global $w[10],$z[10], $hd[10],$i = 0, $ownhandle, $temp,$starttime, $detect = 0,$tstarded, $sec, $Sec1, $timerstarted = 0,$starttime, $clicked = 0, $adlib = False
Global $Skruto = 0
For $i = 1 To 9 Step 1
    $w[$i] = -1
    $hd[$i] = -1
    $z[$i] = -1
Next

Global $on,$tip = 1
;-------------MouseWheel--------------

If Not IsDeclared('WM_MOUSEWHEEL') Then Global Const $WM_MOUSEWHEEL = 0x020A
Global Const $tagMSLLHOOKSTRUCT = _
    $tagPOINT & _
    ';uint mouseData;' & _
    'uint flags;' & _
    'uint time;' & _
    'ulong_ptr dwExtraInfo;'

Global $hFunc, $pFunc
Global $hHook, $hMod
Global $iCounter = 0 ; The variable in question.

$hFunc = DllCallbackRegister('_MouseProc', 'lresult', 'int;int;int')
$pFunc = DllCallbackGetPtr($hFunc)
$hMod = _WinAPI_GetModuleHandle(0)

$hHook = _WinAPI_SetWindowsHookEx($WH_MOUSE_LL, $pFunc, $hMod)

;------------------------MouseWheel----------

Global $m[5], $h[5], $t[9], $str[9]
Global $cnt = 1, $cn = 1, $Splitted[7]
Opt("TrayMenuMode",1)
$showit = TrayCreateMenu("Show")
TrayCreateItem("")
$about = TrayCreateItem("About...")
TrayCreateItem("")
$exititem = TrayCreateItem("Exit")

TraySetClick (16)

Global $StartIsClicked  = False
Global $tim =0, $iSec,$iSec1,$started = 0, $control, $Type, $string, $edit = 0, $StartDisable = 0, $shown = 1, $downloading = False, $Time = "00:00:00", $data = "00:00:00"
#Region ### START Koda GUI section ### Form=C:\Users\Godless\Desktop\skin.kxf
$Form = GUICreate("Timer", 260, 99, 542, 678, BitOR($WS_POPUP,$WS_BORDER))
$sel1 = GUICtrlCreatePic(@ScriptDir &"\img\select0.jpg", 25, 20, 45, 7, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))


$t[1] = GUICtrlCreatePic(@ScriptDir & "\img\0.jpg", 25, 30, 20, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$sel2 = GUICtrlCreatePic(@ScriptDir & "\img\select0.jpg", 25, 60, 45, 7, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$t[2] = GUICtrlCreatePic(@ScriptDir & "\img\0.jpg", 45, 30, 20, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$t[3] = GUICtrlCreatePic(@ScriptDir & "\img\sep.jpg", 65, 30, 20, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$sel3 = GUICtrlCreatePic(@ScriptDir & "\img\select0.jpg", 85, 20, 45, 7, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$t[4] = GUICtrlCreatePic(@ScriptDir & "\img\0.jpg", 85, 30, 20, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$sel4 = GUICtrlCreatePic(@ScriptDir & "\img\select0.jpg", 85, 60, 45, 7, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

$t[5] = GUICtrlCreatePic(@ScriptDir & "\img\0.jpg", 105, 30, 20, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$t[6] = GUICtrlCreatePic(@ScriptDir & "\img\sep.jpg", 125, 30, 20, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$t[7] = GUICtrlCreatePic(@ScriptDir & "\img\0.jpg", 145, 30, 20, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$t[8] = GUICtrlCreatePic(@ScriptDir & "\img\0.jpg", 165, 30, 20, 30, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))

For $j = 1 To 5 Step 1
_GUICtrl_SetOnHover($t[$j], "_Hover_Proc", "_Leave_Hover_Proc", "PrimaryDown_Proc", "PrimaryUp_Proc")
    Next

GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")
$Pic = GUICtrlCreatePic(@ScriptDir & "\img\St.jpg", 192, 18, 50, 50, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
_GUICtrl_SetOnHover(-1, "_Hover_Proc", "_Leave_Hover_Proc", "PrimaryDown_Proc", "PrimaryUp_Proc")
GUICtrlSetCursor (-1, 0)
GUICtrlSetTip(-1,"Start")
;DOWN:::::::::::
For $i = 24 To 144 Step 40
$m[$cnt] = GUICtrlCreatePic(@ScriptDir & "\img\" & "sv.jpg", $i, 67, 33, 17, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
_GUICtrl_SetOnHover(-1, "_Hover_Proc", "_Leave_Hover_Proc", "PrimaryDown_Proc", "PrimaryUp_Proc")
GUICtrlSetCursor (-1, 0)
$cnt +=1
Next
;::::::::::::::::::::;

$hide = GUICtrlCreatePic(@ScriptDir & "\img\h.jpg", 238, 24, 15, 40, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetCursor (-1, 0)
_GUICtrl_SetOnHover(-1, "_Hover_Proc", "_Leave_Hover_Proc", "PrimaryDown_Proc", "PrimaryUp_Proc")
GUICtrlSetTip(-1,"Hide")
$AfterDownload = GUICtrlCreatePic(@ScriptDir & "\img\sv.jpg", 192, 67, 60, 15, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetCursor (-1, 0)
_GUICtrl_SetOnHover(-1, "_Hover_Proc", "_Leave_Hover_Proc", "PrimaryDown_Proc", "PrimaryUp_Proc")
GUICtrlSetTip(-1,"Shutdown PC after files downloading")

$Offch = GUICtrlCreatePic(@ScriptDir & "\img\sv.jpg", 192, 5, 60, 15, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetCursor (-1, 0)
GUICtrlSetTip(-1,"Right click to select and show previously hidden windows")
_GUICtrl_SetOnHover(-1, "_Hover_Proc", "_Leave_Hover_Proc", "PrimaryDown_Proc", "PrimaryUp_Proc")
$context = GUICtrlCreateContextMenu($Offch)
$MenuItem1 = GUICtrlCreateMenu("Show", $context)
;TOP::::::::
For $i = 24 To 144 Step 40
$h[$cn] = GUICtrlCreatePic(@ScriptDir & "\img\" & "sv.jpg", $i, 5, 33, 17, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
_GUICtrl_SetOnHover(-1, "_Hover_Proc", "_Leave_Hover_Proc", "PrimaryDown_Proc", "PrimaryUp_Proc")
GUICtrlSetCursor (-1, 0)
$cn +=1
Next
;:::::::::::::


$Pic2 = GUICtrlCreatePic(@ScriptDir & "\img\1.jpg", 0, 0, 260, 99, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetImage(-1, @ScriptDir & "\img\fon1.jpg")
$ownhandle = WinGetHandle($Form, "")
$Form1 = GUICreate("About", 240, 127, 500, 500, BitOR($WS_SYSMENU, $WS_CAPTION, $WS_POPUP, $WS_POPUPWINDOW, $WS_BORDER, $WS_CLIPSIBLINGS))
GUISetState(@SW_HIDE, $Form1)
WinSetOnTop ($Form, "", 1)
GUISetState(@SW_SHOW, $Form)

;WinActivate($Form)
#EndRegion ### END Koda GUI section ###

While 1
    ;If Not $StartIsClicked Then Sleep(100)
    $nMsg = GUIGetMsg(1)
    $msg = TrayGetMsg()

    Switch $msg
        Case $about
            GUISetState(@SW_DISABLE, $Form)
            WinSetOnTop($Form, "", 0)
            GUISetState(@SW_SHOW, $Form1)
            WinSetOnTop($Form1, "", 1)
        Case $TRAY_EVENT_PRIMARYDOWN
            $adlib = True
            AdlibEnable('_Adlib', 200)
        Case $TRAY_EVENT_PRIMARYDOUBLE
            If $adlib = True Then
                AdlibDisable()
            If $downloading = True Then
                Hovered($AfterDownload,"")
                $downloading = False
                $current = -1
                $afftermin = -1
            ElseIf $downloading = False And @IPAddress1 <> "127.0.0.1" Then
                $current = -1
                $afftermin = -1
                Hovered($AfterDownload,"3")
                $downloading = True
                If $StartIsClicked Then
                    $StartIsClicked = False
                EndIf
            EndIf
                ;ConsoleWrite("Double!" & @CR)
            EndIf
        Case $exititem
            _Close()
        Case Else
            For $i = 1 To 9
                If $msg = $z[$i] Then
                    DeleteMenuItem($i)
                    ExitLoop
                EndIf
            Next
    EndSwitch

    Switch $nMsg[0]
        Case $GUI_EVENT_CLOSE
            If $nMsg[1] = $Form1 Then
                WinSetOnTop($Form, "", 1)
                GUISetState(@SW_HIDE, $Form1)
                GUISetState(@SW_ENABLE, $Form)
                WinSetOnTop($Form, "", 1)
            ElseIf $nMsg[1] = $Form Then
                _Close()
            EndIf
        Case $GUI_EVENT_PRIMARYDOWN
        ;Sleep(10)
            If BitAND(WinGetState($Form1), 2) <> 2 Then _SendMessage($Form, $WM_SYSCOMMAND, 0xF012, 0)
        Case $hide
            GUISetState(@SW_HIDE)
            $shown = 0
        Case Else
            For $i = 1 To 9
                If $nMsg[0] = $w[$i] Then
                    DeleteMenuItem($i)
                    ExitLoop
                EndIf
            Next
EndSwitch

If $downloading Then
        $iS = @SEC
        If $iS <> $iS1 Then
            $iS1 = $iS
            $secunda+=1
            If $secunda = 5 Then
                $secunda = 0
                get_info()

                If $current <> -1 And $afftermin <> -1 Then
                    if $afftermin - $current < 50240 Then
                        timeout()
                    Else
                        $current = -1
                        $afftermin = -1
                    EndIf
                EndIf
            EndIf
        EndIf
EndIf


If $StartIsClicked Then
        $iSec = @SEC
        If $iSec <> $iSec1 Then
            $iSec1 = $iSec
            $Tleft = StringSplit($Time, ":")
            If $Tleft[1]=0 And $Tleft[2]=0 And $Tleft[3] =0 Then
                Timeout()
            EndIf

            If $Tleft[3]<>0 Then
                    if $Tleft[3]-1 < 10 Then
                        $data = ($Tleft[1] & ":" & $Tleft[2] & ":0" & $Tleft[3]-1)
                        $Time = $data
                        Timeset($data)
                    Else
                        $data = ($Tleft[1] & ":" & $Tleft[2] & ":" & $Tleft[3] -1)
                        $Time = $data
                        Timeset($data)
                    EndIf
                ElseIf $Tleft[3]=0 And $Tleft[2]<>0 Then
                    if $Tleft[2]-1 < 10 Then
                        $data = ($Tleft[1] & ":0" & $Tleft[2]-1 & ":59")
                        $Time = $data
                        Timeset($data)
                    Else
                        $data = ($Tleft[1] & ":" & $Tleft[2]-1 & ":59")
                        $Time = $data
                        Timeset($data)
                    EndIf
                ElseIf  $Tleft[3]=0 And $Tleft[2]=0 And $Tleft[1]<>0 Then
                    if $Tleft[1]-1 < 10 Then
                    $data = ("0" & $Tleft[1]-1 & ":59:59")
                        $Time = $data
                        Timeset($data)
                    Else
                        $data = ($Tleft[1]-1 & ":59:59")
                        $Time = $data
                        Timeset($data)
                    EndIf
            EndIf
        EndIf
EndIf

WEnd


Func DeleteMenuItem($item)
    TrayItemDelete($z[$item])
    GUICtrlDelete($w[$item])
    WinSetState($hd[$item],"", @SW_SHOW)
    $Skruto -=1
    $w[$item] = -1
    $z[$item] = -1
    $hd[$item] = -1
    EndFunc


Func _Hover_Proc($iCtrlID)
    Switch $iCtrlID
        Case $h[1]
            Hovered($iCtrlID,"1")
        Case $h[2]
            Hovered($iCtrlID,"1")
        Case $h[3]
            Hovered($iCtrlID,"1")
        Case $h[4]
            Hovered($iCtrlID,"1")

        Case $m[1]
            Hovered($iCtrlID,"1")
        Case $m[2]
            Hovered($iCtrlID,"1")
        Case $m[3]
            Hovered($iCtrlID,"1")
        Case $m[4]
            Hovered($iCtrlID,"1")

        Case $Pic
            GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\st1.jpg"))
        Case $Offch
            GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\sv1.jpg"))
        Case $hide
            GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\h1.jpg"))

        Case $t[1]
            GUICtrlSetImage($sel1, (@ScriptDir & "\img\select.jpg"))
            GUICtrlSetImage($sel2, (@ScriptDir & "\img\select2.jpg"))
            $on = 1
        Case $t[2]
            GUICtrlSetImage($sel1, (@ScriptDir & "\img\select.jpg"))
            GUICtrlSetImage($sel2, (@ScriptDir & "\img\select2.jpg"))
            $on = 1
        Case $t[4]
            GUICtrlSetImage($sel3, (@ScriptDir & "\img\select.jpg"))
            GUICtrlSetImage($sel4, (@ScriptDir & "\img\select2.jpg"))
            $on = 2
        Case $t[5]
            GUICtrlSetImage($sel3, (@ScriptDir & "\img\select.jpg"))
            GUICtrlSetImage($sel4, (@ScriptDir & "\img\select2.jpg"))
            $on = 2

        Case $AfterDownload
            If $downloading Then
                GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\sv4.jpg"))
            Else
                GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\sv1.jpg"))
            EndIf

    EndSwitch
EndFunc

Func _Leave_Hover_Proc($iCtrlID)
    Switch $iCtrlID
        Case $h[1]
            Hovered($h[1],"")
        Case $h[2]
            Hovered($h[2],"")
        Case $h[3]
            Hovered($h[3],"")
        Case $h[4]
            Hovered($h[4],"")

        Case $m[1]
            Hovered($m[1],"")
        Case $m[2]
            Hovered($m[2],"")
        Case $m[3]
            Hovered($m[3],"")
        Case $m[4]
            Hovered($m[4],"")

        Case $Pic
            GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\st.jpg"))
        Case $Offch
            GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\sv.jpg"))
        Case $hide
            GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\h.jpg"))

        Case $t[1]
            GUICtrlSetImage($sel1, (@ScriptDir & "\img\select0.jpg"))
            GUICtrlSetImage($sel2, (@ScriptDir & "\img\select0.jpg"))
            $on = 0
        Case $t[2]
            GUICtrlSetImage($sel1, (@ScriptDir & "\img\select0.jpg"))
            GUICtrlSetImage($sel2, (@ScriptDir & "\img\select0.jpg"))
            $on = 0
        Case $t[4]
            GUICtrlSetImage($sel3, (@ScriptDir & "\img\select0.jpg"))
            GUICtrlSetImage($sel4, (@ScriptDir & "\img\select0.jpg"))
            $on = 0
        Case $t[5]
            GUICtrlSetImage($sel3, (@ScriptDir & "\img\select0.jpg"))
            GUICtrlSetImage($sel4, (@ScriptDir & "\img\select0.jpg"))
            $on = 0

        Case $AfterDownload
            If $downloading Then
                GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\sv3.jpg"))
            Else
                GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\sv.jpg"))
            EndIf
EndSwitch
EndFunc

Func PrimaryDown_Proc($iCtrlID)
    Switch $iCtrlID
        Case $h[1]
            Hovered($h[1],"2")
        Case $h[2]
            Hovered($h[2],"2")
        Case $h[3]
            Hovered($h[3],"2")
        Case $h[4]
            Hovered($h[4],"2")

        Case $m[1]
            Hovered($m[1],"2")
        Case $m[2]
            Hovered($m[2],"2")
        Case $m[3]
            Hovered($m[3],"2")
        Case $m[4]
            Hovered($m[4],"2")

        Case $Pic
            GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\st2.jpg"))
        Case $Offch
            Hovered($Offch,"2")
        Case $hide
            GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\h2.jpg"))

        Case $AfterDownload
            If $downloading Then
                GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\sv5.jpg"))
            Else
                GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\sv2.jpg"))
            EndIf

    EndSwitch
EndFunc

Func PrimaryUp_Proc($iCtrlID)
    Switch $iCtrlID
        Case $h[1]
            Hovered($h[1],"1")
            $data = "01:00:00"
            $Time = $data
            Timeset($data)
        Case $h[2]
            Hovered($h[2],"1")
            $data = "02:00:00"
            $Time = $data
            Timeset($data)
        Case $h[3]
            Hovered($h[3],"1")
            $data = "03:00:00"
            $Time = $data
            Timeset($data)
        Case $h[4]
            Hovered($h[4],"1")
            $data = "04:00:00"
            $Time = $data
            Timeset($data)
        Case $m[1]
            Hovered($m[1],"1")
            Plus1()

        Case $m[2]
            Hovered($m[2],"1")
            Minus1()

        Case $m[3]
            Hovered($m[3],"1")
            Plus10()

        Case $m[4]
            Hovered($m[4],"1")
            Minus10()
        Case $Pic
            GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\st1.jpg"))

            If $StartIsClicked = 0 Then
                Hovered($AfterDownload,"")
                $downloading = False
                GUICtrlSetTip($Pic,"Stop")
                $StartIsClicked = 1
            Else
                GUICtrlSetTip($Pic,"Start")
                $StartIsClicked = 0
                EndIf
        Case $Offch
            Hovered($Offch,"1")
            If $detect = 0 Then
            $detect = 1
            Else
                $detect = 0
            EndIf
        Case $hide
            GUICtrlSetImage($iCtrlID, (@ScriptDir & "\img\h1.jpg"))

        Case $AfterDownload
            If $downloading = True Then
                Hovered($AfterDownload,"")
                $current = -1
                $afftermin = -1
                $downloading = False
            ElseIf $downloading = False And @IPAddress1 <> "127.0.0.1" Then
                $current = -1
                $afftermin = -1
                Hovered($AfterDownload,"3")
                $downloading = True
                If $StartIsClicked Then
                    $StartIsClicked = False
                EndIf
            EndIf

    EndSwitch
EndFunc

Func Timeout()
    $StartIsClicked = False
        If $downloading Then
            Hovered($AfterDownload,"")
            $downloading = False
        EndIf
        If MsgBox(4,"Confirm action or cancel it","Computer will be turned off in 5 seconds!",5) = 6 Then
            ;MsgBox(0,"","Timeout")
        Else
            ;MsgBox(0,"","Canceled")
            Shutdown(9)
        EndIf

EndFunc

Func settime($zero)
    $data =($zero & $Splitted[1]-1 &":" & $Splitted[2]+50 & ":" & $Splitted[3])
    $Time = $data
    Timeset($data)
    EndFunc
Func split()
     $Splitted = StringSplit($Time, ":")
    EndFunc

Func _Adlib()
    AdlibDisable()
    ;ConsoleWrite("Single" & @CR)
    $adlib = False
                If $shown = 0 Then
                $shown = 1
                Timeset($data)
                WinActivate($Form)
                GUISetState(@SW_SHOW)
            Else
                GUISetState(@SW_HIDE)
                WinActivate($Form)
                $shown = 0
            EndIf
EndFunc

Func Timeset($data)
    If $shown = 1 Then
    $str = StringSplit($data,"")
    For $i = 1 To 8 Step 1
        If $i <> 3 And $i <> 6 Then
            GUICtrlSetImage($t[$i], (@ScriptDir & "\img\" & $str[$i] & ".jpg"))
            EndIf
        Next
    EndIf
    EndFunc
Func Plus1()
            split()
            If $Splitted[1] < "23" Then
                If $Splitted[1]+1 < 10 Then
                    $data = ("0" & $Splitted[1]+1 & ":" & $Splitted[2] & ":" & $Splitted[3])
                    $Time = $data
                    Timeset($data)
                Else
                    $data = ($Splitted[1]+1 &":" & $Splitted[2] & ":" & $Splitted[3])
                    $Time = $data
                    Timeset($data)
                EndIf
            EndIf
EndFunc

Func Minus1()
            split()
            If $Splitted[1] > 0 Then
                If $Splitted[1]-1 < 10 Then
                $data = ("0" & $Splitted[1]-1 & ":" & $Splitted[2] & ":" & $Splitted[3])
                $Time = $data
                Timeset($data)
            Else
                $data = ($Splitted[1]-1 & ":" & $Splitted[2] & ":" & $Splitted[3])
                $Time = $data
                Timeset($data)
                EndIf
            EndIf
EndFunc

Func Minus10()
            split()
            If $Splitted[1] <> 0 Or $Splitted[2] > 10 Then
            If ($Splitted[2]-10)<10 And ($Splitted[2]-10) > 0 Then
                    $data = ($Splitted[1] &":0" & $Splitted[2]-10 & ":" & $Splitted[3])
                    $Time = $data
                    Timeset($data)
            ElseIf $Splitted[2]-10 < 0 Then
                If $Splitted[1]-1 >= 0 Then
                    If $Splitted[1]-1 < 10 Then
                        $zero = 0
                        settime($zero)
                    Else
                        $zero = ""
                        settime($zero)
                    EndIf
                EndIf
            ElseIf $Splitted[2] >= 20 Then
                $data = ($Splitted[1] &":" & $Splitted[2]-10 & ":" & $Splitted[3])
                    $Time = $data
                    Timeset($data)
            Else
                $data = ($Splitted[1] &":0" & $Splitted[2]-10 & ":" & $Splitted[3])
                    $Time = $data
                    Timeset($data)
            EndIf
            EndIf

EndFunc

Func Plus10()
            split()
            If ($Splitted[2]+10)>59 Then
                If $Splitted[2]-50 < 10 And $Splitted[1] + 1  < 10  Then
                    $data = ("0" & $Splitted[1]+1 & ":0" & $Splitted[2]-50 & ":" & $Splitted[3])
                    $Time = $data
                    Timeset($data)
                ElseIf $Splitted[2]-50 < 10 And $Splitted[1] + 1  >= 10 And $Splitted[1] + 1 < 24 Then
                    $data = ($Splitted[1]+1 &":0" & $Splitted[2]-50 & ":" & $Splitted[3])
                    $Time = $data
                    Timeset($data)
                EndIf
            Else
                $data = ($Splitted[1] &":" & $Splitted[2]+10 & ":" & $Splitted[3])
                $Time = $data
                Timeset($data)
            EndIf

EndFunc

Func _MouseProc($iCode, $iwParam, $ilParam)
    Local $tMSLL, $iDelta
    If $iCode < 0 Then Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam)
    $tMSLL = DllStructCreate($tagMSLLHOOKSTRUCT, $ilParam)
    If $iwParam = $WM_MOUSEWHEEL Then
        $iDelta = BitShift(DllStructGetData($tMSLL, 'mouseData'), 16)
        If $iDelta < 0 Then
            If $on = 1 Then
            Minus1()
                ElseIf $on = 2 Then
            Minus10()
            EndIf
        Else
            If $on = 1 Then
            Plus1()
                ElseIf $on = 2 Then
            Plus10()
            EndIf
        EndIf
    EndIf

    Return _WinAPI_CallNextHookEx($hHook, $iCode, $iwParam, $ilParam)
EndFunc

Func _Close()
    For $i = 1 to 9 Step 1
        WinSetState($hd[$i],"", @SW_SHOW)
    Next
    Exit
    _WinAPI_UnhookWindowsHookEx($hHook)
    DllCallbackFree($hHook)
    Exit
EndFunc

;hiding wndws
Func WinHide()
            $handle = WinGetHandle("", "")
            If $handle <> $ownhandle And WinGetTitle($handle) <> "" And $Skruto < 9 Then
                $added = 0
                For $n = 1 To 9 Step 1
                        If $w[$n] = -1 And $z[$n] = -1 And $hd[$n] = -1 And $added = 0 Then
                                $w[$n] = GUICtrlCreateMenuItem(WinGetTitle($handle), $MenuItem1)
                                $z[$n] = TrayCreateItem(WinGetTitle($handle),$showit)
                                $hd[$n] = $handle
                                $added = 1
                                $Skruto +=1
                                WinSetState($hd[$n],"", @SW_HIDE)
                            $added = 1
                        EndIf
                Next
            EndIf
        EndFunc

Func Hovered($Which_button,$img)
    GUICtrlSetImage($Which_button, (@ScriptDir & "\img\sv" & $img & ".jpg"))
    EndFunc

;getting info about traffic----------
Func get_info()
    $cmd = Run(@comspec & " /c netstat -e", @SystemDir, @SW_HIDE,  $STDIN_CHILD & $STDOUT_CHILD)
    Sleep(500)
    $line = StdoutRead($cmd)
    $st = StringSplit($line,@CR)
    For $i = 1 to $st[0]-1 Step 2
        If $st[$i] <> "" And $i = 5 Then
            $strn = StringSplit($st[$i],"")
            $string = $st[$i]
            For $n = 1 to $strn[0] Step 1
                If StringIsDigit($strn[$n]) And $trimmed = 0 Then
                    $alltrimmed = 1
                    $stout = $stout & $strn[$n]
                ElseIf Not StringIsDigit($strn[$n]) And $alltrimmed = 1 Then
                    $trimmed = 1
                EndIf
            Next
            If $current = -1 And $afftermin = -1 Then
                $current = $stout
            ElseIf $current <> -1 And $afftermin = -1 Then
                $afftermin = $stout
            EndIf
                $stout = ""
                $trimmed = 0
                $alltrimmed = 0
        EndIf
    Next
    EndFunc




;;;;;;Onhover



Func _GUICtrl_SetOnHover($iCtrlID,$sHover_Func="",$sLeaveHover_Func=-1,$sPrimaryDownFunc=-1,$sPrimaryUpFunc=-1,$iKeepCallFunc=1)
    Local $hCtrlID = GUICtrlGetHandle($iCtrlID)

    If $pTimerProc = 0 Then
        $pTimerProc = DllCallbackRegister("__MAIN_CALLBACK_ONHOVER_PROC", "none", "hwnd;int;int;dword")

        $uiTimer = DllCall("user32.dll", "int", "SetTimer", "hwnd", 0, _
            "int", TimerInit(), "int", 10, "ptr", DllCallbackGetPtr($pTimerProc))

        If IsArray($uiTimer) Then $uiTimer = $uiTimer[0]
    EndIf

    ;UnSet Hovering for specified control (remove control id from hovering checking process)
    If $sHover_Func = "" Then
        Local $aHOVER_CONTROLS_Tmp[1][1]

        For $i = 1 To $aHOVER_CONTROLS_ARRAY[0][0]
            If $hCtrlID <> $aHOVER_CONTROLS_ARRAY[$i][0] Then
                $aHOVER_CONTROLS_Tmp[0][0] += 1
                ReDim $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]+1][6]

                $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]][0] = $aHOVER_CONTROLS_ARRAY[$i][0]
                $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]][1] = $aHOVER_CONTROLS_ARRAY[$i][1]
                $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]][2] = $aHOVER_CONTROLS_ARRAY[$i][2]
                $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]][3] = $aHOVER_CONTROLS_ARRAY[$i][3]
                $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]][4] = $aHOVER_CONTROLS_ARRAY[$i][4]
                $aHOVER_CONTROLS_Tmp[$aHOVER_CONTROLS_Tmp[0][0]][5] = $aHOVER_CONTROLS_ARRAY[$i][5]
            EndIf
        Next

        If $aHOVER_CONTROLS_Tmp[0][0] < 1 Then
            AutoItExit() ;Release the callbacks
        Else
            $aHOVER_CONTROLS_ARRAY = $aHOVER_CONTROLS_Tmp
        EndIf

        Return 1
    EndIf

    ;Check if the hovering process already handle the passed CtrlID, if so, just assign new values (functions)
    For $i = 1 To $aHOVER_CONTROLS_ARRAY[0][0]
        If $hCtrlID = $aHOVER_CONTROLS_ARRAY[$i][0] Then
            $aHOVER_CONTROLS_ARRAY[$i][0] = $hCtrlID
            $aHOVER_CONTROLS_ARRAY[$i][1] = $sHover_Func
            $aHOVER_CONTROLS_ARRAY[$i][2] = $sLeaveHover_Func
            $aHOVER_CONTROLS_ARRAY[$i][3] = $sPrimaryDownFunc
            $aHOVER_CONTROLS_ARRAY[$i][4] = $sPrimaryUpFunc
            $aHOVER_CONTROLS_ARRAY[$i][5] = $iKeepCallFunc

            Return 1
        EndIf
    Next

    $aHOVER_CONTROLS_ARRAY[0][0] += 1
    ReDim $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]+1][6]

    $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]][0] = $hCtrlID
    $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]][1] = $sHover_Func
    $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]][2] = $sLeaveHover_Func
    $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]][3] = $sPrimaryDownFunc
    $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]][4] = $sPrimaryUpFunc
    $aHOVER_CONTROLS_ARRAY[$aHOVER_CONTROLS_ARRAY[0][0]][5] = $iKeepCallFunc

    Return 1
EndFunc

;CallBack function to handle the hovering process
Func __MAIN_CALLBACK_ONHOVER_PROC($hWnd, $uiMsg, $idEvent, $dwTime)
    If $aHOVER_CONTROLS_ARRAY[0][0] < 1 Then Return

    Local $iControl_Hovered = _ControlGetHovered()
    Local $sCheck_LHE = $aLAST_HOVERED_ELEMENT[1]
    Local $iCheck_LCEM = $hLAST_CLICKED_ELEMENT_MARK
    Local $iCtrlID

    ;Leave Hovering Process and reset variables
    If Not $iControl_Hovered Or ($sCheck_LHE <> -1 And $iControl_Hovered <> $sCheck_LHE) Then
        If $aLAST_HOVERED_ELEMENT_MARK = -1 Then Return

        If $aLAST_HOVERED_ELEMENT[0] <> -1 Then
            $iCtrlID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $aLAST_HOVERED_ELEMENT[1])
            If IsArray($iCtrlID) Then $iCtrlID = $iCtrlID[0]

            Call($aLAST_HOVERED_ELEMENT[0], $iCtrlID, 2, $iControl_Hovered) ;2 is the indicator of OnLeavHover process
            If @error Then Call($aLAST_HOVERED_ELEMENT[0], $iCtrlID, 2)
            If @error Then Call($aLAST_HOVERED_ELEMENT[0], $iCtrlID)
            If @error Then Call($aLAST_HOVERED_ELEMENT[0])
        EndIf

        $aLAST_HOVERED_ELEMENT[0] = -1
        $aLAST_HOVERED_ELEMENT[1] = -1
        $aLAST_HOVERED_ELEMENT_MARK = -1
        $hLAST_CLICKED_ELEMENT_MARK = -1
    Else ;Hovering Process, Primary Down/Up handler, and set LAST_HOVERED_ELEMENT
        For $i = 1 To $aHOVER_CONTROLS_ARRAY[0][0]
            If $aHOVER_CONTROLS_ARRAY[$i][0] = $iControl_Hovered Then
                $iCtrlID = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $iControl_Hovered)
                If IsArray($iCtrlID) Then $iCtrlID = $iCtrlID[0]

                ;Primary Down/Up handler
                If ($aHOVER_CONTROLS_ARRAY[$i][3] <> "" Or $aHOVER_CONTROLS_ARRAY[$i][4] <> "") And _
                    ($iCheck_LCEM = -1 Or $iCheck_LCEM = $iControl_Hovered) Then

                    Local $aCursorInfo = GUIGetCursorInfo()

                    If IsArray($aCursorInfo) Then
                        ;Primary Down. Last condition is to Prevent/Allow multiple function call.
                        If $aCursorInfo[2] = 1 And $aHOVER_CONTROLS_ARRAY[$i][3] <> -1 And _
                            (($aHOVER_CONTROLS_ARRAY[$i][5] < 1 And $iCheck_LCEM <> $iControl_Hovered) Or _
                                $aHOVER_CONTROLS_ARRAY[$i][5] > 0) Then

                            Call($aHOVER_CONTROLS_ARRAY[$i][3], $iCtrlID)
                            If @error Then Call($aHOVER_CONTROLS_ARRAY[$i][3])

                            $hLAST_CLICKED_ELEMENT_MARK = $iControl_Hovered
                        ElseIf $aCursorInfo[2] = 0 And $aHOVER_CONTROLS_ARRAY[$i][4] <> -1 And _ ;Primary Up
                            $iCheck_LCEM = $iControl_Hovered Then

                            Call($aHOVER_CONTROLS_ARRAY[$i][4], $iCtrlID)
                            If @error Then Call($aHOVER_CONTROLS_ARRAY[$i][4])

                            $hLAST_CLICKED_ELEMENT_MARK = -1
                        EndIf
                    EndIf
                EndIf

                If $aLAST_HOVERED_ELEMENT_MARK = $aHOVER_CONTROLS_ARRAY[$i][0] Then ExitLoop
                $aLAST_HOVERED_ELEMENT_MARK = $aHOVER_CONTROLS_ARRAY[$i][0]

                Call($aHOVER_CONTROLS_ARRAY[$i][1], $iCtrlID, 1, 0) ;1 is the indicator of OnHover process
                If @error Then Call($aHOVER_CONTROLS_ARRAY[$i][1], $iCtrlID, 1)
                If @error Then Call($aHOVER_CONTROLS_ARRAY[$i][1], $iCtrlID)
                If @error Then Call($aHOVER_CONTROLS_ARRAY[$i][1])

                If $aHOVER_CONTROLS_ARRAY[$i][2] <> -1 Then
                    $aLAST_HOVERED_ELEMENT[0] = $aHOVER_CONTROLS_ARRAY[$i][2]
                    $aLAST_HOVERED_ELEMENT[1] = $iControl_Hovered
                EndIf

                ExitLoop
            EndIf
        Next
    EndIf
EndFunc

;Backwards compatibility function #1
Func GUICtrl_SetOnHover($iCtrlID, $sHover_Func="", $sLeaveHover_Func=-1, $sPrimaryDownFunc=-1, $sPrimaryUpFunc=-1, $iKeepCallFunc=1)
    _GUICtrl_SetOnHover($iCtrlID, $sHover_Func, $sLeaveHover_Func, $sPrimaryDownFunc, $sPrimaryUpFunc, $iKeepCallFunc)
EndFunc

;Backwards compatibility function #2
Func GUICtrlSetOnHover($iCtrlID, $sHover_Func="", $sLeaveHover_Func=-1, $sPrimaryDownFunc=-1, $sPrimaryUpFunc=-1, $iKeepCallFunc=1)
    _GUICtrl_SetOnHover($iCtrlID, $sHover_Func, $sLeaveHover_Func, $sPrimaryDownFunc, $sPrimaryUpFunc, $iKeepCallFunc)
EndFunc

;Backwards compatibility function #3
Func _GUICtrlSetOnHover($iCtrlID, $sHover_Func="", $sLeaveHover_Func=-1, $sPrimaryDownFunc=-1, $sPrimaryUpFunc=-1, $iKeepCallFunc=1)
    _GUICtrl_SetOnHover($iCtrlID, $sHover_Func, $sLeaveHover_Func, $sPrimaryDownFunc, $sPrimaryUpFunc, $iKeepCallFunc)
EndFunc

;Thanks to amel27 for that one!!!
Func _ControlGetHovered()
    Local $Old_Opt_MCM = Opt("MouseCoordMode", 1)

    Local $aRet = DllCall("User32.dll", "int", "WindowFromPoint", _
        "long", MouseGetPos(0), _
        "long", MouseGetPos(1))

    ;$aRet = DllCall("user32.dll", "int", "GetDlgCtrlID", "hwnd", $aRet[0])

    Opt("MouseCoordMode", $Old_Opt_MCM)

    Return $aRet[0]
EndFunc

;Release the CallBack resources
Func AutoItExit()
    ;If $pTimerProc > 0 Then
    DllCallbackFree($pTimerProc)
    ;If $uiTimer > 0 Then
    DllCall("user32.dll", "int", "KillTimer", "hwnd", 0, "int", $uiTimer)

    $pTimerProc = 0
    $uiTimer = 0
EndFunc

Can:

- automatically shutdown by setting timer or after files downloading.

[ to set timer, just move cursor on numbers and scroll up/down]

- Hide opened(active) windows by pressing Shift-Alt-x

Enjoy!

folder "img" must be in same directory with source.

img.zip

Edited by GodlessSinner

_____________________________________________________________________________

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