This is a different behaviour from when I use a specific shortcut to trigger a macro generated by Fastkey's More>Macros>Date and Time utility for a specific date. This always inserts the result into the File Name box in the Win7 file save dialog correctly.
Why is the result different? What am I doing wrong?
The code I have written is very simple: it picks up the NoOfDays to move and the OutputFormat for the found Datestring from an Input Selection Form, does the math and sends the answer. The text Expander shortcut is type "Send" for which it substitutes "%SELECT__NoOfDays%%SELECT__OutputFormat%%CODE_DaysToAdd%" (the select variables being prefixed with "_" to stop them sending their result per your forum post 22/05/2017).
I have the same problem with the generic end of any month macro I have developed.
Code: Select all
Datestring := ""
DaysToAdd := SELECT__NoOfDays
DateStringFormat := SELECT__OutputFormat
Datestring := A_YYYY A_MM A_dd ;set to today as YYYYMMDD
; Use EnvAdd to add/subtract no of days
EnvAdd, Datestring, %DaysToAdd%, Days
;exit if date to be found is outside date arithmetic parameters
;Limits are: 01 Jan 1601 to 31 Dec 9999
If Datestring not between 16010101000000 and 99991231000000
MsgBox, 16, , The number of days deducted or added is too many and would result in a date before January 1601 or after December 1999 which is not supported by the date arithmetic. The program will now exit.
IfMsgBox OK
Exit
else
FormatTime, Dateformatted, %Datestring%, %DateStringFormat%
Send %Dateformatted%
return