找回密码
 加入
搜索
查看: 1475|回复: 2

[AU3基础] [已解决] 怎样在语句内创建数组?

[复制链接]
发表于 2012-6-22 12:55:17 | 显示全部楼层 |阅读模式
本帖最后由 fenghou 于 2012-6-23 10:45 编辑

比如我要往一个字典对象里存入数组,每次Add时都要写好多句:
Global $g_mHotKey = ObjCreate("Scripting.Dictionary")

Local $gItem[2]
$gItem[0] = "70"
$gItem[1] = "SearchNext"
$g_mHotKey.Add("{F1}", $gItem)
$gItem[0] = "73"
$gItem[1] = "Open"
$g_mHotKey.Add("{F4}", $gItem)
$gItem[0] = "74"
$gItem[1] = "Refresh"
$g_mHotKey.Add("{F5}", $gItem)
如果能在语句内创建数组,我就只用写一句了:
Global $g_mHotKey = ObjCreate("Scripting.Dictionary")

$g_mHotKey.Add("{F1}", ["70", "SearchNext"])
$g_mHotKey.Add("{F4}", ["73", "Open"])
$g_mHotKey.Add("{F5}", ["74", "Refresh"])
发表于 2012-6-22 13:33:32 | 显示全部楼层
变通下,建两个字典解决

Global $g_mHotKey_item = ObjCreate("Scripting.Dictionary")
Global $g_mHotKey_info = ObjCreate("Scripting.Dictionary")

$g_mHotKey_item.Add("{F1}", "70")
$g_mHotKey_item.Add("{F4}", "73")
$g_mHotKey_item.Add("{F5}", "74")

$g_mHotKey_info.Add("{F1}", "SearchNext")
$g_mHotKey_info.Add("{F4}", "Open")
$g_mHotKey_iinfo.Add("{F5}", "Refresh")

评分

参与人数 1金钱 +25 收起 理由
魔导 + 25 谢元老耐心指教

查看全部评分

 楼主| 发表于 2012-6-23 10:43:15 | 显示全部楼层
谢谢指教!
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-11-18 23:40 , Processed in 0.079744 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表