Monthly Archives: February 2011

To Close all Internet Explorers

Before going to run your script needs to close all IEs,it helps you to work with QTP without any object /browser identification problems. just have a look here, Public function closeAllBrowsers() Dim qtStartTime, ieStartTime, strComputer, objWMIService,ieProcessList,qtProcessList strComputer = “.” Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2″) Set ieProcessList = objWMIService.ExecQuery (“Select * from Win32_Process [...]

Locale Settings

We can set as per our local time/zone,time formats… 1.SetLocale(lcid) a.if lcid=0 then the locale is set to match the current system setting Msgbox (SetLocale(0))–>1033 b.Msgbox (SetLocale(“en-gb”))–>1033 c.SetLocale(currentLocale)–>1033 Note:1033 denotes “English – United States” Zone by using this u can customize your time formats,zones,etc  

To Get repeat sequences of random numbers

Suppose if you want to test your application functionality with same repeated sequence of random number then use Rnd(-1) here use Rnd argument number as -1 Script: Dim MyValue, Response Randomize   ‘ Initialize random-number generator. Do Until Response = vbNo MyValue = Int((9 * Rnd(-1)) + 1)   ‘ Generate random value between 1 and 9. [...]

Find YOur Zone Time

‘If you want find specific local time zone. Function Local_TimeZone() Dim strComputer,oWMIService,oComputer, allColComputer strComputer = “.” Set oWMIService = GetObject(“winmgmts:” _ & “{impersonationLevel=impersonate}!\\” _ & strComputer & “\root\cimv2″) Set allColComputer = oWMIService.ExecQuery _ (“Select * from Win32_TimeZone”) For Each oComputer in allColComputer msgbox oComputer.Description Exit For Next Set oComputer = Nothing Set allColComputer = Nothing [...]

How to lock your system automatically

’If you want lock your sustem once your script running is done automatically just you call the below function. ‘If you want lick ur system(for manual users)save this function in a .VBS file and then give one double click. Function Lock_Mysystem() Dim oSys,Syscmd Set oSys = CreateObject(“WScript.Shell”) Syscmd = “%windir%\SYSTEM32\rundll32.exe user32.dll,LockWorkStation” oSys.Run Syscmd, 0, False [...]

Follow

Get every new post delivered to your Inbox.