Script keeps adding unwanted days each time it's run

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
BLoweZero
Posts: 11
Joined: 29 May 2018, 19:42

Script keeps adding unwanted days each time it's run

20 Jan 2019, 21:29

I want, each time the following scrip is run, to work from the current date and either add 1 or 3 days...depending on whether there's weekend involved or not. (3 days on Fridays and 1 day on Mondays thru Thursdays.)
What is happening is that it is remembering the previous ddate created by the script and then adding 1 or 3 days to that rather than the day that it is run. Basically, I need to reset either the nDate or %date% to current date after is run. Any help will be appreciated.

^1::
IF A_WDAY = 6
{
Date += 3, Days
FormatTime, nDate, %Date%, MM/dd/yyyy
}
ELSE IF A_WDAY <> 6
{
Date += 1, Days
FormatTime, nDate, %Date%, MM/dd/yyyy
}

Send, Please send me a confirmation of the attached Purchase Order and let me know when it will ship. {enter}
Send, {enter}
Send, Reminder set for:
Send, {space}
Send, %nDate% {enter}
Send, {enter}
Send, Please send tracking when available. {enter}

Send, ^#G
Send, {tab 2}
Send, %nDate% {tab 4}
Send, {space} {tab 2}
send, 9 am {enter}
Return
just me
Posts: 9487
Joined: 02 Oct 2013, 08:51
Location: Germany

Re: Script keeps adding unwanted days each time it's run

20 Jan 2019, 22:29

Code: Select all

^1::
Date := A_Now
IF A_WDAY = 6
	...
BLoweZero
Posts: 11
Joined: 29 May 2018, 19:42

Re: Script keeps adding unwanted days each time it's run

21 Jan 2019, 20:56

Awesome! Thanks so much. Such a simple fix. Greatly appreciated.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: bhoot, Bing [Bot], Chunjee, GEOVAN and 250 guests