Sign in to follow this  
Followers 0
Klexen

_TimeToTicks help

18 posts in this topic

#1 ·  Posted (edited)

Okay I took the code from my program that relates to the Timer functions..

What I want to do is take the LunchTimer and BreakTimer and instead of counting up to user specified time. I want it to count down. I can't get it to work right. I also wanted to have the Timer displayed in 00:00:00 instead of 0:0:0 also tried doing a label, but I couldn't get that to work either.

Besides the timer, I have an Adlibenable function called "stoptimeout" that I want to work even while timers are going. But it seems you can only use one Adlibenable at a time. What could I do about this?

#include <Date.au3>
#include <GuiConstants.au3>

Dim $data_Location = @ScriptDir & "\Data\"
Dim $File_Location = @ScriptDir & "\Data\dellquicklaunch.ini"

Global $Secs, $Mins, $Hour, $Time
Global $CheckBreak = IniRead($File_Location, "Timers", "BreakTime", "")
Global $CheckLunch = IniRead($File_Location, "Timers", "LunchTime", "")

Const $ProgramVersion = "Super Launch 1.08"

DirGetSize($data_Location)
If @error = 1 Then
    DirCreate($data_Location)
EndIf

;-------Stops DellServ and DSN From Timing Out. Also closes start up files.-------
AdlibEnable("stoptimeout")

Func stoptimeout()
    Opt("WinTitleMatchMode", 1)
    If WinExists("Microsoft Internet Explorer", "Application timeout will occur in 10 minutes") Then
        ControlClick("Microsoft Internet Explorer", "", 1, "left", 1)
        ;_WinPrevious()
    EndIf
    If WinExists("Session time-out alert", "Your DSN session is about to time out.") Then
        ControlClick("Session time-out alert", "", 6, "left", 1)
        ;_WinPrevious()
    EndIf
    If WinExists("desktop.ini") Then WinClose("desktop.ini")
    If WinExists("Windows Script Host") Then WinClose("Windows Script Host")
    Sleep(10)
EndFunc   ;==>stoptimeout


;-------Creates the Main Gui-------
$GUI_Main = GUICreate($ProgramVersion, 225, 400)

;----Top Menu-----
$filemenu = GUICtrlCreateMenu("&File")
$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)

$ViewMenu = GUICtrlCreateMenu("&View")
$hotkeyitem = GUICtrlCreateMenuItem("Hot Keys", $ViewMenu)

$ToolsMenu = GUICtrlCreateMenu("&Tools")
$OptionsItem = GUICtrlCreateMenuItem("Options", $ToolsMenu)

$helpmenu = GUICtrlCreateMenu("&Help")
$infoitem = GUICtrlCreateMenuItem("About", $helpmenu)

;----Groups----
GUICtrlCreateGroup("Super Launch", 5, 3, 100, 275)
GUICtrlCreateGroup("Tools", 118, 3, 100, 275)

;----------Buttons Left Side---------;
GUICtrlCreateLabel("Check All", 13, 18, 50)
GUICtrlSetTip(-1, "Check box to right to" & @CRLF & "select or delselect all boxes.")

$CheckboxAll = GUICtrlCreateCheckbox("", 80, 15, 15)
GUICtrlSetTip(-1, "Check or Uncheck this box to" & @CRLF & "select or deselect all.")

$LaunchIDD1 = GUICtrlCreateButton("Soft Phone", 10, 35, 64)
$CheckboxIDD1 = GUICtrlCreateCheckbox("", 80, 38, 15)

$LaunchTimeStamp1 = GUICtrlCreateButton("Time Stamp", 10, 65, 64)
$CheckboxTimeStamp = GUICtrlCreateCheckbox("", 80, 65, 15)

$LaunchFusion1 = GUICtrlCreateButton("Fusion", 10, 95, 64)
$CheckboxFusion1 = GUICtrlCreateCheckbox("", 80, 95, 15)

$LaunchSDC = GUICtrlCreateButton("Super DC", 10, 125, 64)
$CheckboxSDC = GUICtrlCreateCheckbox("", 80, 125, 15)

$LaunchDSN1 = GUICtrlCreateButton("DSN", 10, 155, 64)
$CheckboxDSN1 = GUICtrlCreateCheckbox("", 80, 153, 15)

$LaunchDellserv1 = GUICtrlCreateButton("DellServ", 10, 185, 64)
$CheckboxDellserv1 = GUICtrlCreateCheckbox("", 80, 183, 15)

$LaunchWebOutlook = GUICtrlCreateButton("Outlook", 10, 215, 64)
$CheckboxWebOutlook = GUICtrlCreateCheckbox("", 80, 212, 15)

$LaunchAll = GUICtrlCreateButton("Start Launch", 10, 248, 90)
GUICtrlSetTip(-1, "Launch all selected items.")

;----------Buttons Right Side---------;
$LaunchProcessExplorer = GUICtrlCreateButton("Process Explorer", 125, 25, 85)
$SetRes = GUICtrlCreateButton("Set Resolution", 125, 55, 85)
$NotepadPlus = GUICtrlCreateButton("Notepad++", 125, 85, 85)
$LaunchNotepad = GUICtrlCreateButton("Notepad", 125, 115, 85)
$PasteCustomerScreen = GUICtrlCreateButton("Super Paste", 125, 145, 85)
$TimerStart = GUICtrlCreateButton("Start Timer",125, 305,85)
$TimerStop  = GUICtrlCreateButton("Stop Timer",125, 335,85)

;----Timer Group & Buttons at bottom----
GUICtrlCreateGroup("Timers", 5, 290, 213, 75)
$BreakTimer = GUICtrlCreateButton("Break Timer", 10, 305,85)
$LunchTimer = GUICtrlCreateButton("Lunch Timer", 10, 335,85)

;-------Tray-------
GUISetIcon("Super.ico")
TraySetIcon("Super.ico")
TraySetToolTip("Click to Restore or Minimize" & @CRLF & $ProgramVersion)

$Show = TrayCreateItem('Minimize')
TrayCreateItem("")
$exit = TrayCreateItem("Exit")
TraySetState()

GUISetState()

;-------Shows GUI and Controls-------
While 1
    $tmsg = TrayGetMsg()
    Switch $tmsg
        Case $Show
            If TrayItemGetText($Show) = 'Restore' Then
                GUISetState(@SW_SHOW, $GUI_Main)
                GUISetState(@SW_RESTORE, $GUI_Main)
                WinActivate($GUI_Main, '')
                TrayItemSetText($Show, 'Minimize')
            ElseIf TrayItemGetText($Show) = 'Minimize' Then
                GUISetState(@SW_HIDE, $GUI_Main)
                TrayItemSetText($Show, 'Restore')
            EndIf
        Case $exit
            CleanExit()
    EndSwitch
    $msg = GUIGetMsg()
    If $msg = $infoitem Then MsgBox(262208, "Super Launch  by   Jason ", "Please read the manual if you need any help!" & @CRLF & "" & @CRLF & "You can email me at Jason.@Etelecare.com for questions or to report bugs!      " & @CRLF & "" & @CRLF & _
            "I hope this program has been helpful." & @CRLF & "" & @CRLF & "I want to thank the following for beta testing:" & @CRLF & "" & @CRLF & "Guillermo Rodriguez AKA Josh" & @CRLF & "Justin Dean" & @CRLF & "Elias Tenopala" & @CRLF & "Jarod Hayes" & @CRLF & "Eric Haese" & @CRLF & "" & @CRLF & _
            "" & @CRLF & "A Special Thanks to:" & @CRLF & "Steven Wichers - For his awesome programming skills and tips and much more!" & @CRLF & "Robert Park       - For giving me time to work on this!" & @CRLF & "" & @CRLF & "", 60)
    If $msg = $hotkeyitem Then MsgBox(262208, "Hot Keys List", "These are the Hot Keys you have access to." & @CRLF & "" & @CRLF & "Numpad+     Increases transpareny" & @CRLF & "" & @CRLF & "Numpad-      Decreases transparency" & @CRLF & "" & @CRLF & _
            "Numpad/      Remove transparency" & @CRLF & "" & @CRLF & _
            "Numpad*      Full Transparency" & @CRLF & "" & @CRLF & "WinKey+S    Hide/Show Super Launch" & @CRLF & "" & @CRLF & "CTRL+END   Force program to Terminate" & @CRLF & "" & @CRLF & "{F3}              Paste to Customer" & @CRLF & "" & @CRLF & _
            "{F6}              Launch Original Notepad")
    If $msg = $OptionsItem Then MsgBox(0, "Coming Soon", "This feature will come soon." & @CRLF & "" & @CRLF & "This will allow you to turn functions on or off")
    If $msg = $exititem Then CleanExit()
    Switch $msg
        Case $GUI_EVENT_MINIMIZE
            GUISetState(@SW_HIDE, $GUI_Main)
            TrayItemSetText($Show, 'Restore')
        Case $GUI_EVENT_CLOSE
            CleanExit()
        Case $LaunchIDD1
            ;LaunchIDD()
        Case $LaunchTimeStamp1
            ;LaunchTimeStamp1()
        Case $LaunchFusion1
            ;LaunchFusion()
        Case $LaunchSDC
            ;LaunchSDC()
        Case $LaunchDSN1
            ;LaunchDSN1()
        Case $LaunchDellserv1
            ;LaunchDellserv()
        Case $LaunchWebOutlook
            ;LaunchWebOutlook()
        Case $LaunchAll
            ;LaunchAll()
        Case $SetRes
            ;ChangeRes()
        Case $LaunchProcessExplorer
            ;ProcessExplorer()
        Case $NotepadPlus
            ;LaunchNotepadplus()
        Case $PasteCustomerScreen
            ;SuperPaste()
        Case $LaunchNotepad
            ;LaunchNotepad()
        Case $TimerStart
            $timer2 = TimerInit()
            AdlibEnable("Timer", 50)
        Case $TimerStop
            StopTimer()
        Case $BreakTimer
            If $CheckBreak = "" Then CreateBreakTime()
            $BTstart = TimerInit()
            AdlibEnable("BreakTimer", 50)
        Case $LunchTimer
            If $CheckLunch = "" Then CreateLunchBreakTime()
            $LTstart = TimerInit()
            AdlibEnable("LunchTimer", 50)
        Case $CheckboxAll
            $ischeckall = GUICtrlRead($CheckboxAll)
            If $ischeckall = $GUI_CHECKED Then
                ;CheckAll()
            Else
                ;UnCheckAll()
            EndIf
        Case Else
            ;-------------;
    EndSwitch

WEnd


;-----Create Lunch Break Time-----
Func CreateLunchBreakTime()
    $SetLunchTime = InputBox("Break Time", "How Long is your Lunch in minutes?", "60", "", 100, 135)
    IniWrite($File_Location, "Timers", "LunchTime", $SetLunchTime)
EndFunc   ;==>CreateLunchBreakTime

;-----Create Break Time-----
Func CreateBreakTime()
    $SetBreakTime = InputBox("Break Time", "How Long is your Break in minutes?", "15", "", 100, 135)
    IniWrite($File_Location, "Timers", "BreakTime", $SetBreakTime)
EndFunc   ;==>CreateBreakTime

;----Timer------
Func Timer()
    _TicksToTime(Int(TimerDiff($timer2)), $Hour, $Mins, $Secs)
    Local $sTime = $Time  ; save current time to be able to test and avoid flicker..
    $Time = ToolTip($Hour & ":" & $Mins & ":" & $Secs)
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
    If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
EndFunc   ;==>Timer

;----Stop active timer and display time----
Func StopTimer()
    AdlibDisable()
    ToolTip("")
    AdlibEnable("stoptimeout")
    MsgBox(0,"Timer","Time elapsed: " & $Hour & ":" & $Mins & ":" & $Secs)
EndFunc

;----Break Timer------
Func BreakTimer()
    _TicksToTime(Int(TimerDiff($BTstart)), $Hour, $Mins, $Secs)
    Local $sTime = $Time 
    $mPos = MouseGetPos()
    $Time = ToolTip($Hour & ":" & $Mins & ":" & $Secs, $mPos[0] + 13, $mPos[1] + 17, "Break Timer")
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
    If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
    If $Mins = $CheckBreak - 5 And $Secs = 0 Then MsgBox(262208, "", "5 minutes remaining", 5)
    If $Mins = $CheckBreak - 1 And $Secs = 0 Then MsgBox(262208, "", "1 minute remaining." & @CRLF & "Please get ready to auto in!", 3)
    If $Mins = $CheckBreak And $Secs = 0 Then
        MsgBox(262208, "", "Break is up!." & @CRLF & "You should be logged in by now!")
        AdlibDisable()
        ToolTip("")
        AdlibEnable("stoptimeout")
    EndIf
EndFunc   ;==>BreakTimer

;----Timer------
Func LunchTimer()
    _TicksToTime(Int(TimerDiff($LTstart)), $Hour, $Mins, $Secs)
    Local $sTime = $Time 
    $mPos = MouseGetPos()
    $Time = ToolTip($Hour & ":" & $Mins & ":" & $Secs, $mPos[0] + 13, $mPos[1] + 17, "Lunch Timer")
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
    If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
    If $Mins = $CheckLunch - 5 And $Secs = 0 Then MsgBox(262208, "", "5 minutes remaining", 5)
    If $Mins = $CheckLunch - 1 And $Secs = 0 Then
        $LunchTimeStamp = MsgBox(4, "", "1 minute remaining." & @CRLF & "Would you like to launch Time Stamp?", 10)
        If $LunchTimeStamp = 6 Then
            ;LaunchTimeStamp1()
        Else
        EndIf
    EndIf
    If $Mins = $CheckLunch And $Secs = 0 Then
        MsgBox(262208, "", "Lunch is up!." & @CRLF & "You should be Time Stamped and logged in by now!")
        AdlibDisable()
        ToolTip("")
        AdlibEnable("stoptimeout")
    EndIf
