tumin999的专栏

通过查看AutoHotkey的帮助文档,可以看到AHK支持数组,但例子和文档表述还是不明晰,因此花了半天时间调试,成功写出了一维数组、二维数组的示例

;[以下测试从文件逐行读取数据到一维数组,并再次从一维数组读出cnt_rqlb=0Loop, read, rqlb.txt{cnt_rqlb+=1;下一行中因使用:=,所以右侧不添加%%rqlb%cnt_rqlb%:=A_LoopReadLine;下一行中的" . "有讲究,,注意"."两侧都要保留空格,且OutputDebug后不是","而是"%"OutputDebug % "1D Read File:" . rqlb%cnt_rqlb%}OutputDebug, cnt_rqlb=%cnt_rqlb%Loop %cnt_rqlb%{;下一行中的:=又有讲究,右侧因访问数组下标,所以出现了%A_Index%strLine:=rqlb%A_Index%OutputDebug % "1D Read Array:" . A_Index . " is " . rqlb%A_Index%};];[以下测试从文件逐行逐列读取数据到二维数组,并再次从二维数组读出cnt_rqlb=0Loop, read, rqlb.txt{row=%A_Index%cnt_rqlb+=1Loop, parse, A_LoopReadLine, %A_Tab%{col=%A_Index%rqlb%row%_%col%=%A_LoopField%OutputDebug % "2D Read File:" . rqlb%row%_%col%}}OutputDebug, cnt_rqlb=%cnt_rqlb%;下面两行都可以输出数组指定下标的数据OutputDebug, rqlb1_1=%rqlb1_1%OutputDebug % "rqlb1_2=" . rqlb1_2Loop %cnt_rqlb%{row=%A_Index%Loop 2{col=%A_Index%item:=rqlb%row%_%col%OutputDebug % "2D Read Array:(" . row . " ," . col . ") is " . rqlb%row%_%col%}};]

我想有一天和你去旅行。去那没有去过的地方,

tumin999的专栏

相关文章:

你感兴趣的文章:

标签云: