AutoHotkey的:访问坐标
问题描述:
在AutoHotkey的阵列中,我定义一个全局数组:AutoHotkey的:访问坐标
BuildTabIndexArray()
{
global
; coords of each of the 8 selectable tabs on screen
tab_index_array.Push(332,490)
tab_index_array.Push(378,490)
tab_index_array.Push(433,490)
tab_index_array.Push(486,490)
tab_index_array.Push(557,490)
tab_index_array.Push(611,490)
tab_index_array.Push(685,490)
tab_index_array.Push(745,490)
}
:
tab_index_array := []
在脚本中,我调用一个函数来建表再往下这看起来很直截了当,但是,当我试图访问这个表时,我所得到的只有空白(空)值。
ClickTab(which_tab)
{
global
coords_ := []
tab_str := tab_index_array[which_tab]
stringsplit, coords_, tab_str, ","
x_ := coords_[1]
y_ := coords_[2]
SplashTextOn,,, %x_% "`n" %y_%
SetTimer, KillSplashText, -5000
;SetMouseDelay, slow_click_wait_time
;SendEvent {click, %x_%, %y_%}
;SetMouseDelay, click_wait_time
}
我在做什么错?我想要做的就是从数组中获取坐标并将它们提供给SendEvent命令。任何帮助你可以给予将不胜感激,因为我已经打了一段时间了。
感谢,
答
既然你想为一个字符串存储在每个tab_index_array
的领域,你需要把它放在引号,像
tab_index_array.Push("332,490")
函数调用和定义,其中包括if()
, .push()
,strLen()
等等,就像其他编程语言中的函数一样工作。您只能在大多数AutoHotkey命令中留下引号,这些命令有时很舒服但很混乱。
更多相关信息,请参阅http://ahkscript.org/docs/Variables.htm