如何读取AHK中的变量值?
How to read the variable value in AHK?
我想让 AHK 做一些事情,只有当一个特定的变量有一个特定的值时。
代码:
<^<!/::
MsgBox,4,Timer,Do you want to set a timer?
IfMsgBox Yes
{
InputBox,Time1 , Timer, What hour? (Please show in 24:00 format)
InputBox,Time2,Timer, What minute?
IfTime1 := A_Hour, Time2 := A_Min
MsgBox,64,Timer,Timer done.
}
else{}
return
如果你不明白我在做什么,我正在尝试设置一个计时器。
我想要什么:
当我按下 ctrl+alt+/ 时,我想要一个消息框打开,询问是否设置定时器。
如果我点击是,我要一个一个打开两个输入框,我会在其中写上时间。
接下来,当我完成时间设置后,输入框将关闭。现在,输入框中的时间将写入一个名为 time 和 time2 的变量。然后,如果时间 1 与 A_Hour 相同,时间 2 与 A_Min 相同,则将显示带有信息图标的 MsgBox。
发生什么了:
设置时间后,立即出现带有信息图标的消息框。
任何人都可以更正上面的代码并发送答案吗?谢谢
<^<!/::
MsgBox,4,Timer,Do you want to set a timer?
IfMsgBox Yes
{
InputBox, Time1, hour, What hour? (Please show in 24:00 format)
if ErrorLevel ; CANCEL was pressed
return
if (Time1 > 23)
{
MsgBox, wrong hour specification
return
}
InputBox,Time2, minute, What minute?
if ErrorLevel
return
if (Time2 > 59)
{
MsgBox, wrong minute specification
return
}
SetTimer, Timer, 1000
}
return
Timer:
if (A_Hour = Time1 && A_Min = Time2)
{
SetTimer, Timer, off
MsgBox,64,Timer,Timer done.
}
return
我想让 AHK 做一些事情,只有当一个特定的变量有一个特定的值时。
代码:
<^<!/::
MsgBox,4,Timer,Do you want to set a timer?
IfMsgBox Yes
{
InputBox,Time1 , Timer, What hour? (Please show in 24:00 format)
InputBox,Time2,Timer, What minute?
IfTime1 := A_Hour, Time2 := A_Min
MsgBox,64,Timer,Timer done.
}
else{}
return
如果你不明白我在做什么,我正在尝试设置一个计时器。
我想要什么:
当我按下 ctrl+alt+/ 时,我想要一个消息框打开,询问是否设置定时器。
如果我点击是,我要一个一个打开两个输入框,我会在其中写上时间。
接下来,当我完成时间设置后,输入框将关闭。现在,输入框中的时间将写入一个名为 time 和 time2 的变量。然后,如果时间 1 与 A_Hour 相同,时间 2 与 A_Min 相同,则将显示带有信息图标的 MsgBox。
发生什么了:
设置时间后,立即出现带有信息图标的消息框。
任何人都可以更正上面的代码并发送答案吗?谢谢
<^<!/::
MsgBox,4,Timer,Do you want to set a timer?
IfMsgBox Yes
{
InputBox, Time1, hour, What hour? (Please show in 24:00 format)
if ErrorLevel ; CANCEL was pressed
return
if (Time1 > 23)
{
MsgBox, wrong hour specification
return
}
InputBox,Time2, minute, What minute?
if ErrorLevel
return
if (Time2 > 59)
{
MsgBox, wrong minute specification
return
}
SetTimer, Timer, 1000
}
return
Timer:
if (A_Hour = Time1 && A_Min = Time2)
{
SetTimer, Timer, off
MsgBox,64,Timer,Timer done.
}
return