ImageVerifierCode 换一换
格式:DOC , 页数:5 ,大小:37.50KB ,
资源ID:3552651      下载积分:20 文钱
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,省得不是一点点
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.wenke99.com/d-3552651.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: QQ登录   微博登录 

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(QTPScripts.doc)为本站会员(hw****26)主动上传,文客久久仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知文客久久(发送邮件至hr@wenke99.com或直接QQ联系客服),我们立即给予删除!

QTPScripts.doc

1、QTP Script 33 - How to compare two excel sheets of the same excel workbook and highlight the cells with different values in the first sheet?Excel object is being created hereSet Exl_Obj = CreateObject(“Excel.Application“)Exl_Obj.Visible = TrueFile sac1 is being openedSet WB_Obj_1= Exl_Obj.Workbooks.

2、Open(“C:sac1.xls“)Cells in the first and second sheet of sac1 are comparedSet WS_Obj_1= WB_Obj_1.Worksheets(1)Set WS_Obj_2= WB_Obj_1.Worksheets(2)For Each cell In WS_Obj_1.UsedRangeIf cell.Value WS_Obj_2.Range(cell.Address).Value Thencell.Interior.ColorIndex = 6Elsecell.Interior.ColorIndex = 0End If

3、NextExl_Obj.workbooks(“sac1.xls“).saveExl_Obj.workbooks(“sac1.xls“).closeExl_Obj.workbooks(“sac2.xls“).saveExl_Obj.workbooks(“sac2.xls“).closeExl_Obj.Application.Quitset Exl_Obj=nothingQTP Script 31 - How to compare range of cells in two excel files and highlight the cells with different values in t

4、he first file?myrange=inputbox(“enter range of cells e.g. A1:A5“)Excel object is being created hereSet Exl_Obj = CreateObject(“Excel.Application“)Exl_Obj.Visible = TrueTwo files sac1 and sac2 are openedSet WB_Obj_1= Exl_Obj.Workbooks.Open(“C:sac1.xls“)Set WB_Obj_2= Exl_Obj.Workbooks.Open(“C:sac2.xls

5、“)Cells in the first sheet of both the files are comparedSet WS_Obj_1= WB_Obj_1.Worksheets(1)Set WS_Obj_2= WB_Obj_2.Worksheets(1)For Each cell In WS_Obj_1.Range(myrange)If cell.Value 0 Thenuu= Replace(File.Path, old_val, new_val)uu1= uu1 &vbcrlf &uuFile.Move Replace(File.Path,old_val,new_val)total_f

6、iles_renamed = total_files_renamed + 1elsetotal_files_skipped = total_files_skipped + 1End IfNextEnd SubQTP Script 29 - How to rename all the files in a folder?Type the below code in a notepad, save it with .vbs extension and run it from command prompt. You have to change the folder name (C:abc) and

7、 the strname to suit your requirements. Below code renames all the files in a given folder to Sac 1, Sac 2.and so on.strComputer = “.“Set objWMIService = GetObject (“winmgmts:“ &strComputer &“rootcimv2“)Set colFileList = objWMIService.ExecQuery (“ASSOCIATORS OF Win32_Directory.Name=C:abc Where “ &“R

8、esultClass = CIM_DataFile“)x=1For Each objFile In colFileListstrname = “Sac “ &xstrNewName = objFile.Drive &objFile.Path &strname &“.“ &objFile.ExtensionerrResult = objFile.Rename(strNewName)x=x+1Nextsource:http:/ know more about Windows Management Instrumentation go here.http:/ Script 28 - How to r

9、ename all subfolders within a given folder?Type the below code in a notepad, save it with .vbs extension and run it from command prompt.In case nothing is entered for main_folder or search_string or replace_string, the script will quit.main_folder = inputbox (“Enter the main folder whose subfolders

10、need to be renamed“ &vbcrlf &“e.g. C:Folder“)if main_folder=“ then quit_functionsearch_string = inputbox (“Enter the string to be searched“)If search_string = “ then quit_functionreplace_string = inputbox (“Enter the string to be replaced“)If replace_string = “ then quit_functionSet object_FSO= Crea

11、teObject (“Scripting.FileSystemObject“)rename_function main_folderSub rename_function (byval Folder)GetFolder method is used to get the Folder object for the path that you specify. You can then use the new variable containing the folder object to access its various methods and properties.Set object_

12、folder = object_FSO.GetFolder (Folder)SubFolder property returns a Folders collection consisting of all the subfolders in a given folder.Set sub_folders = object_folder.SubfoldersFor each subfolder in sub_foldersnew_foldername = (Replace (subfolder.name, search_string, replace_string)If new_folderna

13、me Options - Folders tab) through a script.How to add any path in the Search List (Tools - Options - Folders tab) through a script. We are opening a test called “call twra“ and adding a path C:Program FilesMercury InteractiveQuickTest ProfessionalTests in the Search List (Tools - Options - Folders t

14、ab)Dim qtp_appDim str_pathSet qtp_app = CreateObject (“QuickTest.Application“)qtp_app.Launchqtp_app.Visible = Trueqtp_app.Open “C:Program FilesMercury InteractiveQuickTest ProfessionalTestscall twra“, True, False If the folder C:Program FilesMercury InteractiveQuickTest ProfessionalTests is not ther

15、e just add it.str_path = qtp_app.Folders.Locate (“C:Program FilesMercury InteractiveQuickTest ProfessionalTests“)If the folder is not found in the collection, add itIf qtp_app.Folders.Find (str_path) = -1 Thenqtp_app.Folders.Add str_path, 1 Add the folder to the collectionEnd IfIf you have moved “ downwards in the list, bring it back to first position.If qtp_app.Folders.Item (2) = “ Thenqtp_app.Folders.MoveToPos 1, 2 End If

Copyright © 2018-2021 Wenke99.com All rights reserved

工信部备案号浙ICP备20026746号-2  

公安局备案号:浙公网安备33038302330469号

本站为C2C交文档易平台,即用户上传的文档直接卖给下载用户,本站只是网络服务中间平台,所有原创文档下载所得归上传人所有,若您发现上传作品侵犯了您的权利,请立刻联系网站客服并提供证据,平台将在3个工作日内予以改正。