EndFunc   ;==>LunchTimer

;-----Close Program-----
Func CleanExit()
    GUISetState(@SW_HIDE)
    Exit
EndFunc   ;==>CleanExit
Edited by Klexen

Share this post


Link to post
Share on other sites



What I want to do is take the LunchTimer and BreakTimer and instead of counting up to user specified time. I want it to count down. I can't get it to work right.

Way too much code to weed through. Isolate just that function into a SHORT demo script. That will make it easier to help you, and likely as not, you'll figure out the problem while doing it. I've solved several problems of my own why trying to get a simple demo going to show it to someone else.

I also wanted to have the Timer displayed in 00:00:00 instead of 0:0:0 also tried doing a label, but I couldn't get that to work either.

StringFormat() can make that change for you.

Besides the timer, I have an Adlibenable function called "stoptimeout" that I want to work even while timers are going. But it seems you can only use one Adlibenable at a time. What could I do about this?

It's true you can only have one AdLibEnable() running at a time, but the function you call with it can be a "dispatcher" that calls multiple other functions. Be careful that the total time taken for one AdLib'd call isn't very long. It should maybe change a few global variables and return as quickly as possible.

:whistle:


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Here is just the functions minus the GUI stuff.

Thanks!

;----Timer------
Func Timer()
    _TicksToTime(Int(TimerDiff($timer2)), $Hour, $Mins, $Secs)
    Local $sTime = $Time  ; save current time to be able to test and avoid flicker..
    $Time = ToolTip($Hour & ":" & $Mins & ":" & $Secs)
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
    If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
EndFunc   ;==>Timer

;----Stop active timer and display time----
Func StopTimer()
    AdlibDisable()
    ToolTip("")
    AdlibEnable("stoptimeout")
    MsgBox(0,"Timer","Time elapsed: " & $Hour & ":" & $Mins & ":" & $Secs)
EndFunc

;----Break Timer------
Func BreakTimer()
    _TicksToTime(Int(TimerDiff($BTstart)), $Hour, $Mins, $Secs)
    Local $sTime = $Time 
    $mPos = MouseGetPos()
    $Time = ToolTip($Hour & ":" & $Mins & ":" & $Secs, $mPos[0] + 13, $mPos[1] + 17, "Break Timer")
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
    If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
    If $Mins = $CheckBreak - 5 And $Secs = 0 Then MsgBox(262208, "", "5 minutes remaining", 5)
    If $Mins = $CheckBreak - 1 And $Secs = 0 Then MsgBox(262208, "", "1 minute remaining." & @CRLF & "Please get ready to auto in!", 3)
    If $Mins = $CheckBreak And $Secs = 0 Then
        MsgBox(262208, "", "Break is up!." & @CRLF & "You should be logged in by now!")
        AdlibDisable()
        ToolTip("")
        AdlibEnable("stoptimeout")
    EndIf
EndFunc   ;==>BreakTimer

;----Timer------
Func LunchTimer()
    _TicksToTime(Int(TimerDiff($LTstart)), $Hour, $Mins, $Secs)
    Local $sTime = $Time 
    $mPos = MouseGetPos()
    $Time = ToolTip($Hour & ":" & $Mins & ":" & $Secs, $mPos[0] + 13, $mPos[1] + 17, "Lunch Timer")
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
    If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
    If $Mins = $CheckLunch - 5 And $Secs = 0 Then MsgBox(262208, "", "5 minutes remaining", 5)
    If $Mins = $CheckLunch - 1 And $Secs = 0 Then
        $LunchTimeStamp = MsgBox(4, "", "1 minute remaining." & @CRLF & "Would you like to launch Time Stamp?", 10)
        If $LunchTimeStamp = 6 Then
            ;LaunchTimeStamp1()
        Else
        EndIf
    EndIf
    If $Mins = $CheckLunch And $Secs = 0 Then
        MsgBox(262208, "", "Lunch is up!." & @CRLF & "You should be Time Stamped and logged in by now!")
        AdlibDisable()
        ToolTip("")
        AdlibEnable("stoptimeout")
    EndIf
EndFunc   ;==>LunchTimer

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

This may not be the correct way to go about this and it took me ages to figure it out (I'm still not convinced!)

#include <Date.au3>
$break = 15;in mins
$break = $break * 60;break converted to seconds
$fin = _DateAdd("S",$break,_NowCalc());Finish time

Global $Hours,$Mins,$Secs
$Time2 = ""
Do 
_TicksToTime(1000 * _DateDiff("s",_NowCalc(),$Fin),$Hours,$mins,$Secs)
$Time = StringFormat("%02i:%02i:%02i", $Hours, $Mins, $Secs)
If $Time <> $Time2 then 
    ToolTip($Time,10,10)
    $Time2 = $Time
EndIf
Sleep(500)
Until _DateDiff("s",_NowCalc(),$Fin) <= 0

Edit: It cained the CPU Fixed code

Edited by ChrisL

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Ahhhhh Idiot!!!

#include <Date.au3>
$break = 15;in mins
$break = $break * 60 ;break converted to seconds
$break = $break * 1000;Milliseconds

Global $Hours,$Mins,$Secs
$Time2 = ""
$Timer = TimerInit()
Do 
    _TicksToTime(Int($break - TimerDiff($Timer)),$Hours,$mins,$Secs)
    $Time = StringFormat("%02i:%02i:%02i", $Hours, $Mins, $Secs)
    If $Time <> $Time2 then 
        ToolTip($Time,10,10)
        $Time2 = $Time
    EndIf
    Sleep(100)
Until TimerDiff($Timer) > $break
Edited by ChrisL

Share this post


Link to post
Share on other sites

Ahhhhh Idiot!!!

#include <Date.au3>
$break = 15;in mins
$break = $break * 60;break converted to seconds
$break = $break * 1000;Milliseconds

Global $Hours,$Mins,$Secs
$Time2 = ""
$Timer = TimerInit()
Do 
    _TicksToTime(Int($break - TimerDiff($Timer)),$Hours,$mins,$Secs)
    $Time = StringFormat("%02i:%02i:%02i", $Hours, $Mins, $Secs)
    If $Time <> $Time2 then 
        ToolTip($Time,10,10)
        $Time2 = $Time
    EndIf
    Sleep(100)
Until TimerDiff($Timer) > $break

When I use this funtion in place of what I use now, the tool tip won't move with my cursor, even when I added the code to do it. It would start the timer tooltip where my mouse is at the time, but won't move around. Is there a way to do this without using a Do Until, just use the adlibenable to update? That way my Stop timer button will work with it.

Thanks for all your help!

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

When I use this funtion in place of what I use now, the tool tip won't move with my cursor, even when I added the code to do it. It would start the timer tooltip where my mouse is at the time, but won't move around. Is there a way to do this without using a Do Until, just use the adlibenable to update? That way my Stop timer button will work with it.

Thanks for all your help!

I was just showing you the timer part I thought you had the tool tips sorted!

You'll have to fit this in with your script, I haven't really tried to work out what your doing as such just the timer.

:whistle:

$break = 15;in mins
$break = $break * 60 ;break converted to seconds
$break = $break * 1000;Milliseconds

Global $Hours,$Mins,$Secs

$Timer = TimerInit()

AdlibEnable("BreakTimer", 50)

While 1
    Sleep (100)
WEnd


Func BreakTimer()
    
    $pos = MouseGetPos( ) 
    _TicksToTime(Int($break - TimerDiff($Timer)),$Hours,$mins,$Secs)
    $Time = StringFormat("%02i:%02i:%02i", $Hours, $Mins, $Secs)
    ToolTip($Time,$pos[0]+5,$pos[1]+2)

EndFunc
Edited by ChrisL

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

There you go (Bored again), I had to change a few bits and your message box on stop timer didn't make any sence when counting backwards so I've commented it out

#include <Date.au3>
#include <GuiConstants.au3>

Dim $data_Location = @ScriptDir & "\Data\"
Dim $File_Location = @ScriptDir & "\Data\dellquicklaunch.ini"

Global $Secs, $Mins, $Hour, $Time
Global $CheckBreak = IniRead($File_Location, "Timers", "BreakTime", "")
Global $CheckLunch = IniRead($File_Location, "Timers", "LunchTime", "")

Const $ProgramVersion = "Super Launch 1.08"

DirGetSize($data_Location)
If @error = 1 Then
    DirCreate($data_Location)
EndIf

;-------Stops DellServ and DSN From Timing Out. Also closes start up files.-------
AdlibEnable("stoptimeout")

Func stoptimeout()
    Opt("WinTitleMatchMode", 1)
    If WinExists("Microsoft Internet Explorer", "Application timeout will occur in 10 minutes") Then
        ControlClick("Microsoft Internet Explorer", "", 1, "left", 1)
        ;_WinPrevious()
    EndIf
    If WinExists("Session time-out alert", "Your DSN session is about to time out.") Then
        ControlClick("Session time-out alert", "", 6, "left", 1)
        ;_WinPrevious()
    EndIf
    If WinExists("desktop.ini") Then WinClose("desktop.ini")
    If WinExists("Windows Script Host") Then WinClose("Windows Script Host")
    Sleep(10)
EndFunc   ;==>stoptimeout
;-------Creates the Main Gui-------
$GUI_Main = GUICreate($ProgramVersion, 225, 400)

;----Top Menu-----
$filemenu = GUICtrlCreateMenu("&File")
$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)

$ViewMenu = GUICtrlCreateMenu("&View")
$hotkeyitem = GUICtrlCreateMenuItem("Hot Keys", $ViewMenu)

$ToolsMenu = GUICtrlCreateMenu("&Tools")
$OptionsItem = GUICtrlCreateMenuItem("Options", $ToolsMenu)

$helpmenu = GUICtrlCreateMenu("&Help")
$infoitem = GUICtrlCreateMenuItem("About", $helpmenu)

;----Groups----
GUICtrlCreateGroup("Super Launch", 5, 3, 100, 275)
GUICtrlCreateGroup("Tools", 118, 3, 100, 275)

;----------Buttons Left Side---------;
GUICtrlCreateLabel("Check All", 13, 18, 50)
GUICtrlSetTip(-1, "Check box to right to" & @CRLF & "select or delselect all boxes.")

$CheckboxAll = GUICtrlCreateCheckbox("", 80, 15, 15)
GUICtrlSetTip(-1, "Check or Uncheck this box to" & @CRLF & "select or deselect all.")

$LaunchIDD1 = GUICtrlCreateButton("Soft Phone", 10, 35, 64)
$CheckboxIDD1 = GUICtrlCreateCheckbox("", 80, 38, 15)

$LaunchTimeStamp1 = GUICtrlCreateButton("Time Stamp", 10, 65, 64)
$CheckboxTimeStamp = GUICtrlCreateCheckbox("", 80, 65, 15)

$LaunchFusion1 = GUICtrlCreateButton("Fusion", 10, 95, 64)
$CheckboxFusion1 = GUICtrlCreateCheckbox("", 80, 95, 15)

$LaunchSDC = GUICtrlCreateButton("Super DC", 10, 125, 64)
$CheckboxSDC = GUICtrlCreateCheckbox("", 80, 125, 15)

$LaunchDSN1 = GUICtrlCreateButton("DSN", 10, 155, 64)
$CheckboxDSN1 = GUICtrlCreateCheckbox("", 80, 153, 15)

$LaunchDellserv1 = GUICtrlCreateButton("DellServ", 10, 185, 64)
$CheckboxDellserv1 = GUICtrlCreateCheckbox("", 80, 183, 15)

$LaunchWebOutlook = GUICtrlCreateButton("Outlook", 10, 215, 64)
$CheckboxWebOutlook = GUICtrlCreateCheckbox("", 80, 212, 15)

$LaunchAll = GUICtrlCreateButton("Start Launch", 10, 248, 90)
GUICtrlSetTip(-1, "Launch all selected items.")

;----------Buttons Right Side---------;
$LaunchProcessExplorer = GUICtrlCreateButton("Process Explorer", 125, 25, 85)
$SetRes = GUICtrlCreateButton("Set Resolution", 125, 55, 85)
$NotepadPlus = GUICtrlCreateButton("Notepad++", 125, 85, 85)
$LaunchNotepad = GUICtrlCreateButton("Notepad", 125, 115, 85)
$PasteCustomerScreen = GUICtrlCreateButton("Super Paste", 125, 145, 85)
$TimerStart = GUICtrlCreateButton("Start Timer",125, 305,85)
$TimerStop  = GUICtrlCreateButton("Stop Timer",125, 335,85)

;----Timer Group & Buttons at bottom----
GUICtrlCreateGroup("Timers", 5, 290, 213, 75)
$BreakTimer = GUICtrlCreateButton("Break Timer", 10, 305,85)
$LunchTimer = GUICtrlCreateButton("Lunch Timer", 10, 335,85)

$ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
GuiCtrlSetState($ticker,$Gui_hide)

;-------Tray-------
GUISetIcon("Super.ico")
TraySetIcon("Super.ico")
TraySetToolTip("Click to Restore or Minimize" & @CRLF & $ProgramVersion)

$Show = TrayCreateItem('Minimize')
TrayCreateItem("")
$exit = TrayCreateItem("Exit")
TraySetState()

GUISetState()

;-------Shows GUI and Controls-------
While 1
    $tmsg = TrayGetMsg()
    Switch $tmsg
        Case $Show
            If TrayItemGetText($Show) = 'Restore' Then
                GUISetState(@SW_SHOW, $GUI_Main)
                GUISetState(@SW_RESTORE, $GUI_Main)
                WinActivate($GUI_Main, '')
                TrayItemSetText($Show, 'Minimize')
            ElseIf TrayItemGetText($Show) = 'Minimize' Then
                GUISetState(@SW_HIDE, $GUI_Main)
                TrayItemSetText($Show, 'Restore')
            EndIf
        Case $exit
            CleanExit()
    EndSwitch
    $msg = GUIGetMsg()
    If $msg = $infoitem Then MsgBox(262208, "Super Launch  by   Jason Kingsley", "Please read the manual if you need any help!" & @CRLF & "" & @CRLF & "You can email me at Jason.Kingsley@Etelecare.com for questions or to report bugs!      " & @CRLF & "" & @CRLF & _
            "I hope this program has been helpful." & @CRLF & "" & @CRLF & "I want to thank the following for beta testing:" & @CRLF & "" & @CRLF & "Guillermo Rodriguez AKA Josh" & @CRLF & "Justin Dean" & @CRLF & "Elias Tenopala" & @CRLF & "Jarod Hayes" & @CRLF & "Eric Haese" & @CRLF & "" & @CRLF & _
            "" & @CRLF & "A Special Thanks to:" & @CRLF & "Steven Wichers - For his awesome programming skills and tips and much more!" & @CRLF & "Robert Park       - For giving me time to work on this!" & @CRLF & "" & @CRLF & "", 60)
    If $msg = $hotkeyitem Then MsgBox(262208, "Hot Keys List", "These are the Hot Keys you have access to." & @CRLF & "" & @CRLF & "Numpad+     Increases transpareny" & @CRLF & "" & @CRLF & "Numpad-      Decreases transparency" & @CRLF & "" & @CRLF & _
            "Numpad/      Remove transparency" & @CRLF & "" & @CRLF & _
            "Numpad*      Full Transparency" & @CRLF & "" & @CRLF & "WinKey+S    Hide/Show Super Launch" & @CRLF & "" & @CRLF & "CTRL+END   Force program to Terminate" & @CRLF & "" & @CRLF & "{F3}              Paste to Customer" & @CRLF & "" & @CRLF & _
            "{F6}              Launch Original Notepad")
    If $msg = $OptionsItem Then MsgBox(0, "Coming Soon", "This feature will come soon." & @CRLF & "" & @CRLF & "This will allow you to turn functions on or off")
    If $msg = $exititem Then CleanExit()
    Switch $msg
        Case $GUI_EVENT_MINIMIZE
            GUISetState(@SW_HIDE, $GUI_Main)
            TrayItemSetText($Show, 'Restore')
        Case $GUI_EVENT_CLOSE
            CleanExit()
        Case $LaunchIDD1
            ;LaunchIDD()
        Case $LaunchTimeStamp1
            ;LaunchTimeStamp1()
        Case $LaunchFusion1
            ;LaunchFusion()
        Case $LaunchSDC
            ;LaunchSDC()
        Case $LaunchDSN1
            ;LaunchDSN1()
        Case $LaunchDellserv1
            ;LaunchDellserv()
        Case $LaunchWebOutlook
            ;LaunchWebOutlook()
        Case $LaunchAll
            ;LaunchAll()
        Case $SetRes
            ;ChangeRes()
        Case $LaunchProcessExplorer
            ;ProcessExplorer()
        Case $NotepadPlus
            ;LaunchNotepadplus()
        Case $PasteCustomerScreen
            ;SuperPaste()
        Case $LaunchNotepad
            ;LaunchNotepad()
        Case $TimerStart
            $timer2 = TimerInit()
            AdlibEnable("Timer", 50)
        Case $TimerStop
            StopTimer()
        Case $BreakTimer
            If $CheckBreak = "" Then $CheckBreak = CreateBreakTime()
            $BTstart = TimerInit()
            AdlibEnable("BreakTimer", 50)
        Case $LunchTimer
            If $CheckLunch = "" Then $CheckLunch = CreateLunchBreakTime()
            $LTstart = TimerInit()
            AdlibEnable("LunchTimer", 50)
        Case $CheckboxAll
            $ischeckall = GUICtrlRead($CheckboxAll)
            If $ischeckall = $GUI_CHECKED Then
                ;CheckAll()
            Else
                ;UnCheckAll()
            EndIf
        Case Else
            ;-------------;
    EndSwitch

WEnd
;-----Create Lunch Break Time-----
Func CreateLunchBreakTime()
    $SetLunchTime = InputBox("Break Time", "How Long is your Lunch in minutes?", "60", "", 100, 135)
    IniWrite($File_Location, "Timers", "LunchTime", $SetLunchTime)
    Return $SetLunchTime
EndFunc   ;==>CreateLunchBreakTime

;-----Create Break Time-----
Func CreateBreakTime()
    $SetBreakTime = InputBox("Break Time", "How Long is your Break in minutes?", "15", "", 100, 135)
    IniWrite($File_Location, "Timers", "BreakTime", $SetBreakTime)
    Return $SetBreakTime
EndFunc   ;==>CreateBreakTime

;----Timer------
Func Timer()
    _TicksToTime(Int(TimerDiff($timer2)), $Hour, $Mins, $Secs)
    Local $sTime = $Time  ; save current time to be able to test and avoid flicker..
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $Time = ToolTip($TimeLabel)
    If BitAnd (GuiCtrlGetState($Ticker),$Gui_Hide) then GuiCtrlSetState($ticker,$Gui_Show)
    If GuiCtrlRead($ticker) <> $TimeLabel then GUICtrlSetData( $ticker, $TimeLabel)
    ;$ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
    If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
EndFunc   ;==>Timer

;----Stop active timer and display time----
Func StopTimer()
    AdlibDisable()
    GUICtrlSetData( $ticker, "00:00:00")
    GuiCtrlSetState($ticker,$Gui_hide)
    ToolTip("")
    AdlibEnable("stoptimeout")
    ;MsgBox(0,"Timer","Time elapsed: " & $Hour & ":" & $Mins & ":" & $Secs) Doesn't work using that method
EndFunc

;----Break Timer------
Func BreakTimer()
    _TicksToTime(Int(($CheckBreak *60 *1000) - TimerDiff($BTstart)), $Hour, $Mins, $Secs) ;change $CheckBreak to MIlliseconds
    Local $sTime = $Time 
    $mPos = MouseGetPos()
    $Time = ToolTip($Hour & ":" & $Mins & ":" & $Secs, $mPos[0] + 13, $mPos[1] + 17, "Break Timer")
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    ;$ticker = GUICtrlCreateLabel("00:00:00", 120, 200) need to put this int he guicreation not here
    If BitAnd (GuiCtrlGetState($Ticker),$Gui_Hide) then GuiCtrlSetState($ticker,$Gui_Show)
    If GuiCtrlRead($ticker) <> $TimeLabel then GUICtrlSetData( $ticker, $TimeLabel)
    ;If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
    ;If $Mins = $CheckBreak - 5 And $Secs = 0 Then MsgBox(262208, "", "5 minutes remaining", 5)
    ;If $Mins = $CheckBreak - 1 And $Secs = 0 Then MsgBox(262208, "", "1 minute remaining." & @CRLF & "Please get ready to auto in!", 3)
    If $TimeLabel = "00:00:00" Then
        MsgBox(262208, "", "Break is up!." & @CRLF & "You should be logged in by now!")
        GuiCtrlSetState($ticker,$Gui_hide)
        AdlibDisable()
        ToolTip("")
        AdlibEnable("stoptimeout")
    EndIf
EndFunc   ;==>BreakTimer

;----Timer------
Func LunchTimer()
    _TicksToTime(Int($CheckLunch * 60 * 1000 - TimerDiff($LTstart)), $Hour, $Mins, $Secs)
    Local $sTime = $Time 
    $mPos = MouseGetPos()
    
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $Time = ToolTip($TimeLabel, $mPos[0] + 13, $mPos[1] + 17, "Lunch Timer")
    ;$ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
    If BitAnd (GuiCtrlGetState($Ticker),$Gui_Hide) then GuiCtrlSetState($ticker,$Gui_Show)
    If GuiCtrlRead($ticker) <> $TimeLabel then GUICtrlSetData( $ticker, $TimeLabel)
    
    ;If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
    If $TimeLabel = "00:05:00" Then MsgBox(262208, "", "5 minutes remaining", 5)
    If $TimeLabel = "00:01:00" Then
        $LunchTimeStamp = MsgBox(4, "", "1 minute remaining." & @CRLF & "Would you like to launch Time Stamp?", 10)
        If $LunchTimeStamp = 6 Then
            ;LaunchTimeStamp1()
        Else
        EndIf
    EndIf
    If $TimeLabel = "00:00:00" Then
        MsgBox(262208, "", "Lunch is up!." & @CRLF & "You should be Time Stamped and logged in by now!")
        GuiCtrlSetState($ticker,$Gui_hide)
        AdlibDisable()
        ToolTip("")
        AdlibEnable("stoptimeout")
    EndIf
EndFunc   ;==>LunchTimer

;-----Close Program-----
Func CleanExit()
    GUISetState(@SW_HIDE)
    Exit
EndFunc   ;==>CleanExit

Edit: This only worked if the ini file already existed with values, I've changed it to return the valuse from the function for creating a break/lunch time

Edited by ChrisL

Share this post


Link to post
Share on other sites

There you go (Bored again), I had to change a few bits and your message box on stop timer didn't make any sence when counting backwards so I've commented it out

#include <Date.au3>
#include <GuiConstants.au3>

Dim $data_Location = @ScriptDir & "\Data\"
Dim $File_Location = @ScriptDir & "\Data\dellquicklaunch.ini"

Global $Secs, $Mins, $Hour, $Time
Global $CheckBreak = IniRead($File_Location, "Timers", "BreakTime", "")
Global $CheckLunch = IniRead($File_Location, "Timers", "LunchTime", "")

Const $ProgramVersion = "Super Launch 1.08"

DirGetSize($data_Location)
If @error = 1 Then
    DirCreate($data_Location)
EndIf

;-------Stops DellServ and DSN From Timing Out. Also closes start up files.-------
AdlibEnable("stoptimeout")

Func stoptimeout()
    Opt("WinTitleMatchMode", 1)
    If WinExists("Microsoft Internet Explorer", "Application timeout will occur in 10 minutes") Then
        ControlClick("Microsoft Internet Explorer", "", 1, "left", 1)
        ;_WinPrevious()
    EndIf
    If WinExists("Session time-out alert", "Your DSN session is about to time out.") Then
        ControlClick("Session time-out alert", "", 6, "left", 1)
        ;_WinPrevious()
    EndIf
    If WinExists("desktop.ini") Then WinClose("desktop.ini")
    If WinExists("Windows Script Host") Then WinClose("Windows Script Host")
    Sleep(10)
EndFunc   ;==>stoptimeout
;-------Creates the Main Gui-------
$GUI_Main = GUICreate($ProgramVersion, 225, 400)

;----Top Menu-----
$filemenu = GUICtrlCreateMenu("&File")
$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)

$ViewMenu = GUICtrlCreateMenu("&View")
$hotkeyitem = GUICtrlCreateMenuItem("Hot Keys", $ViewMenu)

$ToolsMenu = GUICtrlCreateMenu("&Tools")
$OptionsItem = GUICtrlCreateMenuItem("Options", $ToolsMenu)

$helpmenu = GUICtrlCreateMenu("&Help")
$infoitem = GUICtrlCreateMenuItem("About", $helpmenu)

;----Groups----
GUICtrlCreateGroup("Super Launch", 5, 3, 100, 275)
GUICtrlCreateGroup("Tools", 118, 3, 100, 275)

;----------Buttons Left Side---------;
GUICtrlCreateLabel("Check All", 13, 18, 50)
GUICtrlSetTip(-1, "Check box to right to" & @CRLF & "select or delselect all boxes.")

$CheckboxAll = GUICtrlCreateCheckbox("", 80, 15, 15)
GUICtrlSetTip(-1, "Check or Uncheck this box to" & @CRLF & "select or deselect all.")

$LaunchIDD1 = GUICtrlCreateButton("Soft Phone", 10, 35, 64)
$CheckboxIDD1 = GUICtrlCreateCheckbox("", 80, 38, 15)

$LaunchTimeStamp1 = GUICtrlCreateButton("Time Stamp", 10, 65, 64)
$CheckboxTimeStamp = GUICtrlCreateCheckbox("", 80, 65, 15)

$LaunchFusion1 = GUICtrlCreateButton("Fusion", 10, 95, 64)
$CheckboxFusion1 = GUICtrlCreateCheckbox("", 80, 95, 15)

