Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/oracle/10.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
If statement 自动热键/脉冲切换宏创建者输入框循环错误_If Statement_User Input_Autohotkey_Infinite Loop - Fatal编程技术网

If statement 自动热键/脉冲切换宏创建者输入框循环错误

If statement 自动热键/脉冲切换宏创建者输入框循环错误,if-statement,user-input,autohotkey,infinite-loop,If Statement,User Input,Autohotkey,Infinite Loop,第一篇关于stack overflow的文章,我已经使用论坛和潜伏了一段时间,但决定注册,因为我的工作现在需要更多的脚本 因此,我正在使用Pulover的宏创建者构建一个自动热键脚本,而我无法解决InputBox命令的问题 脚本的目的是错误检查用户输入,将输出变量与一组4个预定值进行比较。如果发现输出变量无效,将弹出一个MsgBox通知用户,然后脚本循环回到开头,以便用户可以重试 我遇到的问题是,脚本挂起在InputBox命令上,但只有在if开关检测到无效字符串后,脚本才循环回起始位置 e、 g

第一篇关于stack overflow的文章,我已经使用论坛和潜伏了一段时间,但决定注册,因为我的工作现在需要更多的脚本

因此,我正在使用Pulover的宏创建者构建一个自动热键脚本,而我无法解决InputBox命令的问题

脚本的目的是错误检查用户输入,将输出变量与一组4个预定值进行比较。如果发现输出变量无效,将弹出一个MsgBox通知用户,然后脚本循环回到开头,以便用户可以重试

我遇到的问题是,脚本挂起在InputBox命令上,但只有在if开关检测到无效字符串后,脚本才循环回起始位置

e、 g

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脚本的方式有关,但我完全没有想法

任何帮助都将不胜感激

非常感谢
Doug

直到子句只接受autohotkey考虑表达式的条件。 是命令而不是自动热键表达式。从IFIN的

表达式中不支持运算符“between”、“is”、“in”和“contains”

如果我们重构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
}

UNTIL子句只接受autohotkey考虑表达式的条件。 是命令而不是自动热键表达式。从IFIN的

表达式中不支持运算符“between”、“is”、“in”和“contains”

如果我们重构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
}