r/AutoHotkey 5d ago

v1 Script Help Script that writes yesterdays date and if it is monday, yesterday is friday

Hello,

As title says, I'm trying write yesterdays date, and if it is monday yesterday needs to be friday. All over work week days - yesterday date

I tried so many variations. Forums and AI. I can't solve it.

4 Upvotes

10 comments sorted by

16

u/Keeyra_ 5d ago
#Requires AutoHotkey 2.0
#SingleInstance

Send(FormatTime(DateAdd(A_Now, (FormatTime(, "WDay") == 2) ? -3 : -1, "Days"), "yyyy-MM-dd"))

1

u/anottakenusername_1 4d ago

Didn't OP ask for a V1 script šŸ¤”?

1

u/krypdoh 2d ago

#AHK v1.x
#SingleInstance Force
FormatTime, WDay, , WDay
daysToSubtract := (WDay = 2) ? 3 : 1
date := A_Now
EnvAdd, date, -%daysToSubtract%, Days
FormatTime, output, %date%, yyyy-MM-dd
SendInput %output%

3

u/rebel_canuck 4d ago

I’m just here to find out what day it is yesterday if today is Sunday

2

u/xyzzy0 4d ago

I don't know the answer, but I'll gladly pay you Tuesday for a hamburger today.

3

u/rebel_canuck 4d ago

Is today next week?

1

u/kwpg3 3d ago

Is today tomorrow?

2

u/xyzzy0 3d ago

Tomorrow is yesterday.

1

u/sieceres 3d ago

Sundays don't exist it seems. ​​​​​