[已解决] 怎样在语句内创建数组?
本帖最后由 fenghou 于 2012-6-23 10:45 编辑比如我要往一个字典对象里存入数组,每次Add时都要写好多句:
Global $g_mHotKey = ObjCreate("Scripting.Dictionary")
Local $gItem
$gItem = "70"
$gItem = "SearchNext"
$g_mHotKey.Add("{F1}", $gItem)
$gItem = "73"
$gItem = "Open"
$g_mHotKey.Add("{F4}", $gItem)
$gItem = "74"
$gItem = "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"])
变通下,建两个字典解决
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]