$LaunchSDC = GUICtrlCreateButton("Super DC", 10, 125, 64)
$CheckboxSDC = GUICtrlCreateCheckbox("", 80, 125, 15)

$LaunchDSN1 = GUICtrlCreateButton("DSN", 10, 155, 64)
$CheckboxDSN1 = GUICtrlCreateCheckbox("", 80, 153, 15)

$LaunchDellserv1 = GUICtrlCreateButton("DellServ", 10, 185, 64)
$CheckboxDellserv1 = GUICtrlCreateCheckbox("", 80, 183, 15)

$LaunchWebOutlook = GUICtrlCreateButton("Outlook", 10, 215, 64)
$CheckboxWebOutlook = GUICtrlCreateCheckbox("", 80, 212, 15)

$LaunchAll = GUICtrlCreateButton("Start Launch", 10, 248, 90)
GUICtrlSetTip(-1, "Launch all selected items.")

;----------Buttons Right Side---------;
$LaunchProcessExplorer = GUICtrlCreateButton("Process Explorer", 125, 25, 85)
$SetRes = GUICtrlCreateButton("Set Resolution", 125, 55, 85)
$NotepadPlus = GUICtrlCreateButton("Notepad++", 125, 85, 85)
$LaunchNotepad = GUICtrlCreateButton("Notepad", 125, 115, 85)
$PasteCustomerScreen = GUICtrlCreateButton("Super Paste", 125, 145, 85)
$TimerStart = GUICtrlCreateButton("Start Timer",125, 305,85)
$TimerStop  = GUICtrlCreateButton("Stop Timer",125, 335,85)

;----Timer Group & Buttons at bottom----
GUICtrlCreateGroup("Timers", 5, 290, 213, 75)
$BreakTimer = GUICtrlCreateButton("Break Timer", 10, 305,85)
$LunchTimer = GUICtrlCreateButton("Lunch Timer", 10, 335,85)

$ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
GuiCtrlSetState($ticker,$Gui_hide)

;-------Tray-------
GUISetIcon("Super.ico")
TraySetIcon("Super.ico")
TraySetToolTip("Click to Restore or Minimize" & @CRLF & $ProgramVersion)

$Show = TrayCreateItem('Minimize')
TrayCreateItem("")
$exit = TrayCreateItem("Exit")
TraySetState()

GUISetState()

;-------Shows GUI and Controls-------
While 1
    $tmsg = TrayGetMsg()
    Switch $tmsg
        Case $Show
            If TrayItemGetText($Show) = 'Restore' Then
                GUISetState(@SW_SHOW, $GUI_Main)
                GUISetState(@SW_RESTORE, $GUI_Main)
                WinActivate($GUI_Main, '')
                TrayItemSetText($Show, 'Minimize')
            ElseIf TrayItemGetText($Show) = 'Minimize' Then
                GUISetState(@SW_HIDE, $GUI_Main)
                TrayItemSetText($Show, 'Restore')
            EndIf
        Case $exit
            CleanExit()
    EndSwitch
    $msg = GUIGetMsg()
    If $msg = $infoitem Then MsgBox(262208, "Super Launch  by   Jason Kingsley", "Please read the manual if you need any help!" & @CRLF & "" & @CRLF & "You can email me at Jason.Kingsley@Etelecare.com for questions or to report bugs!      " & @CRLF & "" & @CRLF & _
            "I hope this program has been helpful." & @CRLF & "" & @CRLF & "I want to thank the following for beta testing:" & @CRLF & "" & @CRLF & "Guillermo Rodriguez AKA Josh" & @CRLF & "Justin Dean" & @CRLF & "Elias Tenopala" & @CRLF & "Jarod Hayes" & @CRLF & "Eric Haese" & @CRLF & "" & @CRLF & _
            "" & @CRLF & "A Special Thanks to:" & @CRLF & "Steven Wichers - For his awesome programming skills and tips and much more!" & @CRLF & "Robert Park       - For giving me time to work on this!" & @CRLF & "" & @CRLF & "", 60)
    If $msg = $hotkeyitem Then MsgBox(262208, "Hot Keys List", "These are the Hot Keys you have access to." & @CRLF & "" & @CRLF & "Numpad+     Increases transpareny" & @CRLF & "" & @CRLF & "Numpad-      Decreases transparency" & @CRLF & "" & @CRLF & _
            "Numpad/      Remove transparency" & @CRLF & "" & @CRLF & _
            "Numpad*      Full Transparency" & @CRLF & "" & @CRLF & "WinKey+S    Hide/Show Super Launch" & @CRLF & "" & @CRLF & "CTRL+END   Force program to Terminate" & @CRLF & "" & @CRLF & "{F3}              Paste to Customer" & @CRLF & "" & @CRLF & _
            "{F6}              Launch Original Notepad")
    If $msg = $OptionsItem Then MsgBox(0, "Coming Soon", "This feature will come soon." & @CRLF & "" & @CRLF & "This will allow you to turn functions on or off")
    If $msg = $exititem Then CleanExit()
    Switch $msg
        Case $GUI_EVENT_MINIMIZE
            GUISetState(@SW_HIDE, $GUI_Main)
            TrayItemSetText($Show, 'Restore')
        Case $GUI_EVENT_CLOSE
            CleanExit()
        Case $LaunchIDD1
            ;LaunchIDD()
        Case $LaunchTimeStamp1
            ;LaunchTimeStamp1()
        Case $LaunchFusion1
            ;LaunchFusion()
        Case $LaunchSDC
            ;LaunchSDC()
        Case $LaunchDSN1
            ;LaunchDSN1()
        Case $LaunchDellserv1
            ;LaunchDellserv()
        Case $LaunchWebOutlook
            ;LaunchWebOutlook()
        Case $LaunchAll
            ;LaunchAll()
        Case $SetRes
            ;ChangeRes()
        Case $LaunchProcessExplorer
            ;ProcessExplorer()
        Case $NotepadPlus
            ;LaunchNotepadplus()
        Case $PasteCustomerScreen
            ;SuperPaste()
        Case $LaunchNotepad
            ;LaunchNotepad()
        Case $TimerStart
            $timer2 = TimerInit()
            AdlibEnable("Timer", 50)
        Case $TimerStop
            StopTimer()
        Case $BreakTimer
            If $CheckBreak = "" Then $CheckBreak = CreateBreakTime()
            $BTstart = TimerInit()
            AdlibEnable("BreakTimer", 50)
        Case $LunchTimer
            If $CheckLunch = "" Then $CheckLunch = CreateLunchBreakTime()
            $LTstart = TimerInit()
            AdlibEnable("LunchTimer", 50)
        Case $CheckboxAll
            $ischeckall = GUICtrlRead($CheckboxAll)
            If $ischeckall = $GUI_CHECKED Then
                ;CheckAll()
            Else
                ;UnCheckAll()
            EndIf
        Case Else
            ;-------------;
    EndSwitch

WEnd
;-----Create Lunch Break Time-----
Func CreateLunchBreakTime()
    $SetLunchTime = InputBox("Break Time", "How Long is your Lunch in minutes?", "60", "", 100, 135)
    IniWrite($File_Location, "Timers", "LunchTime", $SetLunchTime)
    Return $SetLunchTime
EndFunc   ;==>CreateLunchBreakTime

;-----Create Break Time-----
Func CreateBreakTime()
    $SetBreakTime = InputBox("Break Time", "How Long is your Break in minutes?", "15", "", 100, 135)
    IniWrite($File_Location, "Timers", "BreakTime", $SetBreakTime)
    Return $SetBreakTime
EndFunc   ;==>CreateBreakTime

;----Timer------
Func Timer()
    _TicksToTime(Int(TimerDiff($timer2)), $Hour, $Mins, $Secs)
    Local $sTime = $Time  ; save current time to be able to test and avoid flicker..
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $Time = ToolTip($TimeLabel)
    If BitAnd (GuiCtrlGetState($Ticker),$Gui_Hide) then GuiCtrlSetState($ticker,$Gui_Show)
    If GuiCtrlRead($ticker) <> $TimeLabel then GUICtrlSetData( $ticker, $TimeLabel)
    ;$ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
    If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
EndFunc   ;==>Timer

;----Stop active timer and display time----
Func StopTimer()
    AdlibDisable()
    GUICtrlSetData( $ticker, "00:00:00")
    GuiCtrlSetState($ticker,$Gui_hide)
    ToolTip("")
    AdlibEnable("stoptimeout")
    ;MsgBox(0,"Timer","Time elapsed: " & $Hour & ":" & $Mins & ":" & $Secs) Doesn't work using that method
EndFunc

;----Break Timer------
Func BreakTimer()
    _TicksToTime(Int(($CheckBreak *60 *1000) - TimerDiff($BTstart)), $Hour, $Mins, $Secs) ;change $CheckBreak to MIlliseconds
    Local $sTime = $Time 
    $mPos = MouseGetPos()
    $Time = ToolTip($Hour & ":" & $Mins & ":" & $Secs, $mPos[0] + 13, $mPos[1] + 17, "Break Timer")
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    ;$ticker = GUICtrlCreateLabel("00:00:00", 120, 200) need to put this int he guicreation not here
    If BitAnd (GuiCtrlGetState($Ticker),$Gui_Hide) then GuiCtrlSetState($ticker,$Gui_Show)
    If GuiCtrlRead($ticker) <> $TimeLabel then GUICtrlSetData( $ticker, $TimeLabel)
    ;If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
    ;If $Mins = $CheckBreak - 5 And $Secs = 0 Then MsgBox(262208, "", "5 minutes remaining", 5)
    ;If $Mins = $CheckBreak - 1 And $Secs = 0 Then MsgBox(262208, "", "1 minute remaining." & @CRLF & "Please get ready to auto in!", 3)
    If $TimeLabel = "00:00:00" Then
        MsgBox(262208, "", "Break is up!." & @CRLF & "You should be logged in by now!")
        GuiCtrlSetState($ticker,$Gui_hide)
        AdlibDisable()
        ToolTip("")
        AdlibEnable("stoptimeout")
    EndIf
EndFunc   ;==>BreakTimer

;----Timer------
Func LunchTimer()
    _TicksToTime(Int($CheckLunch * 60 * 1000 - TimerDiff($LTstart)), $Hour, $Mins, $Secs)
    Local $sTime = $Time 
    $mPos = MouseGetPos()
    
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $Time = ToolTip($TimeLabel, $mPos[0] + 13, $mPos[1] + 17, "Lunch Timer")
    ;$ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
    If BitAnd (GuiCtrlGetState($Ticker),$Gui_Hide) then GuiCtrlSetState($ticker,$Gui_Show)
    If GuiCtrlRead($ticker) <> $TimeLabel then GUICtrlSetData( $ticker, $TimeLabel)
    
    ;If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
    If $TimeLabel = "00:05:00" Then MsgBox(262208, "", "5 minutes remaining", 5)
    If $TimeLabel = "00:01:00" Then
        $LunchTimeStamp = MsgBox(4, "", "1 minute remaining." & @CRLF & "Would you like to launch Time Stamp?", 10)
        If $LunchTimeStamp = 6 Then
            ;LaunchTimeStamp1()
        Else
        EndIf
    EndIf
    If $TimeLabel = "00:00:00" Then
        MsgBox(262208, "", "Lunch is up!." & @CRLF & "You should be Time Stamped and logged in by now!")
        GuiCtrlSetState($ticker,$Gui_hide)
        AdlibDisable()
        ToolTip("")
        AdlibEnable("stoptimeout")
    EndIf
EndFunc   ;==>LunchTimer

;-----Close Program-----
Func CleanExit()
    GUISetState(@SW_HIDE)
    Exit
EndFunc   ;==>CleanExit

Edit: This only worked if the ini file already existed with values, I've changed it to return the valuse from the function for creating a break/lunch time

Dude you rock! Thanks so much!

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Dude you rock! Thanks so much!

Okay Timer is freaking sweet...

What I'm trying to work on now, when I click the StopTimeout button I need it to know which Timer was going at the time. With the code I have, what could I do for the StopTimeOut function to know which timer was running?

Ultimate goal is to make it so when you click on Break Timer then if you stop it 3 mins or lets say 3:23 seconds in, I want it to write that new value to an ini file, then have the program pick up from where it left off the next time you click the Break Timer, or Lunch Timer.

So if you could help me figure out how to make the program know the difference between clicking Break Timer, and Lunch Timer when Timer is stopped. Also have the program read the ini new values with out closing and reopening the program again. I think I could do the rest.

I put this code in, and it did it KINDA. Except for the part where I had to close and reopen the program to have it recognize the new time. Also if I were to click Lunch Timer, it would not let the other one work.

$SubmitBreakTime = $Mins * 60 + $Secs
$SubmitBreakTime = $SubmitBreakTime / 60
IniWrite($File_Location, "Timers", "BreakTime", $SubmitBreakTime)

$SubmitLunchTime = $Mins * 60 + $Secs
$SubmitLunchTime = $SubmitLunchTime / 60
IniWrite($File_Location, "Timers", "LunchTime", $SubmitLunchTime)
Edited by Klexen

Share this post


Link to post
Share on other sites

Okay Timer is freaking sweet...

What I'm trying to work on now, when I click the StopTimeout button I need it to know which Timer was going at the time. With the code I have, what could I do for the StopTimeOut function to know which timer was running?

