Wednesday, 16 January 2013

Stop System from Hibernating..

Stop System from Hibernating..

Intcounter1=0
ans=InputBox("Enter Hours","Awake System",1)
If ans="" then
ans=1
End if
intend=ans*60*60
Do Until intCounter1>intend   '3600 '17280
Set WSHSHell=WScript.createObject("WScript.shell")
WScript.Sleep 5000
WSHSHELL.SendKeys  ("{SCROLLLOCK 2}")
If intCounter%1800 = 0 Then
  Set qtApp = CreateObject("QuickTest.Application") ' Create the application object
  qtApp.Launch() ' Start QuickTest
  qtApp.Visible = True' Make the QuickTest application visible
  qtApp.Options.Run.RunMode = "Fast"
  qtApp.Options.Run.ViewResults = False
  'If connection not already established then establish connection(QTP already running)
   If Not qtApp.TDConnection.IsConnected Then
      WScript.Echo("QC is not connected; Connecting to QC.")
      Call qtApp.TDConnection.Connect("http://tstpptappl002.optus.com.au:7001/qcbin", "IRTS-CMM", "TA420_SOS_R10_2", "vivek kaliyaperumal", "optus123", False)
   End If
   Dim objQTPTest 'As TestClass
   If qtApp.TDConnection.IsConnected Then ' If connection is successful 
      Dim strQCTestPath 'As String
      strQCTestPath = "[QualityCenter] Subject\SOS R10.2 / PVM / BB SIT\PPT Automation Regression\OPOM Mobile\dummy\Dataprep_Mobile_CV_1"
      WScript.Echo("Open test from QC: " & strQCTestPath)
      qtApp.Open strQCTestPath ,False ' Open test in read write mode
      Set qtTest = qtApp.test
      qtTest.Run
      qtTest.Close
      Err.Clear()
      On Error GoTo 0
   Else
      MsgBox("Cannot connect to Quality Center") ' If connection is not successful, display an error message.
   End If
   qtApp.TDConnection.Disconnect() ' Disconnect from Quality Center
   qtApp.Quit() ' Exit QuickTest
   Set qtApp = Nothing
   Set qtTest = Nothing
End If   
intCounter1=intCounter1+1
loop

No comments:

Post a Comment