Jump to content
Sign in to follow this  
drapdv

Issue with UIAWrappers.au3 when compiled

Recommended Posts

drapdv
Posted (edited)

So, I have this odd issue happening with UIAWrappers.  When I run simplespy.au3 through SciTE, it finds the object I'm trying to work with, no problem. But, when I compile simplespy.exe, it can't find it.  Another script that utilizes UIAWrappers is experiencing the same phenomenon. EDIT: Compiling as 32-bit or 64-bit does not affect this behavior.

The trouble starts at the very first object I try to get via _UIA_getObjectByFindAll, so I included the $properties2Match array and the object properties that were returned by _UIA_getPropertyValue for that first object both when running from SciTE and when compiled.

It always finds the matches for the title and control type properties.  But when compiled, it fails to find the Automation ID property.  Any ideas as to why this would be happening?  Hoping junkew will see this and have an idea.

 

These are the $properties2Match

30005|Screen/PVN - ###.###.##.## - CDK Drive|0|False
30003|50032|0|False
30011|Portal|0|False

 

Object properties when running from SciTE:

<propertymatching>       
        j:1 propID:[30005] expValue:[Screen/PVN - ###.###.##.## - CDK Drive]actualValue:[Screen/PVN - ###.###.##.## - CDK Drive]1
        j:2 propID:[30003] expValue:[50032]actualValue:[50032]1
        j:3 propID:[30011] expValue:[Portal]actualValue:[Portal]1  :)
</propertymatching>

 

Object properties when script is compiled:

