Autohotkey / pulovers 宏创建器输入框循环错误
Autohotkey / pulovers macro creator inputbox loop error
首先 post 这里是堆栈溢出,我一直在使用论坛并潜伏了一段时间,但决定注册,因为我的工作现在涉及更多脚本。
所以我正在使用 Pulover 的 Macro Creator 构建自动热键脚本,但我无法解决 InputBox 命令的问题。
脚本的目的是错误检查用户输入,将输出变量与一组 4 个预定值进行比较。如果发现输出变量无效,则会弹出 MsgBox 通知用户,然后脚本循环回到开头,以便他们可以重试。
我遇到的问题是脚本在 InputBox 命令上挂起,但只有在 if 开关检测到无效字符串后它循环回到开始后才挂起。
例如
InputBox - 用户输入无效变量
出现MsgBox
脚本重新启动
InputBox - 用户输入有效变量
脚本挂起
这是我的代码:
F8::
/*
This script asks for user input and keeps looping until the input matches the predefined valid strings.
*/
Loop
{
InputBox, price_type, title, text, , , , , , , , RRP ; Get user input for "price_type" variable
Sleep, 5
StringUpper, price_type, price_type ; convert variable to uppercase to allow error checking
Sleep, 5
If price_type not in RRP,SALE,OFFERING,WAS ; check variable for invalid strings
{
MsgBox, 16, Invalid Input, Invalid Input message ; warn user that input is invalid
}
Until, %price_type% in RRP,SALE,OFFERING,WAS ; infinite loop until variable matches valid input options
}
我怀疑问题与 pulover 的宏创建者格式化 ahk 脚本的方式有关,但我完全没有想法!
如有任何帮助,我们将不胜感激。
非常感谢
道格
UNTIL 子句只接受 autohotkey 认为 表达式 的条件。
IFIN is a command and not an autohotkey expression. From the documentation IFIN:
The operators "between", "is", "in", and "contains" are not supported in expressions.
如果我们用无效的 IN 运算符重构 WHILE 子句,您的代码就可以工作:
Loop
{
InputBox, price_type, title, text, , , , , , , , RRP
StringUpper, price_type, price_type
If price_type in RRP,SALE,OFFERING,WAS
break
MsgBox, 16, Invalid Input, Invalid Input message
}
首先 post 这里是堆栈溢出,我一直在使用论坛并潜伏了一段时间,但决定注册,因为我的工作现在涉及更多脚本。
所以我正在使用 Pulover 的 Macro Creator 构建自动热键脚本,但我无法解决 InputBox 命令的问题。
脚本的目的是错误检查用户输入,将输出变量与一组 4 个预定值进行比较。如果发现输出变量无效,则会弹出 MsgBox 通知用户,然后脚本循环回到开头,以便他们可以重试。
我遇到的问题是脚本在 InputBox 命令上挂起,但只有在 if 开关检测到无效字符串后它循环回到开始后才挂起。
例如
InputBox - 用户输入无效变量
出现MsgBox
脚本重新启动
InputBox - 用户输入有效变量
脚本挂起
这是我的代码:
F8::
/*
This script asks for user input and keeps looping until the input matches the predefined valid strings.
*/
Loop
{
InputBox, price_type, title, text, , , , , , , , RRP ; Get user input for "price_type" variable
Sleep, 5
StringUpper, price_type, price_type ; convert variable to uppercase to allow error checking
Sleep, 5
If price_type not in RRP,SALE,OFFERING,WAS ; check variable for invalid strings
{
MsgBox, 16, Invalid Input, Invalid Input message ; warn user that input is invalid
}
Until, %price_type% in RRP,SALE,OFFERING,WAS ; infinite loop until variable matches valid input options
}
我怀疑问题与 pulover 的宏创建者格式化 ahk 脚本的方式有关,但我完全没有想法!
如有任何帮助,我们将不胜感激。
非常感谢 道格
UNTIL 子句只接受 autohotkey 认为 表达式 的条件。 IFIN is a command and not an autohotkey expression. From the documentation IFIN:
The operators "between", "is", "in", and "contains" are not supported in expressions.
如果我们用无效的 IN 运算符重构 WHILE 子句,您的代码就可以工作:
Loop
{
InputBox, price_type, title, text, , , , , , , , RRP
StringUpper, price_type, price_type
If price_type in RRP,SALE,OFFERING,WAS
break
MsgBox, 16, Invalid Input, Invalid Input message
}