Friday, October 20, 2017

Micro Focus UFT - SwfList - Print all items - select the required items

VEMbv  = "R NA"
VTIDbv = "R NA"


SwfWindow("ASHA").SwfWindow("NIC").Activate
'''''''Option 1

SwfWindow("ASHA").SwfWindow("NIC").SwfObject("Your EID").DblClick 151,15
SwfWindow("ASHA").SwfToolbar("SwfToolbar").SwfList("SwfList").Select VEMbv

'''''' OR 'Option 2

Dim EmailStatusallitems
Dim EmailStatusvalue

SwfWindow("ASHA").SwfWindow("NIC").SwfObject("Your EID").DblClick 151,15
EmailStatusallitems = SwfWindow("ASHA").SwfToolbar("SwfToolbar").SwfList("SwfList").GetROProperty("all items")

EmailStatusvalue = SwfWindow("ASHA").SwfToolbar("SwfToolbar").SwfList("SwfList").getItem(0)
EmailStatusvalue1 = SwfWindow("ASHA").SwfToolbar("SwfToolbar").SwfList("SwfList").getItem(1)
EmailStatusvalue2 = SwfWindow("ASHA").SwfToolbar("SwfToolbar").SwfList("SwfList").getItem(2)
EmailStatusvalue3 = SwfWindow("ASHA").SwfToolbar("SwfToolbar").SwfList("SwfList").getItem(3)

Msgbox EmailStatusvalue
Msgbox EmailStatusvalue1
Msgbox EmailStatusvalue2
Msgbox EmailStatusvalue3

'''''' OR 'Option 3

SwfWindow("ASHA").SwfWindow("NIC").SwfObject("Email Address").DblClick 151,15

EmailStatusItemsCount = SwfWindow("ASHA").SwfToolbar("SwfToolbar").SwfList("SwfList").GetROProperty("items count")
msgbox EmailStatusItemsCount

For jList = 0 To EmailStatusItemsCount-1 

SwfWindow("ASHA").SwfWindow("NIC").SwfObject("Email Address").DblClick 151,15

'msgbox SwfWindow("ASHA").SwfToolbar("SwfToolbar").SwfList("SwfList").getItem(jList)
SwfWindow("ASHA").SwfToolbar("SwfToolbar").SwfList("SwfList").Select (2)

Next


SwfWindow("ASHA").SwfWindow("NIC").SwfEdit("SwfEdit").Type  micTab

Wednesday, October 18, 2017

Micro Focus UFT - How to pass parameters between actions (Action 1- MainScript to Action 2 - SubScript)

How to pass parameters between actions  (Action 1- MainScript  to Action 2 - SubScript)

[In Action 1] - MainScript
....
X = 1019786

VarX = DataTable("MCC_HSD""MainScript")

RunAction "SubScript [SubScript]", oneIteration, X
RunAction "SubScript [SubScript]", oneIteration, VarX

Print "After at Main Script value X : " &X
Print "After at Main Script value VarX : " &VarX
[In Action 2] - SubScript
....
Go to Action Properties; create an Input Parameter, say "X". and retrieve the variable X in Action 2.


Print "RunAction From Main Script to Sub value X : " &X
Print "RunAction From Main Script to Sub value VarX : " &VarX

X = 10
Print "Local Value of X :" &X

VarByValX =  Parameter("X")
Print "Before Manipulating the Value In Sub /Offer Script value X : " &VarByValX

VarByValX = VarByValX *1000
Print "After Manipulating the Value In Sub /Offer Script value X : " &VarByValX
------ *------ * ------ *------ *------ *------ *------
Now : Execute the MainScript
OUTPUT:
RunAction From Main Script to Sub value X :
RunAction From Main Script to Sub value VarX :
Local Value of X :10
Before Manipulating the Value In Sub /Offer Script value X : 1019786
After Manipulating the Value In Sub /Offer Script value X : 1019786000
RunAction From Main Script to Sub value X :
RunAction From Main Script to Sub value VarX :
Local Value of X :10
Before Manipulating the Value In Sub /Offer Script value X : 3
After Manipulating the Value In Sub /Offer Script value X : 3000
After at Main Script value X : 1019786

After at Main Script value VarX : 3