文章分类 -  QTP技巧-Vbs相关

摘要:TC_Path = "***"process_name = "BL"Set fso = CreateObject("Scripting.FileSystemObject")Set parentFolders = fso.GetFolder(TC_Path & process_name)Set fc = parentFolders.SubFolderstcid = ""For Each f in fc tc_name = f.name' index = Instr(1, tc_name, " 阅读全文
posted @ 2013-04-16 18:17 dushuai 阅读(302) 评论(0) 推荐(0)
摘要:Function TestMe(A)TestMe = A + 10End FunctionFunction TestMe(ByVal A)TestMe = A + 20End Function 阅读全文
posted @ 2012-07-10 20:39 dushuai 阅读(104) 评论(0) 推荐(0)
摘要:第一种方法:Dim iCount, iFoundiCount = 0iFound = 0iFound = inStr(iFound + 1, mainStr, subStr)While iFound <> 0iCount = iCount + 1iFound = InStr(iFound + 1, mainStr, subStr)Wend第二种方法: iCount = UBound(Split(mainStr, subStr))第三种方法: iCount = (Len(mainStr) - Len(Replace(mainStr, subStr, ""))) / 阅读全文
posted @ 2012-07-09 14:25 dushuai 阅读(155) 评论(0) 推荐(0)
摘要:整数:VarA = VarA + VarBVarB = VarA - VarBVarA = VarA - VarB字符串:VarA = VarB & VarAVarB = Mid(VarA, Len(VarB) + 1)VarA = Left(VarA, Len(VarA)- Len(VarB)) 阅读全文
posted @ 2012-07-01 11:31 dushuai 阅读(133) 评论(0) 推荐(0)
摘要:Option ExplicitRedim arrTest(2)arrTest(0) = "Test"不会报错, Redim已经有申明数组变量的作用, 不需要使用dim了 阅读全文
posted @ 2012-07-01 11:20 dushuai 阅读(209) 评论(0) 推荐(0)
摘要:SetLocale将脚本的区域设置修改为制定区域Call SetLocale("en-au")GetLocale获取脚本的区域设置oldLocale = GetLocale 阅读全文
posted @ 2012-07-01 11:17 dushuai 阅读(324) 评论(0) 推荐(0)
摘要:1. 使用Timer函数, 但是时间超过午夜时就不好用了2. 先使用Now获取两次的时间, 使用DateDiff进行时间差计算3. 使用MercuryTimersMercuryTimers("Test").StartWait 5MercuryTimers("Test").Stopmsgbox MercuryTimers("Test") 阅读全文
posted @ 2012-06-30 14:42 dushuai 阅读(257) 评论(0) 推荐(0)
摘要:Set oIE = CreateObject("InternetExplorer.Application")oIE.Visible = True 阅读全文
posted @ 2012-06-17 11:27 dushuai 阅读(1621) 评论(1) 推荐(0)
摘要:GetObject将获取到首次打开的Excel句柄 阅读全文
posted @ 2012-06-17 11:24 dushuai 阅读(219) 评论(0) 推荐(0)
摘要:如果我们给ByVal参数传递一个变量,VBS拷贝这个变量给函数的参数,任何对这个变量有赋值的地方不会影响被传入的变量本身.如果我们给ByRef参数传递一个变量,这个参数将引用原始的变量,任何对这个变量有赋值的地方将影响被传入的变量本身.默认情况下, 参数传递方式为ByRef. 阅读全文
posted @ 2012-06-02 22:36 dushuai 阅读(220) 评论(0) 推荐(0)