Тема: AHK: Запись в переменную каждого нажатия.
Доброго времени суток
Нужен скрипт, который выполняет следующую функцию, записывает все нажатые клавиши в переменную.
Например, прописываю 1 - сохраняет в переменной 1. Следом тыкаю 2 - в переменной уже 12. Ну и так далее.
Пытался что-то сделать из этого
SetBatchLines -1
cop := "0|1|2|3|4|5|6|7|8|9"
Loop, Parse, cop, |
Hotkey, ~%A_LoopField%, cop, UseErrorLevel
return
cop:
ThisHotkey := SubStr(A_ThisHotkey, 2)
MsgBox % "вы нажали: " ThisHotkey
return
.. но ничего не получилось. Также пробовал через Input and ErrorLevel = Endkey:
F2::
Loop,
{
Input, a, L1 V, {1}{2}{3}{4}{5}{6}{7}{8}{9}{0}
if (ErrorLevel = "EndKey:1") or (ErrorLevel = "EndKey:2") or (ErrorLevel = "EndKey:3") or (ErrorLevel = "EndKey:4") or (ErrorLevel = "EndKey:5") or (ErrorLevel = "EndKey:6") or (ErrorLevel = "EndKey:7") or (ErrorLevel = "EndKey:8") or (ErrorLevel = "EndKey:9") or (ErrorLevel = "EndKey:0")
break
}
if ErrorLevel = EndKey:1
{
a := 1
}
if ErrorLevel = EndKey:2
{
a := 2
}
if ErrorLevel = EndKey:3
{
a := 3
}
if ErrorLevel = EndKey:4
{
a := 4
}
if ErrorLevel = EndKey:5
{
a := 5
}
if ErrorLevel = EndKey:6
{
a := 6
}
if ErrorLevel = EndKey:7
{
a := 7
}
if ErrorLevel = EndKey:8
{
a := 8
}
if ErrorLevel = EndKey:9
{
a := 9
}
if ErrorLevel = EndKey:0
{
a := 0
}
Loop,
{
Input, b, L1 V T1, {1}{2}{3}{4}{5}{6}{7}{8}{9}{0}
if (ErrorLevel = "EndKey:1") or (ErrorLevel = "EndKey:2") or (ErrorLevel = "EndKey:3") or (ErrorLevel = "EndKey:4") or (ErrorLevel = "EndKey:5") or (ErrorLevel = "EndKey:6") or (ErrorLevel = "EndKey:7") or (ErrorLevel = "EndKey:8") or (ErrorLevel = "EndKey:9") or (ErrorLevel = "EndKey:0") or (ErrorLevel = "Timeout")
break
}
if ErrorLevel = EndKey:1
{
b := 1
}
if ErrorLevel = EndKey:2
{
b := 2
}
if ErrorLevel = EndKey:3
{
b := 3
}
if ErrorLevel = EndKey:4
{
b := 4
}
if ErrorLevel = EndKey:5
{
b := 5
}
if ErrorLevel = EndKey:6
{
b := 6
}
if ErrorLevel = EndKey:7
{
b := 7
}
if ErrorLevel = EndKey:8
{
b := 8
}
if ErrorLevel = EndKey:9
{
b := 9
}
if ErrorLevel = EndKey:0
{
b := 0
}
if ErrorLevel = Timeout
{
goto, metka
}
Loop,
{
Input, c, L1 V T1, {1}{2}{3}{4}{5}{6}{7}{8}{9}{0}
if (ErrorLevel = "EndKey:1") or (ErrorLevel = "EndKey:2") or (ErrorLevel = "EndKey:3") or (ErrorLevel = "EndKey:4") or (ErrorLevel = "EndKey:5") or (ErrorLevel = "EndKey:6") or (ErrorLevel = "EndKey:7") or (ErrorLevel = "EndKey:8") or (ErrorLevel = "EndKey:9") or (ErrorLevel = "EndKey:0") or (ErrorLevel = "Timeout")
break
}
if ErrorLevel = EndKey:1
{
c := 1
}
if ErrorLevel = EndKey:2
{
c := 2
}
if ErrorLevel = EndKey:3
{
c := 3
}
if ErrorLevel = EndKey:4
{
c := 4
}
if ErrorLevel = EndKey:5
{
c := 5
}
if ErrorLevel = EndKey:6
{
c := 6
}
if ErrorLevel = EndKey:7
{
c := 7
}
if ErrorLevel = EndKey:8
{
c := 8
}
if ErrorLevel = EndKey:9
{
c := 9
}
if ErrorLevel = EndKey:0
{
c := 0
}
if ErrorLevel = Timeout
{
goto, metka
}
metka:
id = %a% %b% %c%
StringReplace, id, id, %A_Space%, , All
... но если нажать и задержать любую кнопку на мышке или клавиатуре, то последний скрипт приостанавливает свою работу.
Помогите исправить последний код, либо предложите какой другой вариант.