/* This script sets up Hotstrings which add the date for the coming day of the week to any document or edit field. It uses the letter "d" (date) followed by the abbreviation for the weekday and a format number (e.g. dsun2—all lowercase letter) as the Hotstring. (Currently only two formats—"5-20-18" and "Sunday, May 20, 2018".) Each Hotstring calls the function Weekday() which calculates the next weekday number, then the date. Following this first script, see the AddNextWeekday script which uses an Input statement and menu to input any weekday for the next four weeks. Activate the Hotkey (CTRL+ALT+N) and enter the first three characters for the chosen day of the week. List both American and British date formats. */ ; These first variable values used by the Input statement in the second script. sun := 1 mon := 2 tue := 3 wed := 4 thu := 5 fri := 6 sat := 7 :c*:dsun1:: Weekday(1,1) Return :c*:dmon1:: Weekday(2,1) Return :c*:dtue1:: Weekday(3,1) Return :c*:dwed1:: Weekday(4,1) Return :c*:dthu1:: Weekday(5,1) Return :c*:dfri1:: Weekday(6,1) Return :c*:dsat1:: Weekday(7,1) Return :c*:dsun2:: Weekday(1,2) Return :c*:dmon2:: Weekday(2,2) Return :c*:DTue2:: Weekday(3,2) Return :c*:dwed2:: Weekday(4,2) Return :c*:dthu2:: Weekday(5,2) Return :c*:dfri2:: Weekday(6,2) Return :c*:dsat2:: Weekday(7,2) Return Weekday(Day,Format) { Today := A_Now If (A_WDay >= Day) Today += Day + 7 - A_WDay, days Else Today += Day-A_WDay, days If Format = 1 FormatTime, Weekday, %Today%, M-d-yy If Format = 2 FormatTime, Weekday, %Today%, LongDate SendInput %Weekday% } ; Input statement pop-up menu weekday pick ^!n:: SplashTextOn,100, 40, Enter legal code!, Waiting for Input! Input , OutputVar, L3 T10, , sun,mon,tue,wed,thu,fri,sat EndKey := ErrorLevel SplashTextOff If (ErrorLevel != "Match") Return WeekdayMenu(%OutputVar%) Return WeekdayMenu(Day) { Today := A_Now If (A_WDay >= Day) Today += Day + 7 - A_WDay, days Else Today += Day-A_WDay, days WeekCol(Today,0) Today += 7, days WeekCol(Today,1) Today += 7, days WeekCol(Today,1) Today += 7, days WeekCol(Today,1) Menu, PickWeekday, Show Menu, PickWeekday, Delete } WeekCol(Today,First) { BarBreak := First = 1 ? "+BarBreak" : FormatTime, Weekday, %Today%, MMMM d Menu, PickWeekday, add, American—%Weekday%, InsertNothing, %BarBreak% FormatTime, Weekday, %Today%, ShortDate Menu, PickWeekday, add, %Weekday%, InsertWeekday FormatTime, Weekday, %Today%, M-d-yy Menu, PickWeekday, add, %Weekday%, InsertWeekday FormatTime, Weekday, %Today%, MMM d, yyyy Menu, PickWeekday, add, %Weekday%, InsertWeekday FormatTime, Weekday, %Today%, MMMM d, yyyy Menu, PickWeekday, add, %Weekday%, InsertWeekday FormatTime, Weekday, %Today%, LongDate Menu, PickWeekday, add, %Weekday%, InsertWeekday FormatTime, Weekday, %Today%, d MMMM Menu, PickWeekday, add, British—%Weekday%, InsertNothing FormatTime, Weekday, %Today%, d/M/yyyy Menu, PickWeekday, add, %Weekday%, InsertWeekday FormatTime, Weekday, %Today%, d-M-yy Menu, PickWeekday, add, %Weekday%, InsertWeekday FormatTime, Weekday, %Today%, d MMM yyyy Menu, PickWeekday, add, %Weekday%, InsertWeekday FormatTime, Weekday, %Today%, d MMMM yyyy Menu, PickWeekday, add, %Weekday%, InsertWeekday FormatTime, Weekday, %Today%, dddd, d MMM yyyy Menu, PickWeekday, add, %Weekday%, InsertWeekday } InsertWeekday: SendInput %A_ThisMenuItem%{raw} Return InsertNothing: Return