Gaz-mên Arifi
Gaz-mên Arifi

Reputation: 33

How do I escape the '+' characters in an AutoHotKey, with the date script?

I use AutoHotKey to display actual date. here is the code :

:*C:]d::  ; This hotstring replaces "]d" with the current date and time via the commands below.
FormatTime, CurrentDateTime,, yyyy‑MM‑dd ‒ HH'H'mm '(UTC+1)' ; It will look like 2005-01-09 15H53 (UTC+1)
SendInput %CurrentDateTime%
return

But the result miss the '+', I used "`" or "", both not vrog.

Thank pro help. Good day and long and happy life.

Upvotes: 1

Views: 217

Answers (1)

0x464e
0x464e

Reputation: 6489

Use the text send mode.

:*C:]d::  ; This hotstring replaces "]d" with the current date and time via the commands below.
    FormatTime, CurrentDateTime,, yyyy‑MM‑dd ‒ HH'H'mm '(UTC+1)' ; It will look like 2005-01-09 15H53 (UTC+1)
    SendInput, {Text}%CurrentDateTime%
return

Also, if you'd want to ditch the legacy AHK syntax, you'd do this:

:*C:]d::
    FormatTime, CurrentDateTime, , % "yyyy‑MM‑dd ‒ HH'H'mm '(UTC+1)'"
    SendInput, % "{Text}" CurrentDateTime
return

Upvotes: 1

Related Questions