Tuesday, November 9, 2010

editing a registry file with VBScript

Option Explicit
'Declare variables
Dim WSHShell, rr, rr2, MyBox, val, val2, ttl, toggle
Dim jobfunc, itemtype
On Error Resume Next
Set WSHShell = WScript.CreateObject("WScript.Shell")
val = "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools"
val2 = "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools"
itemtype = "REG_DWORD"
jobfunc = "Registry Editing Tools are now "
ttl = "Result"
'reads the registry key value.
rr = WSHShell.RegRead (val)
rr2 = WSHShell.RegRead (val2)
toggle=1
If (rr=1 or rr2=1) Then toggle=0
If toggle = 1 Then
WSHShell.RegWrite val, 1, itemtype
WSHShell.RegWrite val2, 1, itemtype
Mybox = MsgBox(jobfunc & "disabled.", 4096, ttl)
Else
WSHShell.RegDelete val
WSHShell.RegDelete val2
Mybox = MsgBox(jobfunc & "enabled.", 4096, ttl)
End If

Thursday, November 4, 2010

Schedule/execute testset run in Quality Center from Windows (VBScript)

http://the-koala-egg.blogspot.com/2008/02/scheduleexecute-testset-run-in-quality.html
-----------------
VBScript:

Dim QCConnectionSet
QCConnection = CreateObject("TDApiOle80.TDConnection")



QCConnection.InitConnectionEx "server_address" ' <--------------- Fill in server addressQCConnection.login "user", "pwd" '<------------------- FILL in user/pwd

QCConnection.Connect "domain_name", "project_name" '<----------- FILL Domain/Project

Set TSetFact = QCConnection.TestSetFactory
Set tsTreeMgr = QCConnection.TestSetTreeManager
nPath = "Root\test" '<------------- FILL IN PATH TO TESTSET

Set tsFolder = tsTreeMgr.NodeByPath(nPath)
If tsFolder Is Nothing Then
msgbox "error"

End If


Set tsList = tsFolder.FindTestSets("name_of testset") '<------- FILL IN NAME OF TESTSET
If tsList.Count > 1 Then
MsgBox "FindTestSets found more than one test set: refine search"
ElseIf tsList.Count <>
MsgBox "FindTestSets: test set not found"
End If


Set theTestSet = tsList.Item(1)
Set Scheduler = theTestSet.StartExecution("")
Scheduler.RunAllLocally = True
Scheduler.HostTimeOut = 100000
Scheduler.runSet execStatus = Scheduler.ExecutionStatus

RunFinished = False
while RunFinished = False
execStatus.RefreshExecStatusInfo "all", True
RunFinished = execStatus.Finished

wend

QCConnection.Disconnect
QCConnection.Logout
Set QCConnection = Nothing

---------------