Translate date to French
-
- Posts: 15
- Joined: Sep 4th, ’21, 23:26
As anyone written a script to translate the English date %DATETIME_Today% which gives October 2, 2021 to French when using the French key board?
Date and Time macro uses the language as configured in the Windows OS regional settings.
You could use the following script (Type: Command):
The code first detects the user keyboard layout, sets the date format to this layout and then send the date.
You could use the following script (Type: Command):
Code: Select all
KBLayout := DllCall("user32.dll\GetKeyboardLayout") & 0xFFFF
FormatTime, CurrentDateTime, L%KBLayout%, MMMM d, yyyy
send, % CurrentDateTime
-
- Posts: 15
- Joined: Sep 4th, ’21, 23:26
I switch my keyboard to French & run this script and get the English date October 2, 2021
Text Expander Command
KBLayout := DllCall("user32.dll\GetKeyboardLayout") & 0xFFFF
FormatTime, CurrentDateTime, L%KBLayout%, MMMM d, yyyy
send, % CurrentDateTime
Text Expander Command
KBLayout := DllCall("user32.dll\GetKeyboardLayout") & 0xFFFF
FormatTime, CurrentDateTime, L%KBLayout%, MMMM d, yyyy
send, % CurrentDateTime
Ok, this should work without reloading FastKeys
Code: Select all
SetFormat, Integer, H
WinGet, WinID,, A
ThreadID:=DllCall("GetWindowThreadProcessId", "UInt", WinID, "UInt", 0)
KBLayout:=DllCall("GetKeyboardLayout", "UInt", ThreadID, "UInt") & 0xFFFF
FormatTime, CurrentDateTime, L%KBLayout%, MMMM d, yyyy
send, % CurrentDateTime
-
- Posts: 15
- Joined: Sep 4th, ’21, 23:26
Thanks Marko. That works!