I need a script that works more or less like this
Pressing any combination of keys (say F1)
The script asks from which date I want to start (say 20.01.2024)
A loop starts (until I press another key combination (say F2) )
I mark on the screen where I want the date to be written
The date is written
The date is incremented by 1 day (21.10.2024)
The loop continues until F2 is pressed
remark:
The program does not need to deal with years in advance,leap years, or anything similar.
The primary use is to write down 30 consecutive dates from a specific date.
thanks
Incrementing a date
Re: Incrementing a date
I would go with the last one shown here.
Or:
Code: Select all
; This script sends a date, and increments it
#Requires AutoHotkey v1.1.33
F1::
InputBox, ib, Date, Enter a starting date.,, 225, 125
(!ErrorLevel && ib > "") && (part := StrSplit(ib, "."), date := part.3 part.2 part.1)
Return
F4::
FormatTime, txt, %date%, dd.MM.yyyy
SendInput % txt
date += 1, D
Return
Code: Select all
; This script sends a date, and increments it
#Requires AutoHotkey v2.0
date := A_Now
F1:: {
Global date
ib := InputBox('Enter a starting date.', 'Date', 'w225 h100')
(ib.Result = "OK" && ib.Value != "") && (part := StrSplit(ib.Value, "."), date := part[3] part[2] part[1])
}
F4:: {
Global date
Send FormatTime(date, 'dd.MM.yyyy')
date := DateAdd(date, 1, 'D')
}
Code: Select all
; This script sends a date, and increments it
#Requires AutoHotkey v2.0
date := ""
F1:: { ; F1 = Ask for date, and enable sending
Global date
If (ib := InputBox('Enter a starting date.', 'Date', 'w225 h100')).Result = "OK" && ib.Value != ""
part := StrSplit(ib.Value, "."), date := part[3] part[2] part[1], SoundBeep(1500)
}
#HotIf date
~LButton Up:: { ; LBUTTON UP = Send and increment date
Global date
Send(FormatTime(date, 'dd.MM.yyyy')), date := DateAdd(date, 1, 'D')
}
F2:: { ; F2 = Disable
Global date := ""
SoundBeep 1000
}
#HotIf