我无法将变量值作为另一个变量的值放入 ahk
I‘m not able to put an variable value as another variable‘s value in ahk
我想做一个时间记录器。我知道的还不够
我想做一个东西,如果我按 ctrl + alt + pgdn,它会显示一个消息框,要求记录时间。如果我点击“是”,我得到
另一个消息框说时间已记录。在我关闭消息框后,当前时间将被记录为一个变量。如果我按 ctrl + alt + enter,记录的时间将打印在 msgbox 中。
您可以更改此代码:
<!<^PgDn::
MsgBox, 4,Record time,Do you want to record the time?
If MsgBox Yes{
timestamp := %A Hour% ;below, the error is written about this line
timestamp2 := %A Min%
MsgBox time recorded.
}
else{}
return
<^<!enter::MsgBox time: %timestamp%:%timestamp2%
有了这个,有一个奇怪的错误说 "%A:这个参数有一个变量缺少它的结尾百分号"
如何解决这个问题?有答案吗?谢谢
Variable names in an expression are not enclosed in percent signs.
A_Hour and A_Min are Built-in Variables
<!<^PgDn::
MsgBox, 4,Record time,Do you want to record the time?
IfMsgBox Yes ; not "If MsgBox Yes"
{
timestamp := A_Hour ; expression
timestamp2 := A_Min
MsgBox time recorded.
}
; else{
; do sth else
; }
return
<^<!enter:: MsgBox, time: %timestamp%:%timestamp2% ; this is a command (no expression)
我想做一个时间记录器。我知道的还不够
我想做一个东西,如果我按 ctrl + alt + pgdn,它会显示一个消息框,要求记录时间。如果我点击“是”,我得到 另一个消息框说时间已记录。在我关闭消息框后,当前时间将被记录为一个变量。如果我按 ctrl + alt + enter,记录的时间将打印在 msgbox 中。
您可以更改此代码:
<!<^PgDn::
MsgBox, 4,Record time,Do you want to record the time?
If MsgBox Yes{
timestamp := %A Hour% ;below, the error is written about this line
timestamp2 := %A Min%
MsgBox time recorded.
}
else{}
return
<^<!enter::MsgBox time: %timestamp%:%timestamp2%
有了这个,有一个奇怪的错误说 "%A:这个参数有一个变量缺少它的结尾百分号"
如何解决这个问题?有答案吗?谢谢
Variable names in an expression are not enclosed in percent signs.
A_Hour and A_Min are Built-in Variables
<!<^PgDn::
MsgBox, 4,Record time,Do you want to record the time?
IfMsgBox Yes ; not "If MsgBox Yes"
{
timestamp := A_Hour ; expression
timestamp2 := A_Min
MsgBox time recorded.
}
; else{
; do sth else
; }
return
<^<!enter:: MsgBox, time: %timestamp%:%timestamp2% ; this is a command (no expression)