Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.64 KB | None | 0 0
  1. #Include Csv.ahk
  2. #NoEnv
  3. SetWorkingDir %A_ScriptDir%
  4.  
  5.  
  6. promptedSuccessLength()
  7. {
  8. global
  9. return CurrentCycleLength + 60
  10. }
  11.  
  12.  
  13.  
  14. volunteeredFailureLength()
  15. {
  16. global
  17. return 60
  18. }
  19.  
  20.  
  21. promptedFailureLength()
  22. {
  23. ;msgbox entered prompted failure length
  24. return 60
  25. }
  26.  
  27.  
  28.  
  29.  
  30.  
  31. voluntaryResumeLength()
  32. {
  33. global
  34. return 60
  35. }
  36.  
  37. forcedResumeLength()
  38. {
  39. global
  40. return 60
  41. }
  42.  
  43.  
  44.  
  45.  
  46.  
  47. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  48.  
  49.  
  50.  
  51.  
  52.  
  53. boundCycleLength()
  54. {
  55. global
  56. if(currentCycleLength < cycleFloor)
  57. {
  58.  
  59. ;msgbox applied cycle bound
  60. currentCycleLength := cycleFloor
  61. }
  62. if (currentCycleLength > cycleCeiling)
  63. {
  64.  
  65. msgbox applied cycle bound
  66. currentCycleLength := cycleCeiling
  67. }
  68. }
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78. #Persistent
  79. ;msgbox Start
  80.  
  81.  
  82. consecutiveFocusSeconds := 0
  83.  
  84. ; TODO generalize task padding length (25)
  85. ; TODO Choose Cycle Alterations, Speed bump, etc.
  86. ; TODO Running Debug
  87.  
  88.  
  89. ; TODO Cancel Activity
  90. ; TODO DeterminateTask
  91. ; TODO BrainDump
  92.  
  93. ; TODO Clock Align and Clock Report Time
  94. ; TODO Smart Speed Bumps?
  95. ; TODO Subtasking
  96. ; TODO RandomReminders
  97. ; TODO RandomTimers, NewTaskAt
  98. ; TODO Distraction Tabbing
  99.  
  100. ;makes inputboxes on top
  101. Gui +LastFound +OwnDialogs +AlwaysOnTop
  102.  
  103. goSub IniRead
  104. CSV_Load("OpenTasks.csv",OpenTasks,",")
  105. %OpenTasks%CSV_TotalCols := 5
  106. CSV_Load("FinishedTasks.csv",FinishedTasks,",")
  107. %FinishedTasks%CSV_TotalCols := 5
  108. CSV_Load("AbandonedTasks.csv",AbandonedTasks,",")
  109. %AbandondedTasks%CSV_TotalCols := 5
  110.  
  111.  
  112.  
  113. ;Determine How Long The Program Was Not Running For!
  114. x := A_Now
  115. EnvSub, x, %LastNow%, Seconds
  116. SecondsAsleep := x
  117. TotalSecondsElapsed := TotalSecondsElapsed + SecondsAsleep
  118. ;Padding := nChar(ceil(CycleCeiling/60)," ")
  119. FileAppend,`n`nProgram Off for %SecondsAsleep%s.`n`n%A_Now%, gtimer.log
  120.  
  121.  
  122. ;intialize values
  123. inWorkCycle := 0
  124. inBreak := 0
  125.  
  126. SetTimer, EverySecondDo, 1000, 2147483647
  127. Gosub, CycleStart
  128. return
  129.  
  130.  
  131. breakString()
  132. {
  133. global
  134. ConsecutiveBreakMinutes := Ceil(ConsecutiveBreakSeconds/ 60)
  135. StringLen, sumChars, ConsecutiveBreakMinutes
  136. BreakMinutesElapsed := Ceil(BreakSecondsElapsed / 60)
  137. CycleCeilingInMinutes := Ceil(CycleCeiling / 60)
  138. Padding := CycleCeilingInMinutes - BreakMinutesElapsed
  139. nChar := nChar(BreakMinutesElapsed,0)
  140. nCharPad := nchar(Padding," ")
  141. blankTask := nChar(25," ")
  142. String := "`t" . blankTask . "`t" . nChar . nCharPad . "`t" . ConsecutiveBreakMinutes
  143. return String
  144. }
  145.  
  146.  
  147. updateTaskNow:
  148. TaskRow := CSV_MatchCellColumn(OpenTasks,TASK,1)
  149. if( TaskRow == 0)
  150. {
  151. CSV_AddRow(OpenTasks,TASK . "," . A_Now . "," . A_Now . ",0,0")
  152. } else {
  153. CSV_ModifyCell(OpenTasks,A_Now,TaskRow,3)
  154. TaskActiveSeconds := 1 + CSV_ReadCell(OpenTasks,TaskRow,4)
  155. CSV_ModifyCell(OpenTasks,TaskActiveSeconds,TaskRow,4)
  156. }
  157. CSV_Save("OpenTasks.csv",OpenTasks,1)
  158. return
  159.  
  160. AddTaskFocusTime(Time){
  161. global TASK
  162. TaskRow := CSV_MatchCellColumn(OpenTasks,TASK,1)
  163. TaskFocusSeconds := Time + CSV_ReadCell(OpenTasks,TaskRow,5)
  164. ;msgbox taskrow %taskrow% time %time% taskfocus seonds %taskfocusseconds%
  165. CSV_ModifyCell(OpenTasks,TaskFocusSeconds,TaskRow,5)
  166. }
  167.  
  168.  
  169. isInitialSegment(A,B)
  170. {
  171. ;msgbox %A% %B%
  172. if (RegExMatch(B,"^" . A))
  173. {
  174. ;msgbox is initial
  175. return 1
  176. } else {
  177. ;msgbox notintial
  178. return 0
  179. }
  180. }
  181.  
  182. getAggregateTaskLastNow()
  183. {
  184. global TASK
  185. AggregateTaskLastNow := 16010101000000
  186. rows := CSV_TotalRows(OpenTasks)
  187. currentRow := 1
  188. while (currentRow <= rows)
  189. {
  190. rowTask := CSV_ReadCell(OpenTasks,currentRow,1)
  191. if(isInitialSegment(TASK,rowTask))
  192. {
  193. rowLastNow := CSV_ReadCell(OpenTasks,currentRow,3)
  194. x := rowLastNow
  195. ;msgbox %rowLastNow% %AggregateTaskLastNow%
  196. EnvSub, x, %AggregateTaskLastNow%, Seconds
  197. ;msgbox %x%
  198. if(x>0)
  199. {
  200. AggregateTaskLastNow := rowLastNow
  201. }
  202. }
  203. currentRow++
  204. }
  205. return AggregateTaskLastNow
  206. }
  207.  
  208.  
  209. getAggregateTaskActiveTime()
  210. {
  211. global TASK
  212. AggregateTaskActiveTime := 0
  213. rows := CSV_TotalRows(OpenTasks)
  214. currentRow := 1
  215. while (currentRow <= rows)
  216. {
  217. rowTask := CSV_ReadCell(OpenTasks,currentRow,1)
  218. if(isInitialSegment(TASK,rowTask))
  219. {
  220. rowActiveTime := CSV_ReadCell(OpenTasks,currentRow,4)
  221. AggregateTaskActiveTime := AggregateTaskActiveTime + rowActiveTime
  222. }
  223. currentRow++
  224. }
  225. return AggregateTaskActiveTime
  226. }
  227.  
  228.  
  229. getAggregateTaskFocusTime()
  230. {
  231. global TASK
  232. AggregateTaskFocusTime := 0
  233. rows := CSV_TotalRows(OpenTasks)
  234. currentRow := 1
  235. while (currentRow <= rows)
  236. {
  237. rowTask := CSV_ReadCell(OpenTasks,currentRow,1)
  238. if(isInitialSegment(TASK,rowTask))
  239. {
  240. rowFocusTime := CSV_ReadCell(OpenTasks,currentRow,5)
  241. AggregateTaskFocusTime := AggregateTaskFocusTime + rowFocusTime
  242. }
  243. currentRow++
  244. }
  245. return AggregateTaskFocusTime
  246. }
  247.  
  248. getAggregateTaskFirstNow()
  249. {
  250. global TASK
  251. TaskRow := CSV_MatchCellColumn(OpenTasks,TASK,1)
  252. StartTime := CSV_ReadCell(OpenTasks,TaskRow,2)
  253. return StartTime
  254. }
  255.  
  256.  
  257. Close::
  258. global TASK
  259.  
  260. childFocusTime := getAggregateTaskFocusTime()
  261. childActiveTime := getAggregateTaskActiveTime()
  262. childLastNow := getAggregateTaskLastNow()
  263. childFirstNow := getAggregateTaskFirstNow()
  264.  
  265. CSV_AddRow(closeType . "Tasks",TASK . "," . childFirstNow . "," . childLastNow . "," . childActiveTime . "," . childFocusTime
  266. CSV_Save("FinishedTasks.csv",FinishedTasks,1)
  267. CSV_Save("AbandonedTasks.csv",AbandonedTasks,1)
  268.  
  269. TASKlen := StringLen(TASK)
  270. maxLen := 0
  271. maxLenRow := 0
  272. rows := CSV_TotalRows(OpenTasks)
  273. currentRow := 1
  274. while (currentRow <= rows)
  275. {
  276. rowTask := CSV_ReadCell(OpenTasks,currentRow,1)
  277. if(isInitialSegment(rowTask,TASK))
  278. {
  279. rowLen := StringLen(rowTask)
  280.  
  281. if (rowLen < TASKlen)
  282. {
  283. if(rowLen > maxLen)
  284. {
  285. maxLen := rowLen
  286. maxLenRow := currentRow
  287. }
  288. }
  289.  
  290.  
  291. }
  292. if(isInitialSegment(TASK,rowtask)
  293. {
  294. CSV_DeleteRow(CSV_Identifier,currentRow)
  295. }
  296.  
  297. currentRow++
  298. }
  299. if (maxLen != 0)
  300. {
  301. parentRow := maxLenRow
  302. parentFocusTime := CSV_ReadCell(OpenTasks,parentRow,5)
  303. parentActiveTime := CSV_ReadCell(OpenTasks,parentRow,4)
  304. parentLastNow := CSV_ReadCell(OpenTass,parentRow,3)
  305. newParentFocusTime := parentFocusTime + childFocusTime
  306. newParentActiveTime := parentActiveTime + childActiveTime
  307.  
  308. x := parentLastNow
  309. EnvSub, x, %childLastNow%, Seconds
  310. if (x < 0)
  311. {
  312. newParentLastNow := childLastNow
  313. } else {
  314. newParentLastNow := parentLastNow
  315. }
  316.  
  317. CSV_ModifyCell(OpenTasks,newParentLastNow,parentRow,3)
  318. CSV_ModifyCell(OpenTasks,newParentActiveTime,parentRow,4)
  319. CSV_MOdifyCell(OpenTasks,newParentFocusTie,parentRow,5)
  320. }
  321.  
  322.  
  323.  
  324.  
  325. }
  326.  
  327.  
  328. EverySecondDo:
  329.  
  330. ;restart the script if it appears to have been asleep for more than 5 seconds
  331. x := A_Now
  332. EnvSub, x, %lastNow%, Seconds
  333. if(x > 10)
  334. {
  335. FileAppend,`n`nThe Program Appears to have been inactive for more than 10 seconds. Restarting.`n,gtimer.log
  336. reload
  337. }
  338.  
  339.  
  340. lastNow := A_Now
  341. gosub IniWrite
  342. TotalSecondsElapsed++
  343. if (inWorkCycle)
  344. {
  345. gosub updateTaskNow
  346. BreakSecondsElapsed := 0
  347. ConsecutiveBreakSeconds := 0
  348. CycleSecondsElapsed++
  349. ConsecutiveFocusSeconds++
  350. if(ConsecutiveFocusSeconds > LongestConsecutiveFocus){
  351. LongestConsecutiveFocus := ConsecutiveFocusSeconds
  352. }
  353.  
  354. }
  355. if (inBreak)
  356. {
  357. BreakSecondsElapsed++
  358. ConsecutiveFocusSeconds := 0
  359. ConsecutiveBreakSeconds++
  360. if(ConsecutiveBreakSeconds > LongestConsecutiveBreak)
  361. {
  362. LongestConsecutiveBreak := ConsecutiveBreakSeconds
  363. }
  364. BREAKTIME--
  365. if (OutOfFreeTime())
  366. {
  367. Suspend On
  368. inBreak := 0
  369. MsgBox, 262144, ,No Break time is left!
  370. ;not sure about these two lines
  371. CurrentCycleLength := forcedResumeLength()
  372. str := breakString()
  373. FileAppend,%str%, gtimer.log
  374. FileAppend,`t(Forced), gtimer.log
  375. SetTimer, CycleStart, -1
  376. Suspend Off
  377.  
  378. }
  379. if (BREAKTIME < 0)
  380. {
  381. inBreak := 0
  382. SetTimer, PlannedBreakEnd, -1
  383. }
  384. }
  385. if (inWorkCycle & (CycleSecondsElapsed > CurrentCycleLength))
  386. {
  387. inWorkCycle := 0
  388. CycleSecondsElapsed := CurrentCycleLength
  389. SetTimer, CycleEnd, -1
  390. }
  391. return
  392.  
  393. plannedBreakEnd:
  394. str := breakString()
  395. FileAppend,%str%, gtimer.log
  396. FileAppend,`t(Prompted), gtimer.log
  397. Suspend On
  398.  
  399. BREAKTIME := 0
  400. MsgBox, 262148, ,that's the end of your planned break. Ready to resume focus?
  401. IfMsgBox, Yes
  402. SetTimer, CycleStart, -1
  403. IfMsgBox, No
  404. {
  405. inBreak := 0
  406. SetTimer, Break, -1
  407. }
  408. return
  409.  
  410. CycleStart:
  411. inbreak := 0
  412. inWorkCycle := 0
  413. Suspend, On
  414. CycleSecondsElapsed := -1
  415. boundCycleLength()
  416. ;SpeedBump("Until you've decided what course of action is best for you, close your eyes.")
  417. Gui +LastFound +OwnDialogs +AlwaysOnTop
  418.  
  419. mins := (CurrentCycleLength / 60)
  420. InputBox, TASK, ,What would be best`,`nFor you to do`,`nWithin the next:`n%mins% minutes?
  421. if(ErrorLevel)
  422. {
  423. inBreak := 0
  424. gosub break
  425. } else {
  426.  
  427. ;MsgBox, 262144,, Focus your mind for the next cycle (%CurrentCycleLength% seconds). Press Ok when you are ready.
  428. inWorkCycle := 1
  429. inBreak := 0
  430. Suspend, Off
  431. seconds := ceil(CurrentCycleLength)
  432. sizedTask := resizeString(TASK,25)
  433. FileAppend,`n%A_Now%`t%CurrentCycleLength%s`t%sizedTask%, gtimer.log
  434. }
  435. return
  436.  
  437.  
  438.  
  439.  
  440.  
  441. CycleString()
  442. {
  443. global
  444. ConsecutiveFocusMinutes := Floor(ConsecutiveFocusSeconds/ 60)
  445. StringLen, sumChars, ConsecutiveFocusMinutes
  446. CycleMinutesElapsed := Ceil(CycleSecondsElapsed / 60)
  447. CycleCeilingInMinutes := Ceil(CycleCeiling / 60)
  448. Padding := CycleCeilingInMinutes - CycleMinutesElapsed
  449. nChar := nChar(CycleMinutesElapsed,1)
  450. nCharPad := nchar(Padding," ")
  451. String := "`t" . nChar . nCharPad . "`t" . ConsecutiveFocusMinutes
  452. return String
  453. }
  454.  
  455. FailBox:
  456. ;speedBump("Close your eyes until you can remember what *first* distracted you.")
  457. Gui +LastFound +OwnDialogs +AlwaysOnTop
  458. mins := cycleSecondsElapsed/60
  459. InputBox, DISTRACTION, ,Of what you did that differed`nMuch from what you labelled:`n"%TASK%"`,`nHow would you label what you`nCan recall that differed earliest?
  460. FileAppend,`tDistraction:`t%DISTRACTION%, gtimer.log
  461. return
  462.  
  463.  
  464.  
  465. RShift & PgUp::
  466. CurrentCycleLength := 60
  467. RShift::
  468. Gosub EarlyCycleEnd
  469. return
  470.  
  471. RShift & PgDn::
  472. finish := 1
  473. closeType := "Finished"
  474. Gosub EarlyCycleEnd
  475. return
  476.  
  477. RShift & Esc::
  478. abandon := 1
  479. closeType := "Abandoned"
  480. Gosub EarlyCycleEnd
  481. return
  482.  
  483.  
  484.  
  485.  
  486.  
  487. EarlyCycleEnd:
  488. inWorkCycle := 0
  489. minlapsed := CycleSecondsElapsed/60
  490. minlength := CurrentCycleLength/60
  491. Suspend, On
  492. str := CycleString()
  493. FileAppend,%str%, gtimer.log
  494. FileAppend,`t(Voluntary) , gtimer.log
  495. ;SpeedBump("Cycle Ended Early. Until you've decided if, during this cycle, you did deviated from the task """ . TASK . """, close your eyes.")
  496. MsgBox, 262148, ,%minlength%-minute cycle ended`,`n%minlapsed%-minutes in.`n`nOf what you did, did any of it`,`ndiffer much from:`n`n"%TASK%"?
  497. IfMsgBox Yes
  498. {
  499. ;EARLY FAIL --- no focused time is logged, but time elapses
  500. CurrentCycleLength := volunteeredFailureLength()
  501. gosub FailBox
  502.  
  503.  
  504. }
  505. else
  506. {
  507. ;EARLY PASS
  508. TotalSecondsFocused := TotalSecondsFocused + CycleSecondsElapsed
  509. AddTaskFocusTime(CycleSecondsElapsed)
  510. ;FileAppend,`tSuccess!`t`t, gtimer.log
  511. }
  512. ;;moved the line below this down
  513. ;;** do I need this??CycleSecondsElapsed := CurrentCycleLength
  514. if (finish)
  515. {
  516. finish := 0
  517. gosub close
  518. }
  519. if (abaondon)
  520. {
  521. abandon := 0
  522. gosub close
  523. }
  524. gosub, CycleStart
  525. Suspend, Off
  526. return
  527.  
  528. CycleEnd:
  529. inWorkCycle := 0
  530. CycleSecondsElapsed := CurrentCycleLength
  531. Suspend, On
  532. str := CycleString()
  533. FileAppend,%str%, gtimer.log
  534. FileAppend,`t(Prompted), gtimer.log
  535. inWorkCycle := 0
  536. mins := CurrentCycleLength/60
  537. SpeedBump(mins . "-minute cycle through.`nDetermine whether what you did then`nDiffered much from:`n`n""" . TASK . """.")
  538. MsgBox, 262148, ,Of what you did, did any of it`,`ndiffer much from:`n"%TASK%"?
  539. IfMsgBox Yes
  540. Gosub Fail
  541. else
  542. Gosub Pass
  543. Suspend, Off
  544. return
  545.  
  546. Pass:
  547. Suspend, On
  548. TotalSecondsFocused := TotalSecondsFocused + CurrentCycleLength
  549. AddTaskFocusTime(CurrentCycleLength)
  550. CurrentCycleLength := promptedSuccessLength()
  551. ;Msgbox, 262144,, You Passed! Your cycle length is now %currentcyclelength%.
  552. ;FileAppend,`tSuccess!,`t gtimer.log
  553. Gosub, CycleStart
  554. Suspend, Off
  555. return
  556.  
  557. Fail:
  558. Suspend On
  559. CurrentCycleLength := promptedFailureLength()
  560. ;Msgbox,262144,, You Failed! Your cycle length is now %currentcyclelength%.
  561. Gosub, FailBox
  562. Gosub, CycleStart
  563. Suspend, Off
  564. return
  565.  
  566.  
  567. RShift & Ins::
  568. gosub Break
  569. return
  570.  
  571. Break:
  572. Suspend, On
  573. if (!inBreak)
  574. {
  575. if(inWorkCycle)
  576. {
  577. str := CycleString()
  578. FileAppend,%str%`t(Voluntary), gtimer.log
  579. }
  580. breakSecondsElapsed := 0
  581. inWorkCycle := 0
  582. avail := FreeSecondsAvailable() / 60
  583. Gui +LastFound +OwnDialogs +AlwaysOnTop
  584. InputBox, BREAKTIME, , You have %avail% minutes of free time earned. How many minutes do you want to break for? (You can resume work early by pressing 'break')
  585. BREAKTIME := BREAKTIME * 60
  586. LASTBREAKTIME := BREAKTIME
  587. inBreak := 1
  588. CycleSecondsElapsed := 0
  589. seconds := ceil(BREAKTIME)
  590. FileAppend,`n%A_Now%`t%seconds%s, gtimer.log
  591. } else if (inBreak)
  592. {
  593. inBreak := 0
  594. str := BreakString()
  595. FileAppend,%str%`t(Voluntary), gtimer.log
  596. CurrentCycleLength := voluntaryResumeLength()
  597. Gosub CycleStart
  598. }
  599. Suspend, Off
  600. return
  601.  
  602.  
  603.  
  604.  
  605.  
  606.  
  607.  
  608.  
  609.  
  610.  
  611.  
  612. SpeedBump(DecisionText){
  613. global SpeedBumpLength
  614. StartTick := A_TickCount
  615. Loop
  616. {
  617. if (SpeedBumpLength = 0)
  618. {
  619. break
  620. }
  621. MsgBox, 262144, , %DecisionText%
  622. IfMsgBox, OK
  623. ElapsedSeconds := (A_TickCount - StartTick)/1000
  624. if (ElapsedSeconds < SpeedBumpLength)
  625. {
  626. ;msgbox here1
  627. MsgBox, 262144,, You must close your eyes for at least %SpeedBumpLength% seconds. (%ElapsedSeconds% elapsed.)
  628. } else {
  629. break
  630. }
  631. }
  632. }
  633.  
  634.  
  635.  
  636.  
  637. OutOfFreeTime()
  638. {
  639. ;MsgBox Descriptive %Descriptive%
  640. global TotalSecondsFocused
  641. global TotalSecondsElapsed
  642. global TargetFocusPercentage
  643. global Descriptive
  644. if(Descriptive)
  645. {
  646. ;MsgBox Descriptive %Descriptive%
  647. return 0
  648. } else
  649. {
  650. return (TotalSecondsFocused/TotalSecondsElapsed < TargetFocusPercentage)
  651. }
  652. }
  653.  
  654.  
  655.  
  656.  
  657.  
  658. FreeSecondsAvailable()
  659. {
  660. global TotalSecondsFocused
  661. global TotalSecondsElapsed
  662. global TargetFocusPercentage
  663. return TotalSecondsFocused/TargetFocusPercentage - TotalSecondsElapsed
  664. }
  665.  
  666. TargetWorkBreakRatio()
  667. {
  668. global TargetFocusPercentage
  669. return (TargetFocusPercentage / (1 - TargetFocusPercentage) )
  670. }
  671.  
  672.  
  673. PercentTimeInFocus()
  674. {
  675. global TotalSecondsFocused
  676. global TotalSecondsElapsed
  677. return TotalSecondsFocused / TotalSecondsElapsed
  678. }
  679.  
  680.  
  681.  
  682.  
  683. ;#n::
  684. ; inputbox n
  685. ; inputbox char
  686. ; msgbox % nChar(n,char)
  687. ; return
  688.  
  689. nChar(n,char)
  690. {
  691. String := ""
  692. while(n>0)
  693. {
  694. String := String . char
  695. n--
  696. }
  697. return String
  698. }
  699.  
  700. IniRead:
  701. IniRead, LastNow, gtimer.ini, data, LastNow, %A_Now%
  702. IniRead, TotalSecondsElapsed, gtimer.ini, data, TotalSecondsElapsed,-1
  703. IniRead, CurrentCycleLength, gtimer.ini, data, CurrentCycleLength, 60
  704. IniRead, TotalSecondsFocused, gtimer.ini, data, TotalSecondsFocused, 0
  705. IniRead, TASK, gtimer.ini, data, TASK, ""
  706. IniRead, LongestConsecutiveBreak, gtimer.ini, data, LongestConsecutiveBreak, 0
  707. IniRead, LongestConsecutiveFocus, gtimer.ini, data, LongestConsecutiveFocus, 0
  708.  
  709. IniRead, Descriptive, gtimer.ini, options, Descriptive, 1
  710. IniRead, TargetFocusPercentage, gtimer.ini, options, TargetFocusPercentage, 0.125
  711. IniRead, CycleFloor, gtimer.ini, options, CycleFloor,10
  712. IniRead, CycleCeiling, gtimer.ini, options, CycleCeiling, 1800
  713. IniRead, SpeedBumpLength, gtimer.ini, options, SpeedBumpLength,2
  714. return
  715.  
  716.  
  717. IniWrite:
  718. IniWrite, %A_Now%, gtimer.ini, data, LastNow
  719. IniWrite, %TotalSecondsElapsed%, gtimer.ini, data, TotalSecondsElapsed
  720. IniWrite, %CurrentCycleLength%, gtimer.ini, data, CurrentCycleLength
  721. IniWrite, %TotalSecondsFocused%, gtimer.ini, data, TotalSecondsFocused
  722. IniWrite, %TASK%, gtimer.ini, data, TASK
  723. IniWrite, %LongestConsecutiveBreak%, gtimer.ini, data, LongestConsecutiveBreak
  724. IniWrite, %LongestConsecutiveFocus%, gtimer.ini, data, LongestConsecutiveFocus
  725.  
  726. IniWrite, %Descriptive%, gtimer.ini, options, Descriptive
  727. IniWrite, %TargetFocusPercentage%, gtimer.ini, options, TargetFocusPercentage
  728. IniWrite, %CycleFloor%, gtimer.ini, options, CycleFloor
  729. IniWrite, %CycleCeiling%, gtimer.ini, options, CycleCeiling
  730. IniWrite, %SpeedBumpLength%, gtimer.ini, options, SpeedBumpLength
  731. return
  732.  
  733.  
  734.  
  735.  
  736. Rshift & /::
  737. Suspend, On
  738. ;listvars
  739. temp := inWorkCycle
  740. inWorkCycle := 0
  741. ATLN := getAggregateTaskLastNow()
  742. ATAT := getAggregateTaskActiveTime()
  743. ATFT := getAggregateTaskFocusTime()
  744. String := "Cycle: " . CycleSecondsElapsed . " of " . CurrentCycleLength . "`nTotal: " . TotalSecondsElapsed . "`nEarned: " . FreeSecondsAvailable() . "`nTotal Seconds Focused: " . TotalSecondsFocused . "`nTarget Focus Percentage: " . TargetFocusPercentage . "`nFocus Percentage: " . PercentTimeInFocus() . "`nLongest Consecutive Break: " . LongestConsecutiveBreak . "`nLongest Consecutive Focus: " . LongestConsecutiveFocus . "`n`nAggregate Task Last Now: " . ATLN . "`nAggregate Task Active Time: " . ATAT . "`nAggregate Task Focus Time: " . ATFT
  745. MsgBox 262144, ,%String%
  746. IfMsgBox, Ok
  747. Suspend Off
  748. inWorkCycle := temp
  749. Suspend, Off
  750. return
  751.  
  752.  
  753. ;#r::
  754. ; Inputbox String
  755. ; Inputbox Size
  756. ; output := resizeString(String,Size)
  757. ; msgbox %output%
  758. ; return
  759.  
  760. resizeString(String,Size){
  761. StringLeft, Trunc, String, Size
  762. Pad := Size - StrLen(Trunc)
  763. out := Trunc . nchar(Pad," ")
  764. return out
  765.  
  766. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement