Search This Blog

Monday, May 9, 2011

Run Script - For associating all libraries, repositories and environment variables

Dim App 'As Application
Set App = CreateObject("QuickTest.Application")
App.Launch
App.Visible = True
App.Test.Settings.Launchers("Windows Applications").Active = False
App.Test.Settings.Launchers("Windows Applications").Applications.RemoveAll
App.Test.Settings.Launchers("Windows Applications").RecordOnQTDescendants = True
App.Test.Settings.Launchers("Windows Applications").RecordOnExplorerDescendants = False
App.Test.Settings.Launchers("Windows Applications").RecordOnSpecifiedApplications = True
App.Test.Settings.Run.IterationMode = "rngAll"
App.Test.Settings.Run.StartIteration = 1
App.Test.Settings.Run.EndIteration = 1
App.Test.Settings.Run.ObjectSyncTimeOut = 120000
App.Test.Settings.Run.DisableSmartIdentification = False
App.Test.Settings.Run.OnError = "NextStep"
App.Open "D:\Ranger Automation\Main Script\SmokeTest", False
App.Test.Settings.Resources.DataTablePath = "D:\Ranger Automation\Data Folder\Session Data\SmokeTest.xls"
App.Test.Settings.Resources.Libraries.RemoveAll

App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functional Layer\Ebeam_MainWindow.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functional Layer\iAS-Div.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functional Layer\IAS_FunctionalLayer.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functional Layer\Review.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functional Layer\Run_InspectionQueue_FunctionalLayer.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functional Layer\SetUp.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functional Layer\SetupRun_ReviewWafer_FunctionalLayer.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functional Layer\Setup_Button_ValidationStatus.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functional Layer\SetUp_Run.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functional Layer\Test_TestSummaryGrid.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functional Layer\Utilities.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functional Layer\WaferSetup.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functional Layer\WaferSetup_FunctionalLayer.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\Applic_Path.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\Calling Logger.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\Framework_Functions.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\Job Queue.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\KT-Logger.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\MachineLaunch.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\New_TestCase.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\QTP_Logger.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\Ranger_Recipe.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\Ranger_SubFunction.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\RunJobQueue.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\Utility.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\WPP_Feature.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\WPP_FunctionLayer.vbs")
App.Test.Settings.Resources.Libraries.Add("D:\Ranger Automation\Class\Functions\WPP_Functions.vbs")
App.Test.Settings.Web.BrowserNavigationTimeout = 60000
App.Test.Settings.Web.ActiveScreenAccess.UserName = ""
App.Test.Settings.Web.ActiveScreenAccess.Password = ""

App.Folders.RemoveAll

Dim objRepositoryFolder,repositoryFolder,repositoryFiles,repositoryFile
Set objRepositoryFolder = CreateObject("Scripting.FileSystemObject")
Set repositoryFolder = objRepositoryFolder.GetFolder("D:\Ranger Automation\Object Repository")
Set repositoryFiles = repositoryFolder.Files

App.Test.Actions("Action1").ObjectRepositories.RemoveAll

For Each repositoryFile In repositoryFiles
App.Test.Actions("Action1").ObjectRepositories.Add "D:\Ranger Automation\Object Repository" & "\" & repositoryFile.Name
Next

Call App.Test.Environment.LoadFromFile("D:\Ranger Automation\Class\Environment.xml",true)

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' System Local Monitoring settings
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
App.Test.Settings.LocalSystemMonitor.Enable = false
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Log Tracking settings
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
With App.Test.Settings.LogTracking
.IncludeInResults = False
.Port = 18081
.IP = "127.0.0.1"
.MinTriggerLevel = "ERROR"
.EnableAutoConfig = False
.RecoverConfigAfterRun = False
.ConfigFile = ""
.MinConfigLevel = "WARN"
End With

Tuesday, January 18, 2011

Getting the number of files with same extension in a folder

Flag = 0
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oFolder = oFSO.GetFolder(sPath) 'Path of the folder
Set oFile = oFolder.Files
For each sFile in oFile
Pos = Instr(1,sFile.name,".jpeg",1) ' change the extn as required.
If Pos <> 0 Then
Flag =Flag +1
End If
Next
msgbox Flag

Monday, January 3, 2011

Reading data from a virtual table

This post will help you in reading data from a virtual table. This is really helpful and we took a very long time to come up with this solution. It is very simple but that thought process took some time to set in ;). So here we go.

Create the virtual table using the virtual objects manager. The properties available to you would be Width, Height, Rows, Columns, x, y.

Get the height and width of a single cell by dividing the table width and height by the column and row values respectively.

x and y are the values of the top left corner of the first cell, to get the bottom right corner add the height and width calculated for a single cell. Now use the GetVisibleText property with the parent object.

Like,
Say you have a grid or table that is recognized as a winobject, and you create a virtual table for it. Now the code to read the data from the first cell of the table would be:

val = Window(" ").Page(" ").WinObject(" ").GetVisibleText(x,y,x1,y1)
msgbox val