Last active
March 25, 2017 20:04
-
-
Save budRich/335286f3b923689a87c850e9a6eb4208 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
▄▄▄▄▄ ·▄▄▄▄ ▪ | |
•██ ▪ ▪ ██▪ ██ ██ | |
▐█.▪ ▄█▀▄ ▄█▀▄ ▐█· ▐█▌▐█· | |
▐█▌·▐█▌.▐▌▐█▌.▐▌██. ██ ▐█▌ | |
▀▀▀ ▀█▄▀▪ ▀█▄▀▪▀▀▀▀▀• ▀▀▀ | |
Run script to display a popup menu with | |
8 days. (yesterday + 1 week). | |
Select a day to open a markdown file | |
corresponding to that day. | |
Files are saved in folder "days\". | |
https://autohotkey.com/boards/viewtopic.php?f=6&t=25393 | |
*/ | |
GoSub, Init | |
global cf := {} | |
cf.name := "Toodi" | |
cf.authour := "budRich" | |
cf.version := "0.0.1" | |
cf.updated := "2016.12.08" | |
;cf.editor := "notepad" | |
cf.editor := "C:\Program Files\Sublime Text 3\Sublime_Text.exe" | |
BuildMenu() | |
ShowMenu() | |
ExitApp | |
; ////////// FUNCTIONS ///////////////////// | |
BuildMenu() | |
{ | |
day := A_YYYY . A_MM . A_DD | |
EnvAdd, day,% -1, days | |
AddDay(day) | |
Menu, tdmen, add | |
Loop 7 | |
{ | |
day := A_YYYY . A_MM . A_DD | |
EnvAdd, day,% A_Index-1, days | |
AddDay(day) | |
} | |
Menu, tdmen, add | |
Menu, tdmen, add, Specific Date, Specific | |
} | |
ShowMenu() | |
{ | |
Menu, tdmen, show | |
} | |
AddDay(day) | |
{ | |
FormatTime, dname, %day%, dddd | |
FormatTime, dnum, %day%, dd | |
FormatTime, dmon, %day%, MM | |
n := dname A_Tab dnum "/" dmon | |
Menu, tdmen, add, %n%, SelectDay | |
} | |
SelectDay() | |
{ | |
;m := A_MM + selected_day < A_DD ? 1 : 0 | |
y := A_YYYY + (SubStr(A_ThisMenuItem, -1, 2) < A_MM ? 1 : 0) | |
OpenDay(y . SubStr(A_ThisMenuItem, -1, 2) . SubStr(A_ThisMenuItem, -4, 2)) | |
} | |
OpenDay(day) | |
{ | |
If !InStr(FileExist("days"), "D") | |
FileCreateDir, days | |
Run,% cf.editor " " f := ("days\" day ".md") | |
} | |
Specific() | |
{ | |
InputBox, day, Enter Date, Enter Date (YYYYMMDD):, ,150 , 150, , , , ,% A_YYYY . A_MM . A_DD | |
OpenDay(day) | |
} | |
; ////////// INITIALIZATIONE //////////// | |
Init: | |
#SingleInstance force | |
#NoEnv | |
#Persistent | |
SetBatchLines, -1 | |
SetControlDelay, -1 | |
SetWinDelay, -1 | |
ListLines, Off | |
SetWorkingDir, %A_ScriptDir% | |
DetectHiddenWindows, Off | |
OnExit, DEATH | |
CoordMode, Menu, Screen | |
global nl = "`n" | |
cmd1 = %1% | |
cmd2 = %2% | |
Loop, Files, %A_ScriptDir%\*.ico | |
i := A_LoopFileName | |
if FileExist(i) | |
Menu, Tray, Icon, %i% | |
return | |
; ////////////// DEATH //////////////// | |
DEATH: | |
ExitApp |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment