Kharizmah

UIAutomation - Problem accessing Toggle PropertyID

7 posts in this topic

#1 ·  Posted (edited)

junkew

I've been researching pretty extensively through your wrapper examples and concepts in order to automate a program I am working with and have come across a snag.

I'm hoping you can help me out with this. 

 

If I use inspect I can see  the toggle state is clearly off. 

 

inspect.png

 

Unfortunately, if I use SimpleSpy I see this.

 

simplespy.png

 

 

This State does not change whether the button is enabled or disabled.  Therefore, this number is unusable.

TogglePattern is set to False.  So I'm thinking it's not detecting the toggle state at all.

I can access the Toggle ID but the result is as expected (2).  It's not seeing what inspect.exe is seeing.

This is the code I'm using.

autoitToggle.png

 

From the SDK I only pulled Inspect.exe, so I'm going to try installing the entire SDK to see if that updates any of the drivers the wrapper is using.

Until then I hope you can contact me with any possible ideas.

 

Thanks In Advance

Edited by Melba23

Share this post


Link to post
Share on other sites



Are you sure, that you are looking at the same controls with Inspect.exe and SimpleSpy? Several values are different:

 

Inspect.exe     SimpleSpy
ToggleState              0               2
LegacyIAccessibleRole    43              40
LegacyIAccessibleState   0x100000        0

I have compared data between Inspect.exe and SimpleSpy many times. It is my experience that the values are the same for the same controls.

You should show the full output from both programs (in textboxes).

If you want junkew's attention, you should add "UIAutomation" to the topic title.

Share this post


Link to post
Share on other sites

I don't know how to change the title without starting a new forum.  If I need to that please let me know.

The programs I am comparing are WinSDK_Inspect_exe_x86.exe and SimpleSpy

Perhaps that is different from the inspect.exe you are referring to?  I found it by following the directions off of

http://stackoverflow.com/questions/8154169/inspect-exe-missing-in-windows-sdk-for-server-2008

Perhaps you are referring to:

"C:Program FilesMicrosoft SDKsWindowsv7.0Binx64Inspect.exe"

Which is even less useful than Simple Spy.  Simple Spy's "cognitive" ability seems to fall into some middle ground between the two.

I just need to know if there is a way to bridge the gap?

Share this post


Link to post
Share on other sites

Kharizmah,

 

I don't know how to change the title

Edit the first post and use the "Full Editor" option to be able to edit the title. ;)

But I have done it for you this time - and moved the thread to GH&S. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

@Melba23

Awesome.  Thanks :thumbsup: .

 

@LarsJ

It doesn't seem to matter whether I look at:

  • LegacyIAccessibleRole
  • LegacyIAccessibleState
  • ToggleState

The problem is they don't change when the button is enabled or disabled.  If any of these or any other values did show an active response, I certainly would use it.

Share this post


Link to post
Share on other sites

Nevermind,

The problem lies with the coder - as usual.

It's true simple spy is not registering the Toggle.state but that could be due to the continuing depths of the WPF framework.

However, it turned out I was just at the wrong level on the path.  The wrapper was able to sense the toggle state - even if it isn't reporting it.

That's really all that matters.

Share this post


Link to post
Share on other sites

although answered alternate ways are

1. to watch the events that are happening sometimes they reveal more

2. simplespy uses the plain iuiAutomation logic to determine a window and sometimes that gives wrong directions (for understanding this use simplespy on an MS Access Form textbox and press ctrl+w and compare it to the tree of inspect.exe). To circumvent this you should scan the whole tree and check all controls and compare the location of mouse to location of all controls (far slower then getelementfrompoint)

3. for togglestate logic not implemented on many controls I fall back to checking the area for a certain color like pixelgetcolor or pixelchecksum to now if its on/off/true/false

Share this post


Link to post
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