cancel
Showing results for 
Search instead for 
Did you mean: 

Identify current form for script use

SOLVED
Highlighted
Occasional Contributor

Identify current form for script use

Hello,

   I am trying to write a reusable script with a data loop in TestComplete 12, VB Script.

Is there a way for me to identify the current active form? I have searched extensively and found nothing.

 

My script interacts with a data grid and enters a file determined number of items and is quite simple but I would like to use this identification feature in other scripts as well. The grid is on the same location of every form but the form name changes example below: 

1.  Sys.Process("Signon").WinFormsObject("frmPSSales").WinFormsObject("RightFillPan").WinFormsObject("clientPanel").WinFormsObject("SpDataGrid1")

2. Sys.Process("Signon").WinFormsObject("frmPSOrders").WinFormsObject("RightFillPan").WinFormsObject("clientPanel").WinFormsObject("SpDataGrid1")

 

I would like to capture the current "Sys.Process("Signon").WinFormsObject("********")." of the current form so it does not have to passed in to the function.

 

An example of what im doing is below:

 

Sub HMMMM()
frm = ""
frm = "This would be the retrieved form fullname or mapped name"
Call Project.Variables.itemNum.Reset
While Not Project.Variables.itemNum.IsEOF
'Enters the text Project.Variables.itemNum("ItemNumber") in the 'txtBase' text editor.
Call frm.UcGetItemA1.panBase.txtBase.SetText(Project.Variables.itemNum.Value("ItemNumber"))
'Enters '[Enter]' in the 'txtBase' object.
Call frm.UcGetItemA1.panBase.txtBase.Keys("[Enter]")
'Enters '[Enter]' in the 'SPTextBox' object.
Call frm.SPTextBox.Keys("[Enter]")
Call Project.Variables.itemNum.Next
WEnd
End Sub

 

Any help is greatly appreciated.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Manager

@ZXQA Could you take a look at this help topic and let me know if this helps? 

 

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/desktop/activewindow-...

 


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

5 REPLIES 5
Highlighted
Community Hero
Highlighted
Frequent Contributor

Use find for the object which keeps changing
For example for your script try with the below line it should work or else just find correct the name property name correctly with Asterik on the changing field : 
Sys.Process("Signon").Find('Name','WinFormsObject("frm*")',1).WinFormsObject("RightFillPan").WinFormsObject("clientPanel").WinFormsObject("SpDataGrid1")

Highlighted
Community Manager

Thank you for helping everyone!

 

@ZXQA does this help? Please let us know how you solved the issue.


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today
Highlighted
Community Manager

@ZXQA Could you take a look at this help topic and let me know if this helps? 

 

https://support.smartbear.com/testcomplete/docs/reference/test-objects/members/desktop/activewindow-...

 


Sonya Mihaljova
Community and Education Specialist

Learn SmartBear products in a fun and easy way and prove your knowledge!
>>Participate in the TechCorner Challenge today

View solution in original post

Highlighted
Occasional Contributor

Thank you Sonya! I will review it and see if it is what i am after as soon as I am back at work. Thank you again.

New Here?
Join us and watch the welcome video:
Announcements
Join TechCorner Challenge!
Want a fun and easy way to learn TestComplete? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get properties of a web page element

See replies!

Compare images using the Region Checkpoint

See replies!

Compare HTML table with Excel file and correct data in Excel file

Participate!

How to execute remote test and obtain results via Test Runner REST API

Participate!
Top Kudoed Authors