[英]VBScript infinite loop freezes PC
I'm using Indusoft Web Studio which has VBScript implementation for scripts and I have a following problem.我正在使用 Indusoft Web Studio,它具有脚本的 VBScript 实现,但我有以下问题。
I need to have something like:我需要有类似的东西:
Do While $pozAkt<>x
Loop
However the given lines completely freeze the PC.然而,给定的行完全冻结了 PC。 How can I get PC to wait until myVar will reach the x value?
我怎样才能让 PC 等到 myVar 达到 x 值?
Use "WEND".使用“温德”。
While $pozAkt<>x
Wend
You can combine an "If" inside to avoid the overflow.您可以在内部组合一个“If”以避免溢出。
Dim flag, limit昏暗的旗帜,限制
flag=0标志=0
While flag=0
If $pozAkt=x Then
flag=1
End If
If $pozAkt<>x Then
limit=limit+1
$Wait(1)
If limit>1000 Then
flag=1
End If
End If
Wend
But, its better not make a large loop inside VBScript using Indusoft, Do it only if its needed to hold the script and create a Task.但是,最好不要使用 Indusoft 在 VBScript 内部进行大循环,仅在需要保存脚本并创建任务时才执行此操作。 Try not to use a screen script or global screen script with loops, your PC will freeze always.
尽量不要使用带有循环的屏幕脚本或全局屏幕脚本,您的 PC 将始终冻结。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.