我不知道如何开始这个。我查看了AHK的帮助文件但没有结果。
我需要建立一个这样的构造(这不是UNIX shell或AHK脚本语言。只是显示我想到的想法)
while true
do
gosub screenscrape
; here, all text on page is on clipboard
; variable "input" is a predefined portion of the clipboard
case $input in
string-1)
gosub subroutione1;;
string-2)
gosub subroutine2;;
...
*)
echo "not found"
sleep 1minute
done
使事情变得更复杂,标注为string-1
,string-n
的部分也是变量,从几个不同的文件中读取,取决于一天中的时间或事件的触发器。
有人能指出我正确的方向吗?
答案 0 :(得分:2)
Autohotkey没有任何case
语句。每个人都做的是使用if
和else
语句。 (我知道它的感受。我也喜欢case
)
为您提供一些提示:
$
或-
;
终止行。 以下是autohotkey的翻译。
gosub screenscrape
; here, all text on page is on clipboard
; variable "input" is a predefined portion of the clipboard
if(string1){ ;if the variable is not blank it will evaluate to `true`
gosub subroutine1
}else if(string2){
gosub subroutine2
}else{
msgbox not found
sleep 60000 ;milliseconds
}
此外,您可以在autohotkey中使用实际功能 - 您不必依赖gosubs。如果您使用gosubs,请确保在其末尾放置return
。您还应该阅读有关“自动执行”部分的autohotkey文档。