Frustrated trying to insert date in hotkey

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
jrclunie
Posts: 2
Joined: 29 Apr 2024, 20:41

Frustrated trying to insert date in hotkey

29 Apr 2024, 20:52

Hi all;

I'm trying to create hotkeys that have a text string, followed by the current date in MMddyyy format, using v2.

I've tried everything I know (and apparently I don't know enough)

Here's the code I have lately:

Code: Select all

::XFR::
          send, "Extended Forecast Report " %A_MM%%A_DD%%A_YYYY%
          return
I got an error that I need a "(". So I added them.

Code: Select all

::XFR::
          (send, "Extended Forecast Report " %A_MM%%A_DD%%A_YYYY%
          return)
Now, I get an error "Invalid option".

Oi.

Help?


[Mod edit: Added [code][/code] tags. Please use them yourself when posting code.]
User avatar
boiler
Posts: 17169
Joined: 21 Dec 2014, 02:44

Re: Frustrated trying to insert date in hotkey

30 Apr 2024, 01:02

You must be looking at the wrong documentation, because almost everything about your code looks like v1 rather than v2: Comma after the function name, using % around variables, using return to mark the end of a multi-line hotstring (not hotkey) instead of braces { }, which is what the error message said was missing, not parentheses.

With fixes:

Code: Select all

#Requires AutoHotkey v2.0

::XFR:: {
	Send "Extended Forecast Report " . A_MM . A_DD . A_YYYY
}

Or:

Code: Select all

#Requires AutoHotkey v2.0

:X:XFR::Send "Extended Forecast Report " . A_MM . A_DD . A_YYYY
jrclunie
Posts: 2
Joined: 29 Apr 2024, 20:41

Re: Frustrated trying to insert date in hotkey

07 May 2024, 07:44

OK.

I am using v2. Specifically v2.09.

I changed the coding to the first response, and it seems to be working.

Thanks.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Descolada, Draken, kczx3, Marium0505, mikeyww, robinson, RussF, william_ahk and 51 guests