<propertymatching>
        j:1 propID:[30005] expValue:[Screen/PVN - ###.###.##.## - CDK Drive]actualValue:[Screen/PVN - ###.###.##.## - CDK Drive]1
        j:2 propID:[30003] expValue:[50032]actualValue:[50032]1
        j:3 propID:[30011] expValue:[Portal]actualValue:[]0  :o
</propertymatching>

 

Edited by drapdv
Included results of compiling as 32/64-bit application

Share this post


Link to post
Share on other sites
junkew

no clue , never observed that behavior (and 99.99% of the time I do not use automationid as identifying property)

  • leave the property out and if duplicates use as alternative instance:## or indexrelative construction
    if you can find it that way you could retrieve the automationid to see what the actual value is
  • check with inspect.exe to see if you have similar behavior on the object you try to recognize
  • sometimes it makes a difference in which order you start the applications

 

Share this post


Link to post
Share on other sites
drapdv

First of all, thank you for your reply, and for developing this UDF.  I literally couldn't do my job without it!

Second, I figured it out...I ran SciTE as admin, but compiled so it would run without requiring admin rights.  The (poorly obfuscated) screenshot below shows what simplespy could identify when run as admin (left) and when run with standard rights (right).  With admin rights, it cycled through 40 objects to get the one I needed.  Without admin rights, it cycled through only 16, and they were different than the first 16 found when run with admin rights.  Weird deal, but that's how it goes. 

Anyway, basic reminder to UIA people - check your 32/64-bit settings and admin privileges if things aren't behaving.

 

SimpleSpy - Admin vs Reg.jpg

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
Sign in to follow this  

  • Similar Content

    • Dreamfire
      By Dreamfire
      Hi,
      Since today, exe's are being flagged as having a trojan by Windows Defender (Fuery.B!cl)
      Version:  3.3.14.3 - SciTE Version 3.7.3



       

    • nacerbaaziz
      By nacerbaaziz
      Hello all
      I found this function in the Internet
      It is to play audio files from  the compiled script
      I did not understand just one thing on this function
      func play($name, $wait = 0) local Const $SND_RESOURCE = 0x00040004 local Const $SND_ASYNC = 1 ; Play the file - the script will pause as it sounds if $wait = 0 then DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", BitOR($SND_RESOURCE, $SND_ASYNC)) else DllCall("winmm.dll", "int", "PlaySound", "str", $name, "hwnd", 0, "int", $SND_RESOURCE) endIf return 1 endFunc What I did not understand was this variable
      local Const $SND_RESOURCE = 0x00040004 I know that this variable is contains the resource name
      But what if I want to change the name of the resource what i'll do?
      can i do that?
      Thanks in advance
       
    • FrancescoDiMuro
      By FrancescoDiMuro
      Good evening everyone
      I was trying to compile my executable, adding #pragma directives instead of #AutoIt3Wrapper* directives, and, I don't know why the #pragma compile doesn't add the Author field to the executable.

      These are the directives:
      #pragma compile(Author, 'Surname Name') ; or #pragma compile(Author, Surname Name)
      and this is the output, in both cases:
       
      - #pragma directive Author found but don't understand it so will ignore: #pragma compile(Author, 'Surname Name') - #pragma directive Author found but don't understand it so will ignore: #pragma compile(Author, Surname Name) What am I missing?
      Thanks

      Francesco
    • Barrtrek
      By Barrtrek
      I get the "Unable to add resources" error related to AppData\Local\AutoIt v3\Aut2Exe when compiling with a large FileInstall of a 1.5GB file.  Is there a size limit I need to be aware of?  I've also disabled or removed Trend from three different machines and had the same results.  I've had issues like this in the past but have compiled after the Aut2Exe folder was excluded in AV.  That doesn't seem to be the problem this time around.  If I comment out the FileInstall the script compiles successfully.
    • toto22
      By toto22
      Please help me to get text from another program using UI
      I need my program to extract symbol and its description from TC2000, basically a "element title". I want it to return "INNT Innovate Biopharmaceuticals, Inc Healthcare Sector(D) Biotechnology" (or any other text if symbol changes)
       
      my wrapper is:
      Mouse position is retrieved 1194-405 At least we have an element title: [INNT Innovate Biopharmaceuticals, Inc Healthcare Sector(D) Biotechnology ] class: [TextBlock] Having the following values for all properties: Title is: <INNT Innovate Biopharmaceuticals, Inc Healthcare Sector(D) Biotechnology > Class := <TextBlock> controltype:= <UIA_TextControlTypeId> ,<50020> , (0000C364) 989;356;406;183 *** Parent Information top down *** 2: Title is: <TC2000 ® Version 17.0.6435.29524> Class := <Window> controltype:= <UIA_WindowControlTypeId> ,<50032> , (0000C370) 51;24;1712;1124 "Title:=TC2000 ® Version 17.0.6435.29524;controltype:=UIA_WindowControlTypeId;class:=Window"" 1: Title is: <> Class := <WorkspaceTabControl> controltype:= <UIA_CustomControlTypeId> ,<50025> , (0000C369) 59;123;1696;1017 "Title:=;controltype:=UIA_CustomControlTypeId;class:=WorkspaceTabControl"" 0: Title is: <> Class := <WebChart> controltype:= <UIA_CustomControlTypeId> ,<50025> , (0000C369) 675;125;1080;612 "Title:=;controltype:=UIA_CustomControlTypeId;class:=WebChart"" ;~ *** Standard code maintainable *** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("oP1","Title:=TC2000 ® Version 17.0.6435.29524;controltype:=UIA_WindowControlTypeId;class:=Window") ;TC2000 ® Version 17.0.6435.29524 _UIA_setVar("oP2","Title:=;controltype:=UIA_CustomControlTypeId;class:=WorkspaceTabControl") ; _UIA_setVar("oP3","Title:=;controltype:=UIA_CustomControlTypeId;class:=WebChart") ; ;~ $oUIElement=_UIA_getObjectByFindAll("INNT InnovateBiopharmaceuticals,Inc HealthcareSector(D) Biotechnology .mainwindow", "title:=INNT Innovate Biopharmaceuticals, Inc Healthcare Sector(D) Biotechnology ;ControlType:=UIA_TextControlTypeId", $treescope_subtree) _UIA_setVar("oUIElement","Title:=INNT Innovate Biopharmaceuticals, Inc Healthcare Sector(D) Biotechnology ;controltype:=UIA_TextControlTypeId;class:=TextBlock") ;ControlType:=UIA_TextControlTypeId;classname:=TextBlock") ;~ Actions split away from logical/technical definition above can come from configfiles ;~_UIA_Action("oP1","highlight") _UIA_Action("oP1","setfocus") ;~_UIA_Action("oP2","highlight") _UIA_Action("oP2","setfocus") ;~_UIA_Action("oP3","highlight") _UIA_Action("oP3","setfocus") ;~_UIA_action($oUIElement","highlight") ;~_UIA_action($oUIElement,"click") ;~_UIA_action("oUIElement","highlight") ;~_UIA_action("oUIElement","click") ;~ *** Standard code Flexible*** #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) Local $oP2=_UIA_getObjectByFindAll($UIA_oDesktop, "Title:=TC2000 ® Version 17.0.6435.29524;controltype:=UIA_WindowControlTypeId;class:=Window", $treescope_children) _UIA_Action($oP2,"setfocus") Local $oP1=_UIA_getObjectByFindAll($oP2, "Title:=;controltype:=UIA_CustomControlTypeId;class:=WorkspaceTabControl", $treescope_children) Local $oP0=_UIA_getObjectByFindAll($oP1, "Title:=;controltype:=UIA_CustomControlTypeId;class:=WebChart", $treescope_children) ;~ First find the object in the parent before you can do something ;~$oUIElement=_UIA_getObjectByFindAll("INNT InnovateBiopharmaceuticals,Inc HealthcareSector(D) Biotechnology .mainwindow", "title:=INNT Innovate Biopharmaceuticals, Inc Healthcare Sector(D) Biotechnology ;ControlType:=UIA_TextControlTypeId", $treescope_subtree) Local $oUIElement=_UIA_getObjectByFindAll($oP0, "title:=INNT Innovate Biopharmaceuticals, Inc Healthcare Sector(D) Biotechnology ;ControlType:=UIA_TextControlTypeId", $treescope_subtree) ;~_UIA_action($oUIElement,"highlight") _UIA_action($oUIElement,"click") *** Detailed properties of the highlighted element *** UIA_title:= <INNT Innovate Biopharmaceuticals, Inc Healthcare Sector(D) Biotechnology > UIA_text:= <INNT Innovate Biopharmaceuticals, Inc Healthcare Sector(D) Biotechnology > UIA_regexptitle:= <INNT Innovate Biopharmaceuticals, Inc Healthcare Sector(D) Biotechnology > UIA_class:= <TextBlock> UIA_regexpclass:= <TextBlock> UIA_iaccessiblechildId:= <0> UIA_id:= <Watermark> UIA_handle:= <0> UIA_RuntimeId:= <7;1244;18409771> UIA_BoundingRectangle:= <989;356;406;183> UIA_ProcessId:= <1244> UIA_ControlType:= <50020> UIA_LocalizedControlType:= <text> UIA_Name:= <INNT Innovate Biopharmaceuticals, Inc Healthcare Sector(D) Biotechnology > UIA_HasKeyboardFocus:= <False> UIA_IsKeyboardFocusable:= <False> UIA_IsEnabled:= <True> UIA_AutomationId:= <Watermark> UIA_ClassName:= <TextBlock> UIA_ClickablePoint:= <1192;447> UIA_Culture:= <0> UIA_IsControlElement:= <True> UIA_IsContentElement:= <True> UIA_IsPassword:= <False> UIA_NativeWindowHandle:= <0> UIA_IsOffscreen:= <False> UIA_Orientation:= <0> UIA_FrameworkId:= <WPF> UIA_IsRequiredForForm:= <False> UIA_IsDockPatternAvailable:= <False> UIA_IsExpandCollapsePatternAvailable:= <False> UIA_IsGridItemPatternAvailable:= <False> UIA_IsGridPatternAvailable:= <False> UIA_IsInvokePatternAvailable:= <False> UIA_IsMultipleViewPatternAvailable:= <False> UIA_IsRangeValuePatternAvailable:= <False> UIA_IsScrollPatternAvailable:= <False> UIA_IsScrollItemPatternAvailable:= <False> UIA_IsSelectionItemPatternAvailable:= <False> UIA_IsSelectionPatternAvailable:= <False> UIA_IsTablePatternAvailable:= <False> UIA_IsTableItemPatternAvailable:= <False> UIA_IsTextPatternAvailable:= <False> UIA_IsTogglePatternAvailable:= <False> UIA_IsTransformPatternAvailable:= <False> UIA_IsValuePatternAvailable:= <False> UIA_IsWindowPatternAvailable:= <False> UIA_ValueIsReadOnly:= <True> UIA_RangeValueValue:= <0> UIA_RangeValueIsReadOnly:= <True> UIA_RangeValueMinimum:= <0> UIA_RangeValueMaximum:= <0> UIA_RangeValueLargeChange:= <0> UIA_RangeValueSmallChange:= <0> UIA_ScrollHorizontalScrollPercent:= <0> UIA_ScrollHorizontalViewSize:= <100> UIA_ScrollVerticalScrollPercent:= <0> UIA_ScrollVerticalViewSize:= <100> UIA_ScrollHorizontallyScrollable:= <False> UIA_ScrollVerticallyScrollable:= <False> UIA_SelectionCanSelectMultiple:= <False> UIA_SelectionIsSelectionRequired:= <False> UIA_GridRowCount:= <0> UIA_GridColumnCount:= <0> UIA_GridItemRow:= <0> UIA_GridItemColumn:= <0> UIA_GridItemRowSpan:= <1> UIA_GridItemColumnSpan:= <1> UIA_DockDockPosition:= <5> UIA_ExpandCollapseExpandCollapseState:= <3> UIA_MultipleViewCurrentView:= <0> UIA_WindowCanMaximize:= <False> UIA_WindowCanMinimize:= <False> UIA_WindowWindowVisualState:= <0> UIA_WindowWindowInteractionState:= <0> UIA_WindowIsModal:= <False> UIA_WindowIsTopmost:= <False> UIA_SelectionItemIsSelected:= <False> UIA_TableRowOrColumnMajor:= <2> UIA_ToggleToggleState:= <2> UIA_TransformCanMove:= <False> UIA_TransformCanResize:= <False> UIA_TransformCanRotate:= <False> UIA_IsLegacyIAccessiblePatternAvailable:= <True> UIA_LegacyIAccessibleChildId:= <0> UIA_LegacyIAccessibleName:= <INNT Innovate Biopharmaceuticals, Inc Healthcare Sector(D) Biotechnology > UIA_LegacyIAccessibleRole:= <41> UIA_LegacyIAccessibleState:= <0> UIA_IsDataValidForForm:= <False> UIA_ProviderDescription:= <[pid:1244,providerId:0x0 Main(parent link):Unidentified Provider (managed:MS.Internal.Automation.ElementProxy, PresentationCore, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35)]> UIA_IsItemContainerPatternAvailable:= <False> UIA_IsVirtualizedItemPatternAvailable:= <False> UIA_IsSynchronizedInputPatternAvailable:= <True>  
×