Jump to content

AutoIT Class/Instance Issues


Recommended Posts

Hi there,

I am trying to use Controlclick but I am having issues after the first window.

I am able to use controlclick for the first window of a database software I am using but it pops up another window with the same Class and I don't know how to use controlclick anymore.

My code is attached.

I begin having issues after the sleep(3000)

ControlClick("EQuIS Login", "", "[CLASS:WindowsForms10.Window.8.app.0.33c0d9d; INSTANCE:4]","",3, 74, 47)
ControlClick("EQuIS Login", "", "[CLASS:WindowsForms10.Window.8.app.0.33c0d9d; INSTANCE:4]","",3, 91, 66)

;Site selection in eQuis
If $SiteID == "Bonavista" Then
    ControlClick("EQuIS Login", "", "[CLASS:WindowsForms10.Window.8.app.0.33c0d9d; INSTANCE:4]","",3, 121, 83)
ElseIf $SiteID == "Canadian Natural" Then
    ControlClick("EQuIS Login", "", "[CLASS:WindowsForms10.Window.8.app.0.33c0d9d; INSTANCE:4]","",3, 148, 99)
ElseIf $SiteID == "Keyera" Then
    ControlClick("EQuIS Login", "", "[CLASS:WindowsForms10.Window.8.app.0.33c0d9d; INSTANCE:4]","",3, 123, 119)
ElseIf $SiteID == "Long Run" Then
    ControlClick("EQuIS Login", "", "[CLASS:WindowsForms10.Window.8.app.0.33c0d9d; INSTANCE:4]","",3, 102, 137)
ElseIf $SiteID == "Penn-West" Then
    ControlClick("EQuIS Login", "", "[CLASS:WindowsForms10.Window.8.app.0.33c0d9d; INSTANCE:4]","",3, 125, 153)
ElseIf $SiteID == "Zargon" Then
    ControlClick("EQuIS Login", "", "[CLASS:WindowsForms10.Window.8.app.0.33c0d9d; INSTANCE:4]","",3, 107, 171)
EndIf

Local $MsgBoxVar = MsgBox(1, 'Selection', 'Please select the site and press OK when finished.')
If $MsgBoxVar = 2 Then
Else
EndIf
Sleep(3000)

$hWnd = WinGetHandle("EQuIS Professional","")
WinActivate($hWnd)
ControlClick("EQuIS Professional", "", "[CLASS:WindowsForms10.Window.8.app.0.33c0d9d; INSTANCE:9]","",3, 107, 171)
MouseClick("left", 42, 107, 1)

WinActivate("EQuIS Data Processor","")
WinSetState("[ACTIVE]", "", @SW_MAXIMIZE)
Edited by LiMehFul
Link to comment
Share on other sites

Why are you clicking the button 3 times? Also, the X/Y parameters are rarely needed and usually when someone uses them they're using them incorrectly. Get rid of the X/Y coordinates as they're probably not needed.

If that doesn't work, then try >this UDF to see if it can find the controls.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Why are you clicking the button 3 times? Also, the X/Y parameters are rarely needed and usually when someone uses them they're using them incorrectly. Get rid of the X/Y coordinates as they're probably not needed.

If that doesn't work, then try >this UDF to see if it can find the controls.

 

I was just fooling around with click types because I was getting frustrated. I tried removing the X/Y but still no results.

I tried using the simplyspy and it returned this

