QTP 初起步

上一篇 / 下一篇  2010-08-17 14:47:06 / 个人分类:QTP

 
调用其他应用程序:
 
Call Startup
Function Startup
  SystemDrive=GetCDDrive("**")
 startup_command=SystemDrive&"\**"
    set pro = getobject("winmgmts:\\.").instancesof("Win32_Process")
 check_process=false
 For each ps in pro
  If UCase(ps.name)="aa.exe" or UCase(ps.name)="bb.exe" Then
   SystemUtil.CloseProcessByName(ps.name)
  End If
 Next
 SystemUtil.Run startup_command
 Do
  If Dialog("aa").Exist(2) Then
   Dialog("aa").CaptureBitmap "aa",True
  End If
  If Dialog("bb").Exist(2) Then
            Dialog("bb").CaptureBitmap "bb",True
   Dialog("bb").WinButton("c").Click
  End If
  If Dialog( "cc").Exist(5)Then
   Exit Do
  End If
 Loop
End Function

Function GetCDDrive(keyword)
   If keyword="" Then
    keywork="cc"
   End If
   Set bjFSO=CreateObject("Scripting.FileSystemObject")
   Set bjDrives=objFSO.Drives
   For each objDrive in objDrives
        If objDrive.IsReady and objDrive.DriveType=4Then
   If objDrive.VolumeName=keyword Then
    GetCDDrive=objDrive
    Exit For
   End If
  End If
   Next
   Set bjFSO=nothing
End Function

TAG:

 

评分:0

我来说两句

Open Toolbar