![AutoHotKey 포맷 시간](https://rvso.com/image/1567502/AutoHotKey%20%ED%8F%AC%EB%A7%B7%20%EC%8B%9C%EA%B0%84.png)
24시간 형식을 이렇게 지정하려고 합니다.
"1930+"를 입력하면 → 19:30
"0630+"를 입력하면 → 06:30
기본적으로 숫자 0-9의 끝에 "+"를 읽으면 " : "를 뒤로 두 자리 추가합니다. 이 작업을 수행하는 방법을 잘 모르겠습니다.
답변1
; *: An ending character is not required
; ?: The hotstring will be triggered even when it is inside another word
#Hotstring * ?
::0+::
::1+::
; ...
::9+::
PriorKey := SubStr(A_PriorKey, 0) ; remove "Numpad" if using number pad
SendInput, %PriorKey%{Left 2}:{Right 2}
return
좀 더 정확하게 알고 싶다면:
#Hotstring * ?
::0+::
::1+::
; ...
::9+::
ClipSaved := ClipboardAll ; save Clipboard
clipboard := "" ; empty the clipboard
PriorKey := SubStr(A_PriorKey, 0) ; remove "Numpad" if using number pad
SendInput, %PriorKey%{Shift Down}{Left 4}{Shift Up} ; select the last 4 typed chars
Send, ^c ; copy the selected text
ClipWait, 1 ; wait for the clipboard to contain data.
if (!ErrorLevel) ; If NOT ErrorLevel clipwait found data on the clipboard
{
If ((clipboard is number) && (SubStr(clipboard, 1, 2) < 24) && (SubStr(clipboard, -1) < 60))
Send, {Left}{Right 2}:{Right 2}
else
Send, {Right}
}
Sleep, 300
clipboard := ClipSaved ; restore original clipboard
return