RodrigoFinguer
Board Regular
- Joined
- Jun 13, 2017
- Messages
- 75
Hello guys,
I need to change the date from one application but I don't know how.
The inspect page is attached.
Here is my code so far:
Any help would be apreciated, Thanks!!!
I need to change the date from one application but I don't know how.
The inspect page is attached.
Here is my code so far:
VBA Code:
Dim MyElement As UIAutomationClient.IUIAutomationElement
Dim MyElement1 As UIAutomationClient.IUIAutomationElement
'Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Public Enum oConditions
eUIA_NamePropertyId
eUIA_AutomationIdPropertyId
eUIA_ClassNamePropertyId
eUIA_LocalizedControlTypePropertyId
End Enum
Sub Test()
Dim AppObj As UIAutomationClient.IUIAutomationElement
Dim oInvokePattern As UIAutomationClient.IUIAutomationInvokePattern
Dim oAutomation As New CUIAutomation ' the UI Automation API\
Dim oPattern As UIAutomationClient.IUIAutomationLegacyIAccessiblePattern
Set AppObj = WalkEnabledElements("CSDB - Cost Saving Database")
Set MyElement = AppObj.FindFirst(TreeScope_Children, PropCondition(oAutomation, eUIA_NamePropertyId, "menuStrip1"))
Set MyElement1 = MyElement.FindFirst(TreeScope_Children, PropCondition(oAutomation, eUIA_NamePropertyId, "Forecast"))
Set MyElement = MyElement1.FindFirst(TreeScope_Children, PropCondition(oAutomation, eUIA_NamePropertyId, "Create New"))
Set oInvokePattern = MyElement.GetCurrentPattern(UIAutomationClient.UIA_InvokePatternId)
oInvokePattern.Invoke
Set MyElement = AppObj.FindFirst(TreeScope_Children, PropCondition(oAutomation, eUIA_AutomationIdPropertyId, "panelRight"))
Set MyElement1 = MyElement.FindFirst(TreeScope_Children, PropCondition(oAutomation, eUIA_AutomationIdPropertyId, "Forecast_Edit"))
Set MyElement = MyElement1.FindFirst(TreeScope_Children, PropCondition(oAutomation, eUIA_AutomationIdPropertyId, "panContainer"))
Set MyElement1 = MyElement.FindFirst(TreeScope_Children, PropCondition(oAutomation, eUIA_AutomationIdPropertyId, "panSteps"))
Set MyElement = MyElement1.FindFirst(TreeScope_Children, PropCondition(oAutomation, eUIA_AutomationIdPropertyId, "Forecast_Edit_Main"))
Set MyElement1 = MyElement.FindFirst(TreeScope_Children, PropCondition(oAutomation, eUIA_AutomationIdPropertyId, "panel1"))
Set MyElement = MyElement1.FindFirst(TreeScope_Children, PropCondition(oAutomation, eUIA_AutomationIdPropertyId, "panel2"))
'Title of the TAG
Set MyElement1 = MyElement.FindFirst(TreeScope_Children, PropCondition(oAutomation, eUIA_AutomationIdPropertyId, "txtTitle"))
Set oPattern = MyElement1.GetCurrentPattern(UIA_LegacyIAccessiblePatternId)
oPattern.SetValue ("TIER 2 - TEST")
'Date of the Tag
Set MyElement1 = MyElement.FindFirst(TreeScope_Children, PropCondition(oAutomation, eUIA_AutomationIdPropertyId, "dtPriceValid"))
Set oPattern = MyElement1.GetCurrentPattern(UIA_LegacyIAccessiblePatternId)
oPattern.SetValue ("2020-05-16")
Any help would be apreciated, Thanks!!!