Mouse position is retrieved -1577-265
At least we have an element [EDP][]
Having the following values for all properties: 
Title is: <EDP> Class   := <>   controltype:= <UIA_ButtonControlTypeId> ,<50000>    , (0000C350)    
*** Parent Information ***
Title is: <Import>  Class   := <>   controltype:= <UIA_ToolBarControlTypeId>    ,<50021>    , (0000C365)    
*** Detailed properties of the highlighted element ***
UIA_AcceleratorKeyPropertyId :=
UIA_AccessKeyPropertyId :=
UIA_AriaPropertiesPropertyId :=
UIA_AriaRolePropertyId :=
UIA_AutomationIdPropertyId :=
UIA_BoundingRectanglePropertyId :=-1592;238;56;89
UIA_ClassNamePropertyId :=
UIA_ClickablePointPropertyId :=
UIA_ControllerForPropertyId :=
UIA_ControlTypePropertyId :=50000
UIA_CulturePropertyId :=0
UIA_DescribedByPropertyId :=
UIA_DockDockPositionPropertyId :=5
UIA_ExpandCollapseExpandCollapseStatePropertyId :=3
UIA_FlowsToPropertyId :=
UIA_FrameworkIdPropertyId :=
UIA_GridColumnCountPropertyId :=0
UIA_GridItemColumnPropertyId :=0
UIA_GridItemColumnSpanPropertyId :=1
UIA_GridItemContainingGridPropertyId :=
UIA_GridItemRowPropertyId :=0
UIA_GridItemRowSpanPropertyId :=1
UIA_GridRowCountPropertyId :=0
UIA_HasKeyboardFocusPropertyId :=False
UIA_HelpTextPropertyId :=
UIA_IsContentElementPropertyId :=True
UIA_IsControlElementPropertyId :=True
UIA_IsDataValidForFormPropertyId :=False
UIA_IsDockPatternAvailablePropertyId :=False
UIA_IsEnabledPropertyId :=True
UIA_IsExpandCollapsePatternAvailablePropertyId :=False
UIA_IsGridItemPatternAvailablePropertyId :=False
UIA_IsGridPatternAvailablePropertyId :=False
UIA_IsInvokePatternAvailablePropertyId :=True
UIA_IsItemContainerPatternAvailablePropertyId :=False
UIA_IsKeyboardFocusablePropertyId :=True
UIA_IsLegacyIAccessiblePatternAvailablePropertyId :=True
UIA_IsMultipleViewPatternAvailablePropertyId :=False
UIA_IsOffscreenPropertyId :=False
UIA_IsPasswordPropertyId :=False
UIA_IsRangeValuePatternAvailablePropertyId :=False
UIA_IsRequiredForFormPropertyId :=False
UIA_IsScrollItemPatternAvailablePropertyId :=False
UIA_IsScrollPatternAvailablePropertyId :=False
UIA_IsSelectionItemPatternAvailablePropertyId :=False
UIA_IsSelectionPatternAvailablePropertyId :=False
UIA_IsSynchronizedInputPatternAvailablePropertyId :=False
UIA_IsTableItemPatternAvailablePropertyId :=False
UIA_IsTablePatternAvailablePropertyId :=False
UIA_IsTextPatternAvailablePropertyId :=False
UIA_IsTogglePatternAvailablePropertyId :=False
UIA_IsTransformPatternAvailablePropertyId :=False
UIA_IsValuePatternAvailablePropertyId :=False
UIA_IsVirtualizedItemPatternAvailablePropertyId :=False
UIA_IsWindowPatternAvailablePropertyId :=False
UIA_ItemStatusPropertyId :=
UIA_ItemTypePropertyId :=
UIA_LabeledByPropertyId :=
UIA_LegacyIAccessibleChildIdPropertyId :=0
UIA_LegacyIAccessibleDefaultActionPropertyId :=Press
UIA_LegacyIAccessibleDescriptionPropertyId :=Import EDDs using EDP (hold <SHIFT> for EDP Express)
UIA_LegacyIAccessibleHelpPropertyId :=
UIA_LegacyIAccessibleKeyboardShortcutPropertyId :=
UIA_LegacyIAccessibleNamePropertyId :=EDP
UIA_LegacyIAccessibleRolePropertyId :=43
UIA_LegacyIAccessibleSelectionPropertyId :=
UIA_LegacyIAccessibleStatePropertyId :=1048576
UIA_LegacyIAccessibleValuePropertyId :=
UIA_LocalizedControlTypePropertyId :=button
UIA_MultipleViewCurrentViewPropertyId :=0
UIA_MultipleViewSupportedViewsPropertyId :=
UIA_NamePropertyId :=EDP
UIA_NativeWindowHandlePropertyId :=0
UIA_OrientationPropertyId :=0
UIA_ProcessIdPropertyId :=4152
UIA_ProviderDescriptionPropertyId :=[pid:4152,hwnd:0x0 Main(parent link):Microsoft: MSAA Proxy (unmanaged:uiautomationcore.dll)]
UIA_RangeValueIsReadOnlyPropertyId :=True
UIA_RangeValueLargeChangePropertyId :=0
UIA_RangeValueMaximumPropertyId :=0
UIA_RangeValueMinimumPropertyId :=0
UIA_RangeValueSmallChangePropertyId :=0
UIA_RangeValueValuePropertyId :=0
UIA_RuntimeIdPropertyId :=
UIA_ScrollHorizontallyScrollablePropertyId :=False
UIA_ScrollHorizontalScrollPercentPropertyId :=0
UIA_ScrollHorizontalViewSizePropertyId :=100
UIA_ScrollVerticallyScrollablePropertyId :=False
UIA_ScrollVerticalScrollPercentPropertyId :=0
UIA_ScrollVerticalViewSizePropertyId :=100
UIA_SelectionCanSelectMultiplePropertyId :=False
UIA_SelectionIsSelectionRequiredPropertyId :=False
UIA_SelectionselectionPropertyId :=
UIA_SelectionItemIsSelectedPropertyId :=False
UIA_SelectionItemSelectionContainerPropertyId :=
UIA_TableColumnHeadersPropertyId :=
UIA_TableItemColumnHeaderItemsPropertyId :=
UIA_TableRowHeadersPropertyId :=
UIA_TableRowOrColumnMajorPropertyId :=2
UIA_TableItemRowHeaderItemsPropertyId :=
UIA_ToggleToggleStatePropertyId :=2
UIA_TransformCanMovePropertyId :=False
UIA_TransformCanResizePropertyId :=False
UIA_TransformCanRotatePropertyId :=False
UIA_ValueIsReadOnlyPropertyId :=True
UIA_ValueValuePropertyId :=
UIA_WindowCanMaximizePropertyId :=False
UIA_WindowCanMinimizePropertyId :=False
UIA_WindowIsModalPropertyId :=False
UIA_WindowIsTopmostPropertyId :=False
UIA_WindowWindowInteractionStatePropertyId :=0
UIA_WindowWindowVisualStatePropertyId :=0

Can I use any of that information to manipulate my controlclick?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...