Jump to content

Recommended Posts

Posted (edited)

Hey there, i have the code from simplespy but have no idea about what to use, got the UIA_V0_64 files.

  Reveal hidden contents

I look at the examples but i get lost, i ask for guideance in this matter.

Best regards.

screenshot - 08122017-1624.jpg

 

To get to this window simply run:

control.exe /name Microsoft.DefaultPrograms /page pageFileAssoc

select a filetype and click "change program"

Edited by careca
  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted (edited)

There is a registry setting you can add to set the default application for an extension type...that would be much easier.

 

https://social.technet.microsoft.com/Forums/ie/en-US/06d35f90-56cb-4dec-b326-bd471d06acee/change-default-program-for-file-command-line-or-registry?forum=w7itprogeneral

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Posted

Oh been there, done that, but win 10 is so much trickier.. im done with trying registry.

  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

Posted (edited)

 

Figured it out, just dont know why it takes so long, like 10 secs or so per action. Any way to speed up?

#include "UIAWrappers.au3"
AutoItSetOption("MustDeclareVars", 1)
Local $sText1, $Vis
ShellExecute(@WindowsDir & '\system32\control.exe', '/name Microsoft.DefaultPrograms /page pageFileAssoc')
            WinWaitActive("Set Associations", 'Set Associations', 10)
            Local $hWnd = WinGetHandle("[CLASS:CabinetWClass]", "Set Associations")
            If $hWnd <> 0 Or @error <> 0 Then
                Do
                    $Vis = ControlCommand($hWnd, "", "[CLASS:Button; INSTANCE:1]", 'IsVisible')
                Until $Vis = 1
                Sleep(100)
                Local $iCount = ControlListView($hWnd, "", "SysListView321", "GetItemCount")
                For $k = 0 To $iCount - 1
                    $sText1 = ControlListView($hWnd, "", "SysListView321", "GetText", $k, 0)
                    If $sText1 = '.mp3' Then
                        ControlListView($hWnd, "", "SysListView321", "Select", $k, $k)
                        ConsoleWrite('=============================================================================' & @CRLF)
                        ConsoleWrite('Line - ' & $k & ' - ' & $sText1 & @CRLF)
                        ConsoleWrite('=============================================================================' & @CRLF)
                        ControlClick($hWnd, "", "[CLASS:Button; INSTANCE:1]")
                        Elem()
                        ExitLoop
                    EndIf
                Next
            EndIf
Func Elem()
_UIA_setVar("oUIElement","Title:=Line down;controltype:=UIA_ButtonControlTypeId;class:=TouchRepeatButton")
_UIA_action("oUIElement","click")
MouseWheel ( "down", 100)
_UIA_setVar("oUIElement","Title:=More apps;controltype:=UIA_HyperlinkControlTypeId;class:=TouchHyperLink")
_UIA_action("oUIElement","click")
_UIA_setVar("oUIElement","Title:=Line down;controltype:=UIA_ButtonControlTypeId;class:=TouchRepeatButton")
_UIA_action("oUIElement","click")
MouseWheel ( "down", 100)
_UIA_setVar("oUIElement","Title:=Look for another app on this PC;controltype:=UIA_HyperlinkControlTypeId;class:=TouchHyperLink")
_UIA_action("oUIElement","click")
EndFunc

 

UIAWrappers.au3

Edited by careca
  Reveal hidden contents

IUIAutomation - Topic with framework and examples

Au3Record.exe

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
×
×
  • Create New...