Code: Select all
;;;;;;;;;;;;;;;;;;;;;;;;;;HEADER;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Name .........: Notmaker-v3.3
; Description ..: A Notmaker that will sent info to a log file and send to clipboard for pasting to notes, ticket etc..
; Language .....: English (en-US)
; Author .......: M R
; Created .....: 4/1/2018
; Filename .....: NTONMv3.3.ahk
;;;;;;;;;;;;;;;;;;;;;;;Changelog;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; 4/13/2018 added stopwatch
; working so far
; 4/14/2018 added name of app to title.
; 4/14/2018 changed font size of stopwatch
; 4/22/2018 Added ",%A_MyDocuments%\TESTLOG.txt" to end of fileappend
; 4/24/2018 Added a date stamp at top of text file, but not clipboard
; 6/3/2018 Added <br> to clipboard code for VxField formatting
;
;;;;;;;;;;;;;;;;;StopWatch Special Instructions;;;;;;;;;;;;;;;;;
SetBatchLines, -1
; Some variables
ElapsedTime := A_YYYY ; initialize ElapsedTime, it will be treated as YYYY0101000000
BalanceTime := 0 ; initialize BalanceTime (time not counted yet)
;;;;;;;;;;;;;;;;;;;;;;;;;;Main GUI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Gui, Color, gray ; Color of GUI background
;---------------------------------------------------------------
Gui, font, s14 bold cred
Gui, Add, Text,, "Greeting go here...."
Gui, font
;---------------------------------------------------------------
Gui, font, s10 bold
Gui, Add, Text, x6 y74, Tech Name:
Gui, font, s10 norm
Gui, Add, Edit, x92 y70 w230 h25 vone
;---------------------------------------------------------------
Gui, font, s10 bold
Gui, Add, Text, x28 y108, Tech ID:
Gui, font, s10 norm
Gui, Add, Edit, x92 y104 w230 h25 vtwo
;---------------------------------------------------------------
Gui, font, s10 bold
Gui, Add, Text, x13 y142, Tech CBR:
Gui, font, s10 norm
Gui, Add, Edit, x92 y138 w230 h25 vthree
;---------------------------------------------------------------
Gui, font, s10 bold
Gui, Add, Text, x40 y176, TTN #:
Gui, font, s10 norm
Gui, Add, Edit, x92 y172 w230 h25 vfour
;---------------------------------------------------------------
Gui, font, s10 bold
Gui, Add, Text, x27 y210, CX BTN:
Gui, font, s10 norm
Gui, Add, Edit, x92 y206 w230 h25 vfive
;---------------------------------------------------------------
Gui, font, s10 bold
Gui, Add, Text, x32 y244, CX USI:
Gui, font, s10 norm
Gui, Add, Edit, x92 y240 w230 h25 vsix
;---------------------------------------------------------------
Gui, font, s10 bold
Gui, Add, Text, x22 y278, Remarks:
Gui, font, s10 norm
Gui, Add, Edit, x92 y274 w340 h200 vseven
;---------------------------------------------------------------
Gui, Add, Button, default, SUBMIT ; Submit button will send to clipboard and log file
Gui, Show, w450 h680 ; Size of GUI window
Gui, Show, , NoteMakr v3.3 ; Name showing in Title of GUI
;;;;;;;;;;;;;;;;;;;;;;;;;StopWatch GUI;;;;;;;;;;;;;;;;;;;;;;;;;;
Gui, Add, Text, ; added line space
Gui, Font, S24 CDefault Bold, Verdana
Gui, Add, Text, x+50 vDisplayTime, 00:00
Gui, Font, S12, Verdana
Gui, Add, Text,
Gui, Add, Button, x+0 yp w80 h30 vBtnStartStop gStartStop Default, Start
Gui, Add, Button, x+2 yp w80 h30 vBtnReset gReset, Reset
;;;;;;;;;;;;;;;;;;;;;;;;;;Author INFO;;;;;;;;;;;;;;;;;;;;;;;;;;;
Gui, font, s10 bold
Gui, Add, Text, x300 y660, Created: by Author ; author note on GUI
Gui, font
Return
;;;;;;;;;;;;;;;;;;;;;;StopWatch FUNCTIONS;;;;;;;;;;;;;;;;;;;;;;;
; BtnStartStop label
StartStop:
GuiControlGet, BtnStartStop ; get the caption of the button
If (BtnStartStop = "Start") { ; if it is "Start"
StartTickCount := A_TickCount - BalanceTime ; initialize StartTickCount
SetTimer, StopWatch, 10 ; start the timer called every 10 ms to be accurate
GuiControl, , BtnStartStop, Stop ; set the caption to Stop
} Else { ; it should be "Stop"
BalanceTime := A_TickCount - StartTickCount ; memorize the balance time not counted yet
SetTimer, StopWatch, Off ; stop the timer
GuiControl, , BtnStartStop, Start ; set the caption to "Start"
}
Return
; BtnReset label
Reset:
SetTimer, StopWatch, Off ; stop the timer
GuiControl, , BtnStartStop, Start ; set the caption of BtnStartStop to "Start"
GuiControl, , DisplayTime, 00:00 ; initialize DisplayTime
ElapsedTime := A_YYYY ; initialize ElapsedTime, it will be treated as YYYY0101000000
BalanceTime := 0 ; initialize BalanceTime
GuiControl, Focus, BtnStartStop ; set the focus on BtnStartStop
GuiControl, -Default, BtnReset ; remove the BS_DEFPUSHBUTTON (default) style
GuiControl, +Default, BtnStartStop ; set the BS_DEFPUSHBUTTON (default) style
Return
; Timer routine
StopWatch:
If ((A_TickCount - StartTickCount) >= 1000) { ; if current tickcount - StartTickCount >= 1000 (i.e. 1 second)
StartTickCount += 1000 ; add 1000 ms (1 second) to StartTickCount
ElapsedTime += 1, S ; add 1 second to ElapsedTime
FormatTime, DisplayTime, %ElapsedTime%, mmm:ss ; format ElapsedTime to mmm:ss
GuiControl, , DisplayTime, %DisplayTime% ; update DisplayTime
}
Return
;;;;;;;;;;;;;;;;;;;;;;;;StopWatch FUNCTIONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
ButtonSUBMIT: ; Submit Button to log file in sam directory of app
Gui, Submit, NoHide
;;;;;;;;;;;;;;;;;;;;;;;;NT Online Notmaker FUNCTIONS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
FileCreateDir, %A_MyDocuments%\my-logs ; This will create the folder in my documents folder under the current user login
FileAppend, Date: %A_MM%/%A_DD%/%A_YYYY%`n`nNT @CA ATS:: `n`nTech Name: %one% Tech ID: %two% Tech CBR: %three%`n`n*** Remarks: %seven%`n`n___________________`n`nTTN #: %four%`nCX BTN: %five%`nCX USI: %six%`n`n****************************************`n`n,%A_MyDocuments%\my-logs\onlinelog.txt
clipboard = NT @CA ATS::<br><br>`n`nTech Name: %one% Tech ID: %two% Tech CBR: %three%<br><br>`n`n*** Remarks: %seven%<br><br>`n`n___________________<br><br>`n`nTTN #: %four%<br>`nCX BTN: %five%<br>`nCX USI: %six%<br><br>`n`n****************************************<br><br>`n`n
Loop, 7
GuiControl,,Edit%A_index%,
Return
^SPACE:: Winset, Alwaysontop, , A
GuiClose: ; Will close app out
ExitApp