Ultimate goal is to make it so when you click on Break Timer then if you stop it 3 mins or lets say 3:23 seconds in, I want it to write that new value to an ini file, then have the program pick up from where it left off the next time you click the Break Timer, or Lunch Timer.

So if you could help me figure out how to make the program know the difference between clicking Break Timer, and Lunch Timer when Timer is stopped. Also have the program read the ini new values with out closing and reopening the program again. I think I could do the rest.

I put this code in, and it did it KINDA. Except for the part where I had to close and reopen the program to have it recognize the new time. Also if I were to click Lunch Timer, it would not let the other one work.

$SubmitBreakTime = $Mins * 60 + $Secs
$SubmitBreakTime = $SubmitBreakTime / 60
IniWrite($File_Location, "Timers", "BreakTime", $SubmitBreakTime)

$SubmitLunchTime = $Mins * 60 + $Secs
$SubmitLunchTime = $SubmitLunchTime / 60
IniWrite($File_Location, "Timers", "LunchTime", $SubmitLunchTime)oÝ÷ Ûú®¢×£*.Á©ínZ(vw±´ý[-j»r¢ê}¼ ø§*.¶¯j[³*.çÊjxZ½æ ¡«ljø§Ø^½©nzÇè®V­z³ßv®¶­sb6æ6ÇVFRfÇC´FFRæS2fwC°¢6æ6ÇVFRfÇC´wV6öç7FçG2æS2fwC° ¤FÒb33c¶FFôÆö6FöâÒ67&DF"fײgV÷C²b3#´FFb3#²gV÷C°¤FÒb33c´fÆUôÆö6FöâÒ67&DF"fײgV÷C²b3#´FFb3#¶FVÆÇV6¶ÆVæ6æægV÷C° ¤vÆö&Âb33cµ6V72Âb33c´Öç2Âb33c´÷W"Âb33cµFÖP¤vÆö&Âb33c´6V6´'&V²Òæ&VBb33c´fÆUôÆö6FöâÂgV÷CµFÖW'2gV÷C²ÂgV÷C´'&VµFÖRgV÷C²ÂgV÷C²gV÷C²¤vÆö&Âb33c´6V6´ÇVæ6Òæ&VBb33c´fÆUôÆö6FöâÂgV÷CµFÖW'2gV÷C²ÂgV÷C´ÇVæ6FÖRgV÷C²ÂgV÷C²gV÷C²¤vÆö&Âb33c¶7FfUFÖW" ¤6öç7Bb33cµ&öw&ÕfW'6öâÒgV÷Cµ7WW"ÆVæ6ãgV÷C° ¤F$vWE6¦Rb33c¶FFôÆö6Föâ¤bW'&÷"ÒFVà F$7&VFRb33c¶FFôÆö6Föâ¤VæD` £²ÒÒÒÒÒÒÕ7F÷2FVÆÅ6W'bæBE4âg&öÒFÖær÷WBâÇ6ò6Æ÷6W27F'BWfÆW2âÒÒÒÒÒÒФFÆ$Væ&ÆRgV÷C·7F÷FÖV÷WBgV÷C² ¤gVæ27F÷FÖV÷WB ÷BgV÷CµvåFFÆTÖF6ÖöFRgV÷C²Â bväW7G2gV÷C´Ö7&÷6ögBçFW&æWBWÆ÷&W"gV÷C²ÂgV÷C´Æ6FöâFÖV÷WBvÆÂö67W"âÖçWFW2gV÷C²FVà 6öçG&öÄ6Æ6²gV÷C´Ö7&÷6ögBçFW&æWBWÆ÷&W"gV÷C²ÂgV÷C²gV÷C²ÂÂgV÷C¶ÆVgBgV÷C²Â µõvå&Wf÷W2 VæD` bväW7G2gV÷Cµ6W76öâFÖRÖ÷WBÆW'BgV÷C²ÂgV÷Cµ÷W"E4â6W76öâ2&÷WBFòFÖR÷WBâgV÷C²FVà 6öçG&öÄ6Æ6²gV÷Cµ6W76öâFÖRÖ÷WBÆW'BgV÷C²ÂgV÷C²gV÷C²ÂbÂgV÷C¶ÆVgBgV÷C²Â µõvå&Wf÷W2 VæD` bväW7G2gV÷C¶FW6·F÷æægV÷C²FVâvä6Æ÷6RgV÷C¶FW6·F÷æægV÷C² bväW7G2gV÷CµvæF÷w267&B÷7BgV÷C²FVâvä6Æ÷6RgV÷CµvæF÷w267&B÷7BgV÷C² 6ÆVW¤VæDgVæ2³ÓÒfwC·7F÷FÖV÷W@£²ÒÒÒÒÒÒÔ7&VFW2FRÖâwVÒÒÒÒÒÒТb33c´uTôÖâÒuT7&VFRb33cµ&öw&ÕfW'6öâÂ##RÂC £²ÒÒÒÕF÷ÖVçRÒÒÒÒТb33c¶fÆVÖVçRÒuT7G&Ä7&VFTÖVçRgV÷C²f×´fÆRgV÷C²¢b33c¶WFFVÒÒuT7G&Ä7&VFTÖVçTFVÒgV÷C´WBgV÷C²Âb33c¶fÆVÖVçR ¢b33cµfWtÖVçRÒuT7G&Ä7&VFTÖVçRgV÷C²f×µfWrgV÷C²¢b33c¶÷F¶WFVÒÒuT7G&Ä7&VFTÖVçTFVÒgV÷C´÷B¶W2gV÷C²Âb33cµfWtÖVçR ¢b33cµFööÇ4ÖVçRÒuT7G&Ä7&VFTÖVçRgV÷C²f×µFööÇ2gV÷C²¢b33c´÷Föç4FVÒÒuT7G&Ä7&VFTÖVçTFVÒgV÷C´÷Föç2gV÷C²Âb33cµFööÇ4ÖVçR ¢b33c¶VÇÖVçRÒuT7G&Ä7&VFTÖVçRgV÷C²f×´VÇgV÷C²¢b33c¶æföFVÒÒuT7G&Ä7&VFTÖVçTFVÒgV÷C´&÷WBgV÷C²Âb33c¶VÇÖVçR £²ÒÒÒÔw&÷W2ÒÒÒФuT7G&Ä7&VFTw&÷WgV÷Cµ7WW"ÆVæ6gV÷C²ÂRÂ2ÂÂ#sR¤uT7G&Ä7&VFTw&÷WgV÷CµFööÇ2gV÷C²ÂÂ2ÂÂ#sR £²ÒÒÒÒÒÒÒÒÒÔ'WGFöç2ÆVgB6FRÒÒÒÒÒÒÒÒÓ°¤uT7G&Ä7&VFTÆ&VÂgV÷C´6V6²ÆÂgV÷C²Â2ÂÂS¤uT7G&Å6WEFÓÂgV÷C´6V6²&÷Fò&vBFògV÷C²fײ5$ÄbfײgV÷C·6VÆV7B÷"FVÇ6VÆV7BÆÂ&÷W2âgV÷C² ¢b33c´6V6¶&÷ÆÂÒuT7G&Ä7&VFT6V6¶&÷gV÷C²gV÷C²ÂÂRÂR¤uT7G&Å6WEFÓÂgV÷C´6V6²÷"Væ6V6²F2&÷FògV÷C²fײ5$ÄbfײgV÷C·6VÆV7B÷"FW6VÆV7BÆÂâgV÷C² ¢b33c´ÆVæ6DCÒuT7G&Ä7&VFT'WGFöâgV÷Cµ6ögBöæRgV÷C²ÂÂ3RÂcB¢b33c´6V6¶&÷DCÒuT7G&Ä7&VFT6V6¶&÷gV÷C²gV÷C²ÂÂ3ÂR ¢b33c´ÆVæ6FÖU7F×ÒuT7G&Ä7&VFT'WGFöâgV÷CµFÖR7F×gV÷C²ÂÂcRÂcB¢b33c´6V6¶&÷FÖU7F×ÒuT7G&Ä7&VFT6V6¶&÷gV÷C²gV÷C²ÂÂcRÂR ¢b33c´ÆVæ6gW6öãÒuT7G&Ä7&VFT'WGFöâgV÷C´gW6öâgV÷C²ÂÂRÂcB¢b33c´6V6¶&÷gW6öãÒuT7G&Ä7&VFT6V6¶&÷gV÷C²gV÷C²ÂÂRÂR ¢b33c´ÆVæ64D2ÒuT7G&Ä7&VFT'WGFöâgV÷Cµ7WW"D2gV÷C²ÂÂ#RÂcB¢b33c´6V6¶&÷4D2ÒuT7G&Ä7&VFT6V6¶&÷gV÷C²gV÷C²ÂÂ#RÂR ¢b33c´ÆVæ6E4ãÒuT7G&Ä7&VFT'WGFöâgV÷C´E4âgV÷C²ÂÂSRÂcB¢b33c´6V6¶&÷E4ãÒuT7G&Ä7&VFT6V6¶&÷gV÷C²gV÷C²ÂÂS2ÂR ¢b33c´ÆVæ6FVÆÇ6W'cÒuT7G&Ä7&VFT'WGFöâgV÷C´FVÆÅ6W'bgV÷C²ÂÂRÂcB¢b33c´6V6¶&÷FVÆÇ6W'cÒuT7G&Ä7&VFT6V6¶&÷gV÷C²gV÷C²ÂÂ2ÂR ¢b33c´ÆVæ6vV$÷WFÆöö²ÒuT7G&Ä7&VFT'WGFöâgV÷C´÷WFÆöö²gV÷C²ÂÂ#RÂcB¢b33c´6V6¶&÷vV$÷WFÆöö²ÒuT7G&Ä7&VFT6V6¶&÷gV÷C²gV÷C²ÂÂ#"ÂR ¢b33c´ÆVæ6ÆÂÒuT7G&Ä7&VFT'WGFöâgV÷Cµ7F'BÆVæ6gV÷C²ÂÂ#C¤uT7G&Å6WEFÓÂgV÷C´ÆVæ6ÆÂ6VÆV7FVBFV×2âgV÷C² £²ÒÒÒÒÒÒÒÒÒÔ'WGFöç2&vB6FRÒÒÒÒÒÒÒÒÓ°¢b33c´ÆVæ6&ö6W74WÆ÷&W"ÒuT7G&Ä7&VFT'WGFöâgV÷Cµ&ö6W72WÆ÷&W"gV÷C²Â#RÂ#RÂR¢b33cµ6WE&W2ÒuT7G&Ä7&VFT'WGFöâgV÷Cµ6WB&W6öÇWFöâgV÷C²Â#RÂSRÂR¢b33c´æ÷FWEÇW2ÒuT7G&Ä7&VFT'WGFöâgV÷C´æ÷FWB²²gV÷C²Â#RÂRÂR¢b33c´ÆVæ6æ÷FWBÒuT7G&Ä7&VFT'WGFöâgV÷C´æ÷FWBgV÷C²Â#RÂRÂR¢b33cµ7FT7W7FöÖW%67&VVâÒuT7G&Ä7&VFT'WGFöâgV÷Cµ7WW"7FRgV÷C²Â#RÂCRÂR¢b33cµFÖW%7F'BÒuT7G&Ä7&VFT'WGFöâgV÷Cµ7F'BFÖW"gV÷C²Ã#RÂ3RÃR¢b33cµFÖW%7F÷ÒuT7G&Ä7&VFT'WGFöâgV÷Cµ7F÷FÖW"gV÷C²Ã#RÂ33RÃR £²ÒÒÒÕFÖW"w&÷Wfײ'WGFöç2B&÷GFöÒÒÒÒФuT7G&Ä7&VFTw&÷WgV÷CµFÖW'2gV÷C²ÂRÂ#Â#2ÂsR¢b33c´'&VµFÖW"ÒuT7G&Ä7&VFT'WGFöâgV÷C´'&V²FÖW"gV÷C²ÂÂ3RÃR¢b33c´ÇVæ6FÖW"ÒuT7G&Ä7&VFT'WGFöâgV÷C´ÇVæ6FÖW"gV÷C²ÂÂ33RÃR ¢b33c·F6¶W"ÒuT7G&Ä7&VFTÆ&VÂgV÷C³££gV÷C²Â#Â#¤wV7G&Å6WE7FFRb33c·F6¶W"Âb33c´wVöFR £²ÒÒÒÒÒÒÕG&ÒÒÒÒÒÒФuT6WD6öâgV÷Cµ7WW"æ6ògV÷C²¥G&6WD6öâgV÷Cµ7WW"æ6ògV÷C²¥G&6WEFööÅFgV÷C´6Æ6²Fò&W7F÷&R÷"ÖæÖ¦RgV÷C²fײ5$Äbfײb33cµ&öw&ÕfW'6öâ ¢b33cµ6÷rÒG&7&VFTFVÒb33´ÖæÖ¦Rb33²¥G&7&VFTFVÒgV÷C²gV÷C²¢b33c¶WBÒG&7&VFTFVÒgV÷C´WBgV÷C²¥G&6WE7FFR ¤uT6WE7FFR £²ÒÒÒÒÒÒÕ6÷w2uTæB6öçG&öÇ2ÒÒÒÒÒÒÐ¥vÆR b33c·F×6rÒG&vWD×6r 7vF6b33c·F×6p 66Rb33cµ6÷p bG&FVÔvWEFWBb33cµ6÷rÒb33µ&W7F÷&Rb33²FVà uT6WE7FFR5uõ4õrÂb33c´uTôÖâ uT6WE7FFR5uõ$U5Dõ$RÂb33c´uTôÖâ vä7FfFRb33c´uTôÖâÂb33²b33² G&FVÕ6WEFWBb33cµ6÷rÂb33´ÖæÖ¦Rb33² VÇ6TbG&FVÔvWEFWBb33cµ6÷rÒb33´ÖæÖ¦Rb33²FVà uT6WE7FFR5uôDRÂb33c´uTôÖâ G&FVÕ6WEFWBb33cµ6÷rÂb33µ&W7F÷&Rb33² VæD` 66Rb33c¶W@ 6ÆVäWB VæE7vF6 b33c¶×6rÒuTvWD×6r bb33c¶×6rÒb33c¶æföFVÒFVâ×6t&÷#c##ÂgV÷Cµ7WW"ÆVæ6'¦6öâ¶æw6ÆWgV÷C²ÂgV÷CµÆV6R&VBFRÖçVÂb÷RæVVBçVÇb333²gV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$ÄbfײgV÷Cµ÷R6âVÖÂÖRB¦6öâä¶æw6ÆWWFVÆV6&Ræ6öÒf÷"VW7Föç2÷"Fò&W÷'B'Vw2b333²gV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$Äbfײð gV÷C´÷RF2&öw&Ò2&VVâVÇgVÂâgV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$ÄbfײgV÷C´vçBFòFæ²FRföÆÆ÷værf÷"&WFFW7Fæs¢gV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$ÄbfײgV÷C´wVÆÆW&Öò&öG&wVW¢´¦÷6gV÷C²fײ5$ÄbfײgV÷C´§W7FâFVâgV÷C²fײ5$ÄbfײgV÷C´VÆ2FVæ÷ÆgV÷C²fײ5$ÄbfײgV÷C´¦&öBW2gV÷C²fײ5$ÄbfײgV÷C´W&2W6RgV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$Äbfײð gV÷C²gV÷C²fײ5$ÄbfײgV÷C´7V6ÂFæ·2Fó¢gV÷C²fײ5$ÄbfײgV÷Cµ7FWfVâv6W'2Òf÷"2vW6öÖR&öw&ÖÖær6¶ÆÇ2æBF2æB×V6Ö÷&Rb333²gV÷C²fײ5$ÄbfײgV÷Cµ&ö&W'B&²Òf÷"vfærÖRFÖRFòv÷&²öâF2b333²gV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$ÄbfײgV÷C²gV÷C²Âc bb33c¶×6rÒb33c¶÷F¶WFVÒFVâ×6t&÷#c##ÂgV÷C´÷B¶W2Æ7BgV÷C²ÂgV÷CµFW6R&RFR÷B¶W2÷RfR66W72FòâgV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$ÄbfײgV÷C´çV×B²æ7&V6W2G&ç7&VçgV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$ÄbfײgV÷C´çV×BÒFV7&V6W2G&ç7&Væ7gV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$Äbfײð gV÷C´çV×Bò&VÖ÷fRG&ç7&Væ7gV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$Äbfײð gV÷C´çV×B¢gVÆÂG&ç7&Væ7gV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$ÄbfײgV÷Cµvä¶Wµ2FRõ6÷r7WW"ÆVæ6gV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$ÄbfײgV÷C´5E$´TäBf÷&6R&öw&ÒFòFW&ÖæFRgV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$ÄbfײgV÷C·´c7Ò7FRFò7W7FöÖW"gV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$Äbfײð gV÷C·´cgÒÆVæ6÷&væÂæ÷FWBgV÷C² bb33c¶×6rÒb33c´÷Föç4FVÒFVâ×6t&÷ÂgV÷C´6öÖær6ööâgV÷C²ÂgV÷CµF2fVGW&RvÆÂ6öÖR6ööââgV÷C²fײ5$ÄbfײgV÷C²gV÷C²fײ5$ÄbfײgV÷CµF2vÆÂÆÆ÷r÷RFòGW&âgVæ7Föç2öâ÷"öfbgV÷C² bb33c¶×6rÒb33c¶WFFVÒFVâ6ÆVäWB 7vF6b33c¶×6p 66Rb33c´uTôUdTåEôÔäÔ¤P uT6WE7FFR5uôDRÂb33c´uTôÖâ G&FVÕ6WEFWBb33cµ6÷rÂb33µ&W7F÷&Rb33² 66Rb33c´uTôUdTåEô4Äõ4P 6ÆVäWB 66Rb33c´ÆVæ6DC ´ÆVæ6DB 66Rb33c´ÆVæ6FÖU7F× ´ÆVæ6FÖU7F× 66Rb33c´ÆVæ6gW6öã ´ÆVæ6gW6öâ 66Rb33c´ÆVæ64D0 ´ÆVæ64D2 66Rb33c´ÆVæ6E4ã ´ÆVæ6E4ã 66Rb33c´ÆVæ6FVÆÇ6W'c ´ÆVæ6FVÆÇ6W'b 66Rb33c´ÆVæ6vV$÷WFÆöö° ´ÆVæ6vV$÷WFÆöö² 66Rb33c´ÆVæ6ÆÀ ´ÆVæ6Æ 66Rb33cµ6WE&W0 ´6ævU&W2 66Rb33c´ÆVæ6&ö6W74WÆ÷&W  µ&ö6W74WÆ÷&W" 66Rb33c´æ÷FWEÇW0 ´ÆVæ6æ÷FWGÇW2 66Rb33cµ7FT7W7FöÖW%67&VVà µ7WW%7FR 66Rb33c´ÆVæ6æ÷FW@ ´ÆVæ6æ÷FWB 66Rb33cµFÖW%7F'@ bb33c¶7FfUFÖW"fÇC²fwC²gV÷C²gV÷C²FVâ6öçFçVTÆö÷·vÆÂ6¶FRæWB&B6÷2FW&R2FÖW"'Væææp b33c·FÖW#"ÒFÖW$æB FÆ$Væ&ÆRgV÷CµFÖW"gV÷C²ÂS b33c´7FfUFÖW"ÒgV÷Cµ6öÖR6÷VçBWFÖW#ògV÷C° 66Rb33cµFÖW%7F÷ bb33c¶7FfUFÖW"ÒgV÷C²gV÷C²FVâ6öçFçVVÆö÷¶æòFÖW"'Vææær6ò6¶FRæWB&@ 7F÷FÖW" b33c´7FfUFÖW"ÒgV÷C²gV÷C° 66Rb33c´'&VµFÖW  bb33c¶7FfUFÖW"fÇC²fwC²gV÷C²gV÷C²FVâ6öçFçVTÆö÷·vÆÂ6¶FRæWB&B6÷2FW&R2FÖW"'Væææp bb33c´6V6´'&V²ÒgV÷C²gV÷C²FVâb33c´6V6´'&V²Ò7&VFT'&VµFÖR b33c´%G7F'BÒFÖW$æB FÆ$Væ&ÆRgV÷C´'&VµFÖW"gV÷C²ÂS b33c¶7FfUFÖW"ÒgV÷C´'&V²FÖW"gV÷C° 66Rb33c´ÇVæ6FÖW  bb33c¶7FfUFÖW"fÇC²fwC²gV÷C²gV÷C²FVâ6öçFçVVÆö÷·vÆÂ6¶FRæWB&B6÷2FW&R2FÖW"'Væææp bb33c´6V6´ÇVæ6ÒgV÷C²gV÷C²FVâb33c´6V6´ÇVæ6Ò7&VFTÇVæ6'&VµFÖR b33c´ÅG7F'BÒFÖW$æB FÆ$Væ&ÆRgV÷C´ÇVæ6FÖW"gV÷C²ÂS b33c¶7FfUFÖW"ÒgV÷C´ÇVæ6FÖW"gV÷C° 66Rb33c´6V6¶&÷ÆÀ b33c¶66V6¶ÆÂÒuT7G&Å&VBb33c´6V6¶&÷Æ bb33c¶66V6¶ÆÂÒb33c´uTô4T4´TBFVà ´6V6´Æ VÇ6P µVä6V6´Æ VæD` 66RVÇ6P ²ÒÒÒÒÒÒÒÒÒÒÒÒÓ° VæE7vF6 ¥tVæ@£²ÒÒÒÒÔ7&VFRÇVæ6'&V²FÖRÒÒÒÒФgVæ27&VFTÇVæ6'&VµFÖR b33cµ6WDÇVæ6FÖRÒçWD&÷gV÷C´'&V²FÖRgV÷C²ÂgV÷C´÷rÆöær2÷W"ÇVæ6âÖçWFW3ògV÷C²ÂgV÷C³cgV÷C²ÂgV÷C²gV÷C²ÂÂ3R æw&FRb33c´fÆUôÆö6FöâÂgV÷CµFÖW'2gV÷C²ÂgV÷C´ÇVæ6FÖRgV÷C²Âb33cµ6WDÇVæ6FÖR &WGW&âb33cµ6WDÇVæ6FÖP¤VæDgVæ2³ÓÒfwC´7&VFTÇVæ6'&VµFÖP £²ÒÒÒÒÔ7&VFR'&V²FÖRÒÒÒÒФgVæ27&VFT'&VµFÖR b33cµ6WD'&VµFÖRÒçWD&÷gV÷C´'&V²FÖRgV÷C²ÂgV÷C´÷rÆöær2÷W"'&V²âÖçWFW3ògV÷C²ÂgV÷C³RgV÷C²ÂgV÷C²gV÷C²ÂÂ3R æw&FRb33c´fÆUôÆö6FöâÂgV÷CµFÖW'2gV÷C²ÂgV÷C´'&VµFÖRgV÷C²Âb33cµ6WD'&VµFÖR &WGW&âb33cµ6WD'&VµFÖP¤VæDgVæ2³ÓÒfwC´7&VFT'&VµFÖP £²ÒÒÒÕFÖW"ÒÒÒÒÒФgVæ2FÖW" õF6·5FõFÖRçBFÖW$Ffbb33c·FÖW#"Âb33c´÷W"Âb33c´Öç2Âb33cµ6V72 Æö6Âb33c·5FÖRÒb33cµFÖR²6fR7W'&VçBFÖRFò&R&ÆRFòFW7BæBföBfÆ6¶W"âà b33cµFÖTÆ&VÂÒ7G&ætf÷&ÖBgV÷C²S&¢S&¢S&gV÷C²Âb33c´÷W"Âb33c´Öç2Âb33cµ6V72 b33cµFÖRÒFööÅFb33cµFÖTÆ&V b&DæBwV7G&ÄvWE7FFRb33cµF6¶W"Âb33c´wVôFRFVâwV7G&Å6WE7FFRb33c·F6¶W"Âb33c´wVõ6÷r bwV7G&Å&VBb33c·F6¶W"fÇC²fwC²b33cµFÖTÆ&VÂFVâuT7G&Å6WDFFb33c·F6¶W"Âb33cµFÖTÆ&V ²b33c·F6¶W"ÒuT7G&Ä7&VFTÆ&VÂgV÷C³££gV÷C²Â#Â# bb33c·5FÖRfÇC²fwC²b33cµFÖRFVâuT7G&Å6WDFFb33c·F6¶W"Âb33cµFÖTÆ&V¤VæDgVæ2³ÓÒfwCµFÖW  £²ÒÒÒÕ7F÷7FfRFÖW"æBF7ÆFÖRÒÒÒФgVæ27F÷FÖW"  ×6v&÷ÂgV÷C²gV÷C²ÂgV÷CµFRÆ7B7FfRFÖW"v2gV÷C²fײb33c¶7FfUFÖW"fײ7&Æbfײð gV÷CµvFFÖRöbgV÷C²fײwV7G&Å&VBb33c·F6¶W"  FÆ$F6&ÆR uT7G&Å6WDFFb33c·F6¶W"ÂgV÷C³££gV÷C² wV7G&Å6WE7FFRb33c·F6¶W"Âb33c´wVöFR FööÅFgV÷C²gV÷C² FÆ$Væ&ÆRgV÷C·7F÷FÖV÷WBgV÷C² ´×6t&÷ÂgV÷CµFÖW"gV÷C²ÂgV÷CµFÖRVÆ6VC¢gV÷C²fײb33c´÷W"fײgV÷C³¢gV÷C²fײb33c´Öç2fײgV÷C³¢gV÷C²fײb33cµ6V72FöW6âb33·Bv÷&²W6ærFBÖWFö@¤VæDgVæ0 £²ÒÒÒÔ'&V²FÖW"ÒÒÒÒÒФgVæ2'&VµFÖW" õF6·5FõFÖRçBb33c´6V6´'&V²£c£ÒFÖW$Ffbb33c´%G7F'BÂb33c´÷W"Âb33c´Öç2Âb33cµ6V72¶6ævRb33c´6V6´'&V²FòÔÆÆ6V6öæG0 Æö6Âb33c·5FÖRÒb33cµFÖR b33c¶Õ÷2ÒÖ÷W6TvWE÷2 b33cµFÖRÒFööÅFb33c´÷W"fײgV÷C³¢gV÷C²fײb33c´Öç2fײgV÷C³¢gV÷C²fײb33cµ6V72Âb33c¶Õ÷5³Ò²2Âb33c¶Õ÷5³Ò²rÂgV÷C´'&V²FÖW"gV÷C² b33cµFÖTÆ&VÂÒ7G&ætf÷&ÖBgV÷C²S&¢S&¢S&gV÷C²Âb33c´÷W"Âb33c´Öç2Âb33cµ6V72 ²b33c·F6¶W"ÒuT7G&Ä7&VFTÆ&VÂgV÷C³££gV÷C²Â#Â#æVVBFòWBF2çBRwV7&VFöâæ÷BW&P b&DæBwV7G&ÄvWE7FFRb33cµF6¶W"Âb33c´wVôFRFVâwV7G&Å6WE7FFRb33c·F6¶W"Âb33c´wVõ6÷r bwV7G&Å&VBb33c·F6¶W"fÇC²fwC²b33cµFÖTÆ&VÂFVâuT7G&Å6WDFFb33c·F6¶W"Âb33cµFÖTÆ&V ´bb33c·5FÖRfÇC²fwC²b33cµFÖRFVâuT7G&Å6WDFFb33c·F6¶W"Âb33cµFÖTÆ&V ´bb33c´Öç2Òb33c´6V6´'&V²ÒRæBb33cµ6V72ÒFVâ×6t&÷#c##ÂgV÷C²gV÷C²ÂgV÷C³RÖçWFW2&VÖæærgV÷C²ÂR ´bb33c´Öç2Òb33c´6V6´'&V²ÒæBb33cµ6V72ÒFVâ×6t&÷#c##ÂgV÷C²gV÷C²ÂgV÷C³ÖçWFR&VÖæærâgV÷C²fײ5$ÄbfײgV÷CµÆV6RvWB&VGFòWFòâb333²gV÷C²Â2 bb33cµFÖTÆ&VÂÒgV÷C³££gV÷C²FVà ×6t&÷#c##ÂgV÷C²gV÷C²ÂgV÷C´'&V²2Wb333²âgV÷C²fײ5$ÄbfײgV÷Cµ÷R6÷VÆB&RÆövvVBâ'æ÷rb333²gV÷C² b33c¶7FfUFÖW"ÒgV÷C²gV÷C° wV7G&Å6WE7FFRb33c·F6¶W"Âb33c´wVöFR FÆ$F6&ÆR FööÅFgV÷C²gV÷C² FÆ$Væ&ÆRgV÷C·7F÷FÖV÷WBgV÷C² VæD`¤VæDgVæ2³ÓÒfwC´'&VµFÖW  £²ÒÒÒÕFÖW"ÒÒÒÒÒФgVæ2ÇVæ6FÖW" õF6·5FõFÖRçBb33c´6V6´ÇVæ6¢c¢ÒFÖW$Ffbb33c´ÅG7F'BÂb33c´÷W"Âb33c´Öç2Âb33cµ6V72 Æö6Âb33c·5FÖRÒb33cµFÖR b33c¶Õ÷2ÒÖ÷W6TvWE÷2  b33cµFÖTÆ&VÂÒ7G&ætf÷&ÖBgV÷C²S&¢S&¢S&gV÷C²Âb33c´÷W"Âb33c´Öç2Âb33cµ6V72 b33cµFÖRÒFööÅFb33cµFÖTÆ&VÂÂb33c¶Õ÷5³Ò²2Âb33c¶Õ÷5³Ò²rÂgV÷C´ÇVæ6FÖW"gV÷C² ²b33c·F6¶W"ÒuT7G&Ä7&VFTÆ&VÂgV÷C³££gV÷C²Â#Â# b&DæBwV7G&ÄvWE7FFRb33cµF6¶W"Âb33c´wVôFRFVâwV7G&Å6WE7FFRb33c·F6¶W"Âb33c´wVõ6÷r bwV7G&Å&VBb33c·F6¶W"fÇC²fwC²b33cµFÖTÆ&VÂFVâuT7G&Å6WDFFb33c·F6¶W"Âb33cµFÖTÆ&V  ´bb33c·5FÖRfÇC²fwC²b33cµFÖRFVâuT7G&Å6WDFFb33c·F6¶W"Âb33cµFÖTÆ&V bb33cµFÖTÆ&VÂÒgV÷C³£S£gV÷C²FVâ×6t&÷#c##ÂgV÷C²gV÷C²ÂgV÷C³RÖçWFW2&VÖæærgV÷C²ÂR bb33cµFÖTÆ&VÂÒgV÷C³££gV÷C²FVà b33c´ÇVæ6FÖU7F×Ò×6t&÷BÂgV÷C²gV÷C²ÂgV÷C³ÖçWFR&VÖæærâgV÷C²fײ5$ÄbfײgV÷Cµv÷VÆB÷RƶRFòÆVæ6FÖR7F×ògV÷C²Â bb33c´ÇVæ6FÖU7F×ÒbFVà ´ÆVæ6FÖU7F× VÇ6P VæD` VæD` bb33cµFÖTÆ&VÂÒgV÷C³££gV÷C²FVà ×6t&÷#c##ÂgV÷C²gV÷C²ÂgV÷C´ÇVæ62Wb333²âgV÷C²fײ5$ÄbfײgV÷Cµ÷R6÷VÆB&RFÖR7F×VBæBÆövvVBâ'æ÷rb333²gV÷C² b33c¶7FfUFÖW"ÒgV÷C²gV÷C° wV7G&Å6WE7FFRb33c·F6¶W"Âb33c´wVöFR FÆ$F6&ÆR FööÅFgV÷C²gV÷C² FÆ$Væ&ÆRgV÷C·7F÷FÖV÷WBgV÷C² VæD`¤VæDgVæ2³ÓÒfwC´ÇVæ6FÖW  £²ÒÒÒÒÔ6Æ÷6R&öw&ÒÒÒÒÒФgVæ26ÆVäWB uT6WE7FFR5uôDR W@¤VæDgVæ2³ÓÒfwC´6ÆVäW

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

Woh... when I try and edit my last post it goes all freaky. I was going to put I have done the starting a new timer prevention which is how you know which timer is running

Sweet dude, thanks a lot. This should get me in the right direction. :whistle:

Stuck on a call right now, so I can't mess with it. :lmao:

Share this post


Link to post
Share on other sites

#14 ·  Posted (edited)

Sweet dude, thanks a lot. This should get me in the right direction. :whistle:

Stuck on a call right now, so I can't mess with it. :lmao:

I tried this, but it doesn't totally work. It freezes and you have to close and open program for it to take from where it left off..

;----Stop active timer and display time----
Func StopTimer()
    AdlibDisable()
    If $activeTimer = "Break Timer" Then
        $SubmitBreakTime = $Mins * 60 + $Secs
        $SubmitBreakTime = $SubmitBreakTime / 60
        IniWrite($File_Location, "Timers", "BreakTime", $SubmitBreakTime)
        Return $SubmitBreakTime
    ElseIf $activeTimer = "Lunch Timer" Then
        $SubmitLunchTime = $Mins * 60 + $Secs
        $SubmitLunchTime = $SubmitLunchTime / 60
        IniWrite($File_Location, "Timers", "LunchTime", $SubmitLunchTime)
        Return $SubmitLunchTime
    EndIf
    GUICtrlSetData($ticker, "00:00:00")
    GUICtrlSetState($ticker, $Gui_hide)
    ToolTip("")
    AdlibEnable("stoptimeout")
EndFunc   ;==>StopTimer
Edited by Klexen

Share this post


Link to post
Share on other sites

The way your doing it you'd bugger up the timers.

This is storing the used break time in another place in the ini file.

The problem I see is that if I have a break and at 14 minutes I stop the timer, the next time I have a break I'd only have 1 minute left. So if I never took my last 1 minute during my 15 minute break today then tomorrow I'd only have 1 minute remaining.

So at some point your going to have to reset the BreakTimeRemain and LunchTimeRemain in the ini file back to 0. At what point you do this I don't know, I'm not sure really what your trying to achieve

#include <Date.au3>
#include <GuiConstants.au3>

Dim $data_Location = @ScriptDir & "\Data\"
Dim $File_Location = @ScriptDir & "\Data\dellquicklaunch.ini"

Global $Secs, $Mins, $Hour, $Time
Global $CheckBreak = IniRead($File_Location, "Timers", "BreakTime", "")
Global $CheckLunch = IniRead($File_Location, "Timers", "LunchTime", "")
Global $activeTimer, $BreakUsed, $LunchUsed

Const $ProgramVersion = "Super Launch 1.08"

DirGetSize($data_Location)
If @error = 1 Then
    DirCreate($data_Location)
EndIf

;-------Stops DellServ and DSN From Timing Out. Also closes start up files.-------
AdlibEnable("stoptimeout")

Func stoptimeout()
    Opt("WinTitleMatchMode", 1)
    If WinExists("Microsoft Internet Explorer", "Application timeout will occur in 10 minutes") Then
        ControlClick("Microsoft Internet Explorer", "", 1, "left", 1)
       ;_WinPrevious()
    EndIf
    If WinExists("Session time-out alert", "Your DSN session is about to time out.") Then
        ControlClick("Session time-out alert", "", 6, "left", 1)
       ;_WinPrevious()
    EndIf
    If WinExists("desktop.ini") Then WinClose("desktop.ini")
    If WinExists("Windows Script Host") Then WinClose("Windows Script Host")
    Sleep(10)
EndFunc  ;==>stoptimeout
;-------Creates the Main Gui-------
$GUI_Main = GUICreate($ProgramVersion, 225, 400)

;----Top Menu-----
$filemenu = GUICtrlCreateMenu("&File")
$exititem = GUICtrlCreateMenuItem("Exit", $filemenu)

$ViewMenu = GUICtrlCreateMenu("&View")
$hotkeyitem = GUICtrlCreateMenuItem("Hot Keys", $ViewMenu)

$ToolsMenu = GUICtrlCreateMenu("&Tools")
$OptionsItem = GUICtrlCreateMenuItem("Options", $ToolsMenu)

$helpmenu = GUICtrlCreateMenu("&Help")
$infoitem = GUICtrlCreateMenuItem("About", $helpmenu)

;----Groups----
GUICtrlCreateGroup("Super Launch", 5, 3, 100, 275)
GUICtrlCreateGroup("Tools", 118, 3, 100, 275)

;----------Buttons Left Side---------;
GUICtrlCreateLabel("Check All", 13, 18, 50)
GUICtrlSetTip(-1, "Check box to right to" & @CRLF & "select or delselect all boxes.")

$CheckboxAll = GUICtrlCreateCheckbox("", 80, 15, 15)
GUICtrlSetTip(-1, "Check or Uncheck this box to" & @CRLF & "select or deselect all.")

$LaunchIDD1 = GUICtrlCreateButton("Soft Phone", 10, 35, 64)
$CheckboxIDD1 = GUICtrlCreateCheckbox("", 80, 38, 15)

$LaunchTimeStamp1 = GUICtrlCreateButton("Time Stamp", 10, 65, 64)
$CheckboxTimeStamp = GUICtrlCreateCheckbox("", 80, 65, 15)

$LaunchFusion1 = GUICtrlCreateButton("Fusion", 10, 95, 64)
$CheckboxFusion1 = GUICtrlCreateCheckbox("", 80, 95, 15)

$LaunchSDC = GUICtrlCreateButton("Super DC", 10, 125, 64)
$CheckboxSDC = GUICtrlCreateCheckbox("", 80, 125, 15)

$LaunchDSN1 = GUICtrlCreateButton("DSN", 10, 155, 64)
$CheckboxDSN1 = GUICtrlCreateCheckbox("", 80, 153, 15)

$LaunchDellserv1 = GUICtrlCreateButton("DellServ", 10, 185, 64)
$CheckboxDellserv1 = GUICtrlCreateCheckbox("", 80, 183, 15)

$LaunchWebOutlook = GUICtrlCreateButton("Outlook", 10, 215, 64)
$CheckboxWebOutlook = GUICtrlCreateCheckbox("", 80, 212, 15)

$LaunchAll = GUICtrlCreateButton("Start Launch", 10, 248, 90)
GUICtrlSetTip(-1, "Launch all selected items.")

;----------Buttons Right Side---------;
$LaunchProcessExplorer = GUICtrlCreateButton("Process Explorer", 125, 25, 85)
$SetRes = GUICtrlCreateButton("Set Resolution", 125, 55, 85)
$NotepadPlus = GUICtrlCreateButton("Notepad++", 125, 85, 85)
$LaunchNotepad = GUICtrlCreateButton("Notepad", 125, 115, 85)
$PasteCustomerScreen = GUICtrlCreateButton("Super Paste", 125, 145, 85)
$TimerStart = GUICtrlCreateButton("Start Timer",125, 305,85)
$TimerStop  = GUICtrlCreateButton("Stop Timer",125, 335,85)

;----Timer Group & Buttons at bottom----
GUICtrlCreateGroup("Timers", 5, 290, 213, 75)
$BreakTimer = GUICtrlCreateButton("Break Timer", 10, 305,85)
$LunchTimer = GUICtrlCreateButton("Lunch Timer", 10, 335,85)

$ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
GuiCtrlSetState($ticker,$Gui_hide)

;-------Tray-------
GUISetIcon("Super.ico")
TraySetIcon("Super.ico")
TraySetToolTip("Click to Restore or Minimize" & @CRLF & $ProgramVersion)

$Show = TrayCreateItem('Minimize')
TrayCreateItem("")
$exit = TrayCreateItem("Exit")
TraySetState()

GUISetState()

;-------Shows GUI and Controls-------
While 1
    $tmsg = TrayGetMsg()
    Switch $tmsg
        Case $Show
            If TrayItemGetText($Show) = 'Restore' Then
                GUISetState(@SW_SHOW, $GUI_Main)
                GUISetState(@SW_RESTORE, $GUI_Main)
                WinActivate($GUI_Main, '')
                TrayItemSetText($Show, 'Minimize')
            ElseIf TrayItemGetText($Show) = 'Minimize' Then
                GUISetState(@SW_HIDE, $GUI_Main)
                TrayItemSetText($Show, 'Restore')
            EndIf
        Case $exit
            CleanExit()
    EndSwitch
    $msg = GUIGetMsg()
    If $msg = $infoitem Then MsgBox(262208, "Super Launch  by   Jason Kingsley", "Please read the manual if you need any help!" & @CRLF & "" & @CRLF & "You can email me at Jason.Kingsley@Etelecare.com for questions or to report bugs!     " & @CRLF & "" & @CRLF & _
            "I hope this program has been helpful." & @CRLF & "" & @CRLF & "I want to thank the following for beta testing:" & @CRLF & "" & @CRLF & "Guillermo Rodriguez AKA Josh" & @CRLF & "Justin Dean" & @CRLF & "Elias Tenopala" & @CRLF & "Jarod Hayes" & @CRLF & "Eric Haese" & @CRLF & "" & @CRLF & _
            "" & @CRLF & "A Special Thanks to:" & @CRLF & "Steven Wichers - For his awesome programming skills and tips and much more!" & @CRLF & "Robert Park     - For giving me time to work on this!" & @CRLF & "" & @CRLF & "", 60)
    If $msg = $hotkeyitem Then MsgBox(262208, "Hot Keys List", "These are the Hot Keys you have access to." & @CRLF & "" & @CRLF & "Numpad+  Increases transpareny" & @CRLF & "" & @CRLF & "Numpad-   Decreases transparency" & @CRLF & "" & @CRLF & _
            "Numpad/      Remove transparency" & @CRLF & "" & @CRLF & _
            "Numpad*      Full Transparency" & @CRLF & "" & @CRLF & "WinKey+S   Hide/Show Super Launch" & @CRLF & "" & @CRLF & "CTRL+END   Force program to Terminate" & @CRLF & "" & @CRLF & "{F3}           Paste to Customer" & @CRLF & "" & @CRLF & _
            "{F6}             Launch Original Notepad")
    If $msg = $OptionsItem Then MsgBox(0, "Coming Soon", "This feature will come soon." & @CRLF & "" & @CRLF & "This will allow you to turn functions on or off")
    If $msg = $exititem Then CleanExit()
    Switch $msg
        Case $GUI_EVENT_MINIMIZE
            GUISetState(@SW_HIDE, $GUI_Main)
            TrayItemSetText($Show, 'Restore')
        Case $GUI_EVENT_CLOSE
            CleanExit()
        Case $LaunchIDD1
           ;LaunchIDD()
        Case $LaunchTimeStamp1
           ;LaunchTimeStamp1()
        Case $LaunchFusion1
           ;LaunchFusion()
        Case $LaunchSDC
           ;LaunchSDC()
        Case $LaunchDSN1
           ;LaunchDSN1()
        Case $LaunchDellserv1
           ;LaunchDellserv()
        Case $LaunchWebOutlook
           ;LaunchWebOutlook()
        Case $LaunchAll
           ;LaunchAll()
        Case $SetRes
           ;ChangeRes()
        Case $LaunchProcessExplorer
           ;ProcessExplorer()
        Case $NotepadPlus
           ;LaunchNotepadplus()
        Case $PasteCustomerScreen
           ;SuperPaste()
        Case $LaunchNotepad
           ;LaunchNotepad()
        Case $TimerStart
            If $activeTimer <> "" then ContinueLoop;will skip the next bit cos there is a timer running
            $timer2 = TimerInit()
            AdlibEnable("Timer", 50)
            $ActiveTimer = "Some count up Timer?"
        Case $TimerStop
            If $activeTimer = "" then Continueloop;no timer running so skip the next bit
            StopTimer()
            $ActiveTimer = ""
        Case $BreakTimer
            If $activeTimer <> "" then ContinueLoop;will skip the next bit cos there is a timer running
            If $CheckBreak = "" Then $CheckBreak = CreateBreakTime()
            $BreakUsed = IniRead($File_Location,"Timers","BreakTimeRemain",0)
            $BTstart = TimerInit()
            AdlibEnable("BreakTimer", 50)
            $activeTimer = "Break Timer"
        Case $LunchTimer
            If $activeTimer <> "" then Continueloop;will skip the next bit cos there is a timer running
            If $CheckLunch = "" Then $CheckLunch = CreateLunchBreakTime()
            $LunchUsed = IniRead($File_Location,"Timers","LunchTimeRemain",0)
            $LTstart = TimerInit()
            AdlibEnable("LunchTimer", 50)
            $activeTimer = "Lunch Timer"
        Case $CheckboxAll
            $ischeckall = GUICtrlRead($CheckboxAll)
            If $ischeckall = $GUI_CHECKED Then
               ;CheckAll()
            Else
               ;UnCheckAll()
            EndIf
        Case Else
           ;-------------;
    EndSwitch

WEnd
;-----Create Lunch Break Time-----
Func CreateLunchBreakTime()
    $SetLunchTime = InputBox("Break Time", "How Long is your Lunch in minutes?", "60", "", 100, 135)
    IniWrite($File_Location, "Timers", "LunchTime", $SetLunchTime)
    Return $SetLunchTime
EndFunc  ;==>CreateLunchBreakTime

;-----Create Break Time-----
Func CreateBreakTime()
    $SetBreakTime = InputBox("Break Time", "How Long is your Break in minutes?", "15", "", 100, 135)
    IniWrite($File_Location, "Timers", "BreakTime", $SetBreakTime)
    Return $SetBreakTime
EndFunc  ;==>CreateBreakTime

;----Timer------
Func Timer()
    _TicksToTime(Int(TimerDiff($timer2)), $Hour, $Mins, $Secs)
    Local $sTime = $Time ; save current time to be able to test and avoid flicker..
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $Time = ToolTip($TimeLabel)
    If BitAnd (GuiCtrlGetState($Ticker),$Gui_Hide) then GuiCtrlSetState($ticker,$Gui_Show)
    If GuiCtrlRead($ticker) <> $TimeLabel then GUICtrlSetData( $ticker, $TimeLabel)
   ;$ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
    If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
EndFunc  ;==>Timer


;----Stop active timer and display time----
Func StopTimer()
    AdlibDisable()
    If $activeTimer = "Break Timer" Then
        If $BreakUsed > 0 then 
            $Remaining = $BreakUsed - Int(TimerDiff($BTstart))
        Else
            $remaining = ($CheckBreak  * 60 * 1000) - Int(TimerDiff($BTstart) )
            EndIf
        IniWrite($File_Location, "Timers", "BreakTimeRemain", $remaining)
    ElseIf $activeTimer = "Lunch Timer" Then;Lunch timer
            If $LunchUsed > 0 then 
            $Remaining = $LunchUsed - Int(TimerDiff($LTstart))
        Else
            $remaining = ($CheckLunch  * 60 * 1000) - Int(TimerDiff($LTstart) )
            EndIf
        IniWrite($File_Location, "Timers", "LunchTimeRemain", $remaining)
    EndIf
    GUICtrlSetData($ticker, "00:00:00")
    GUICtrlSetState($ticker, $Gui_hide)
    ToolTip("")
    AdlibEnable("stoptimeout")
EndFunc  ;==>StopTimer

;----Break Timer------
Func BreakTimer()
    
    If $BreakUsed > 0 then ;some of Break time is already used up
         _TicksToTime(Int(($BreakUsed) - TimerDiff($BTstart)), $Hour, $Mins, $Secs);change $CheckBreak to MIlliseconds
        Else
        _TicksToTime(Int(($CheckBreak *60 *1000) - TimerDiff($BTstart)), $Hour, $Mins, $Secs);change $CheckBreak to MIlliseconds
    Endif
    
    Local $sTime = $Time 
    $mPos = MouseGetPos()
    
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $Time = ToolTip($TimeLabel, $mPos[0] + 13, $mPos[1] + 17, "Break Timer")
   ;$ticker = GUICtrlCreateLabel("00:00:00", 120, 200) need to put this int he guicreation not here
    If BitAnd (GuiCtrlGetState($Ticker),$Gui_Hide) then GuiCtrlSetState($ticker,$Gui_Show)
    If GuiCtrlRead($ticker) <> $TimeLabel then GUICtrlSetData( $ticker, $TimeLabel)
   ;If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
   ;If $Mins = $CheckBreak - 5 And $Secs = 0 Then MsgBox(262208, "", "5 minutes remaining", 5)
   ;If $Mins = $CheckBreak - 1 And $Secs = 0 Then MsgBox(262208, "", "1 minute remaining." & @CRLF & "Please get ready to auto in!", 3)
    If $TimeLabel = "00:00:00" Then
        MsgBox(262208, "", "Break is up!." & @CRLF & "You should be logged in by now!")
        IniWrite($File_Location, "Timers", "BreakTimeRemain", "0")
        $activeTimer = ""
        GuiCtrlSetState($ticker,$Gui_hide)
        AdlibDisable()
        ToolTip("")
        AdlibEnable("stoptimeout")
    EndIf
EndFunc  ;==>BreakTimer

;----Timer------
Func LunchTimer()
    If $LunchUsed > 0 then;some of lunch time is already used up
         _TicksToTime(Int(($LunchUsed) - TimerDiff($LTstart)), $Hour, $Mins, $Secs);change $CheckBreak to MIlliseconds
        Else
        _TicksToTime(Int($CheckLunch * 60 * 1000 - TimerDiff($LTstart)), $Hour, $Mins, $Secs)
    EndIf
    
    Local $sTime = $Time 
    $mPos = MouseGetPos()
    
    $TimeLabel = StringFormat("%02i:%02i:%02i", $Hour, $Mins, $Secs)
    $Time = ToolTip($TimeLabel, $mPos[0] + 13, $mPos[1] + 17, "Lunch Timer")
   ;$ticker = GUICtrlCreateLabel("00:00:00", 120, 200)
    If BitAnd (GuiCtrlGetState($Ticker),$Gui_Hide) then GuiCtrlSetState($ticker,$Gui_Show)
    If GuiCtrlRead($ticker) <> $TimeLabel then GUICtrlSetData( $ticker, $TimeLabel)
    
   ;If $sTime <> $Time Then GUICtrlSetData( $ticker, $TimeLabel)
    If $TimeLabel = "00:05:00" Then MsgBox(262208, "", "5 minutes remaining", 5)
    If $TimeLabel = "00:01:00" Then
        $LunchTimeStamp = MsgBox(4, "", "1 minute remaining." & @CRLF & "Would you like to launch Time Stamp?", 10)
        If $LunchTimeStamp = 6 Then
           ;LaunchTimeStamp1()
        Else
        EndIf
    EndIf
    If $TimeLabel = "00:00:00" Then
        MsgBox(262208, "", "Lunch is up!." & @CRLF & "You should be Time Stamped and logged in by now!")
        IniWrite($File_Location, "Timers", "LunchTimeRemain", "0")
        $activeTimer = ""
        GuiCtrlSetState($ticker,$Gui_hide)
        AdlibDisable()
        ToolTip("")
        AdlibEnable("stoptimeout")
    EndIf
EndFunc  ;==>LunchTimer

;-----Close Program-----
Func CleanExit()
    GUISetState(@SW_HIDE)
    Exit
EndFunc  ;==>CleanExit

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

I am going to create a small button next to break timer and lunch timer that allow you to reset the time back to default.

Edited by Klexen

Share this post


Link to post
Share on other sites

I am going to create a small button next to break timer and lunch timer that allow you to reset the time back to default.

Okay I made the buttons, they work great. :whistle: Everything is perfect! Thanks so much for the help!! Well basically doing it for me!

Code below is what I used.

Func ResetBreakTimer()
    $BreakUsed = $CheckBreak * 60000
    IniWrite($File_Location, "Timers", "BreakTimeRemain", $BreakUsed)
EndFunc   ;==>ResetBreakTimer

Func ResetLunchTimer()
    $LunchBreakUsed = $CheckLunch * 60000
    IniWrite($File_Location, "Timers", "LunchTimeRemain", $LunchBreakUsed)
EndFunc   ;==>ResetLunchTimer

Share this post


Link to post
Share on other sites

Okay I made the buttons, they work great. :whistle: Everything is perfect! Thanks so much for the help!! Well basically doing it for me!

Code below is what I used.

Func ResetBreakTimer()
    $BreakUsed = $CheckBreak * 60000
    IniWrite($File_Location, "Timers", "BreakTimeRemain", $BreakUsed)
EndFunc   ;==>ResetBreakTimer

Func ResetLunchTimer()
    $LunchBreakUsed = $CheckLunch * 60000
    IniWrite($File_Location, "Timers", "LunchTimeRemain", $LunchBreakUsed)
EndFunc   ;==>ResetLunchTimer
No Problem, You could have just set the LunchTimeRemain and BreakTimeRemain to 0 in the ini file, the code I wrote sets them to 0 when there not in use and when the timer runs out it sets them to 0

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