Cronometro 2

« Older   Newer »
  Share  
Aaly
CAT_IMG Posted on 10/5/2010, 14:22     +1   -1




Ho visto quello fatto da dragon e mi sono ricordato che ne avevo anche io uno da qualche parte xD
(lo posto perchè non so che fare)
con il tasto INS si mostra/nasconde la GUI così non occupa spazio nel desktop

Eseguibile

Set.au3
SPOILER (click to view)
CODICE
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

$a = @DesktopHeight - 190
$b = @DesktopWidth - 476

$Form1 = GUICreate("Set", 156, 156, $b, $a, 0x00000000)
$ore = GUICtrlCreateInput("ore", 8, 8, 129, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_NUMBER,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$minuti = GUICtrlCreateInput("minuti", 8, 39, 129, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_NUMBER,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$sec = GUICtrlCreateInput("secondi", 8, 69, 129, 21, BitOR($ES_CENTER,$ES_AUTOHSCROLL,$ES_NUMBER,$WS_BORDER,$WS_CLIPSIBLINGS), BitOR($WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
$Button1 = GUICtrlCreateButton("Parti", 8, 96, 131, 20)

GUISetState(@SW_SHOW)


While 1
       $nMsg = GUIGetMsg()
       Switch $nMsg
               Case $GUI_EVENT_CLOSE
                       If ProcessExists("UnderTime v3.exe") Then _RebHot()
                       Exit

               Case $Button1
                       IniWrite(@ScriptDir & "\Set.ini","SET","ore",GUICtrlRead($ore))
                       IniWrite(@ScriptDir & "\Set.ini","SET","min",GUICtrlRead($minuti))
                       IniWrite(@ScriptDir & "\Set.ini","SET","sec",GUICtrlRead($sec))
                               If ProcessExists("UnderTime v3.exe") Then _RebHot()
                       Exit



       EndSwitch
WEnd


UnderTime.au3
SPOILER (click to view)
CODICE
Func ins()
       If $show = True Then
               GUISetState(@SW_HIDE)
               $show = False
       ElseIf $show = False Then
               GUISetState(@SW_SHOW)
               $show = True
       EndIf
EndFunc   ;==>ins

Func _Exit()
       FileDelete(@ScriptDir & "\Set.exe")
       FileDelete(@ScriptDir & "\$temp.bat")
Exit
EndFunc

; Script Start - Add your code below here

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Timers.au3>


$a = @DesktopHeight - 170
$b = @DesktopWidth - 320
$show = False

$Form1 = GUICreate("UnderTime v3", 320, 136, $b, $a, 0x00000000)


$Button1 = GUICtrlCreateButton("", 8, 72, 19, 25, $WS_GROUP)
       GUICtrlSetTip(-1, "Imposta")
$Button2 = GUICtrlCreateButton("", 32, 72, 19, 25, $WS_GROUP)
       GUICtrlSetTip(-1, "Start")
$Button3 = GUICtrlCreateButton("", 56, 72, 19, 25, $WS_GROUP)
       GUICtrlSetTip(-1, "Ferma")
$Button4 = GUICtrlCreateButton("", 80, 72, 19, 25, $WS_GROUP)
       GUICtrlSetTip(-1, "Reset")

$Label2 = GUICtrlCreateLabel("ALT + SPACE per chiudere", 104, 80, 200, 17, $SS_CENTER)
$Label1 = GUICtrlCreateLabel("0h : 0m : 0s", 8, 16, 299, 49, BitOR($SS_CENTER, $SS_CENTERIMAGE, $WS_BORDER, $WS_CLIPSIBLINGS), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE, $GUI_WS_EX_PARENTDRAG))
GUICtrlSetFont(-1, 18, 800, 0, "MS Sans Serif")

GUISetState(@SW_SHOW)

$state         = True
$go                = False
$start         = False
$tmp         = True
$ore = ""
$min = ""
$sec = ""

$h                 = 0
$m                 = 0
$ss         = 0
$re         = 0
$timeS        = 0




While 1
HotKeySet("{INSERT}", "ins")
HotKeySet("!{SPACE}", "_Exit")


       If $state = True Then
               $ini = _Timer_Init()
               $state = False
       EndIf
       $return = _Timer_Diff($ini)
       If $return >= 1000 Then

               If FileExists(@ScriptDir & "\Set.ini") And $go = False Then
                       $ore = IniRead(@ScriptDir & "\Set.ini", "SET", "ore", 0)
                       $min = IniRead(@ScriptDir & "\Set.ini", "SET", "min", 0)
                       $sec = IniRead(@ScriptDir & "\Set.ini", "SET", "sec", 0)
                       GUICtrlSetData($Label1, $ore & "h : " & $min & "m : " & $sec & "s")
                       $go = True
               EndIf

               If $start = True Then

                       If $go = True Then
                               If $ore = 0 And $min = 0 And $sec = 0 Then
                                       MsgBox(0, "", "Tempo scaduto.")
                                       Exit
                               ElseIf $sec = 0 And $min <> 0 Then
                                       $min -= 1
                                       $sec = 60
                               ElseIf $min = 0 And $sec = 0 Then
                                       $ore -= 1
                                       $min = 59
                                       $sec = 60


                               EndIf

If $tmp = True Then
       $re += 1
       GUICtrlSetData($Label2,"Tempo trascorso: " & $h&"h" & " : " & $m&"m" & " : " & $re&"s")
If $ss = 59 Then
       $m += 1

EndIf
If $m = 59 Then $h += 1
               $tmp = True
EndIf




                               $sec -= 1
                               GUICtrlSetData($Label1, $ore & "h : " & $min & "m : " & $sec & "s")
                       EndIf


                       $state = True
               EndIf
       EndIf





       $nMsg = GUIGetMsg()
       Switch $nMsg

               Case $GUI_EVENT_CLOSE
                       FileDelete(@ScriptDir & "\Set.exe")
                       FileDelete(@ScriptDir & "\$temp.bat")
                       Exit

               Case $Button1 ; IMPOSTA
                       FileInstall("Set.exe",@ScriptDir & "\Set.exe")
                       ShellExecute(@ScriptDir & "\Set.exe")
                               While 1
                                       If ProcessExists("Set.exe") Then
                                               ;....
                                       Else
                                               Sleep(500)
                                               FileDelete(@ScriptDir & "\Set.exe")
                                               FileDelete(@ScriptDir & "\$temp.bat")
                                               ExitLoop
                                       EndIf
                               WEnd



               Case $Button2 ; START
                       $start = True
                       $re = $timeS
                       $tmp   = True

               Case $Button3 ; FERMA
                       $timeS = $re
                       $start = False
                       $tmp   = False


               Case $Button4 ; RESET
                       $start = False
                       $tmp   = False
                       $timeS = 0

                       $ore = IniRead(@ScriptDir & "\Set.ini", "SET", "ore", 0)
                       $min = IniRead(@ScriptDir & "\Set.ini", "SET", "min", 0)
                       $sec = IniRead(@ScriptDir & "\Set.ini", "SET", "sec", 0)
                       GUICtrlSetData($Label2,"Tempo trascorso: " & $h&"h" & " : " & $m&"m" & " : " & $timeS&"s")
                       GUICtrlSetData($Label1, $ore & "h : " & $min & "m : " & $sec & "s")




       EndSwitch
WEnd
 
Top
lollofieretto
CAT_IMG Posted on 10/5/2010, 15:24     +1   -1




molto molto carino... quanto riguarda l'uso perfetto..

grafica carina
ma nn si chiude con ALT + SPACE a me agi altri non so...
io non lo guardo ma credo ci sia un errore
 
Top
Aaly
CAT_IMG Posted on 10/5/2010, 15:33     +1   -1




A me funziona benissimo.
Sei sicuro di premerli bene? xDDD
 
Top
lollofieretto
CAT_IMG Posted on 10/5/2010, 15:45     +1   -1




SI LOL =)... mmagari non so nn funziona l'alt =)
 
Top
Aaly
CAT_IMG Posted on 10/5/2010, 16:10     +1   -1




xD forse ^^
 
Top
4 replies since 10/5/2010, 14:22   186 views
  Share