关于QTP 全局数据字典

上一篇 / 下一篇  2014-04-14 17:02:50 / 个人分类:QTP

用数据字典形式解决关于QTP将数组作为参数传递的需求,如下案列:

Function KeyExistsDemo
   Dim d, msg   ' Create some variables.
   Set d = CreateObject("Scripting.Dictionary")
   d.Add"a", "Athens"   ' Add some   keys and items.
   d.Add"b", "Belgrade"
   d.Add"c", "Cairo"
   If d.Exists("c") Then
      msg = "Specified key exists."
   Else
      msg = "Specified key doesn't exist."
   EndIf
   Set KeyExistsDemo = d
EndFunction


Function GetKeyInfo
Dim param
Setparam=KeyExistsDemo
   If param.Exists("a") Then
     Msgbox param.Item("a")
   Else
      Msgbox "---"
   EndIf
EndFunction



CallGetKeyInfo

TAG:

 

评分:0

我来说两句

我的栏目

日历

« 2024-05-15  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 8166
  • 日志数: 4
  • 建立时间: 2013-05-29
  • 更新时间: 2016-08-07

RSS订阅

Open Toolbar