Check when "Set Default Programs" Window is loaded

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
trexman
Posts: 2
Joined: 25 Sep 2017, 10:48

Check when "Set Default Programs" Window is loaded

25 Sep 2017, 11:16

Hello,

I'm new with Autohotkey, but as far I know it - I love it :)

I created a script to set some Windows 10 program defaults.
For this purpose I start the Set Default Programs under Control Panel\Programs. That is no problem with a "Run, control /name Microsoft.DefaultPrograms /page pageDefaultProgram"
And also the rest what I want to change is easy with {tab} - letters and {space}.

Here is my problems.
The start of the "Set Default Programs" takes sometimes 2-3 seconds but on some PCs I saw the loading bar for more than 30 seconds. So WAIT is not a good option.
The Window is always active so I can't check on this too.

The only thing I could check would be a green pixel in the loading bar or if the list field is displayed.

Any ideas how this can be done? Or other suggestions?
Thanks.

Oh and it must run "unattended" with no user action like - klick on OK, because it is in every users first-run-login script.


Here some screenshot of the windows i mentioned.
https://imgur.com/a/ThvVQ
teadrinker
Posts: 4330
Joined: 29 Mar 2015, 09:41
Contact:

Re: Check when "Set Default Programs" Window is loaded

25 Sep 2017, 19:48

Hello, trexman,

The window "Set Default Programs" has the initially hidden ListView-control, which gets visible after the list gets loaded. You could check in a loop whether ListView became visible.

Code: Select all

Run, control /name Microsoft.DefaultPrograms /page pageDefaultProgram
WinWait, Set Default Programs ahk_exe explorer.exe
ControlGet, hListView, hwnd,, SysListView321

while !DllCall("IsWindowVisible", Ptr, hListView)
   Sleep, 500

MsgBox, Loaded!
Last edited by teadrinker on 26 Sep 2017, 10:17, edited 1 time in total.
trexman
Posts: 2
Joined: 25 Sep 2017, 10:48

Re: Check when "Set Default Programs" Window is loaded

26 Sep 2017, 04:58

Hello teadrinker,

Yes, perfect.
I had to change the WinTitle because of my Windows OS language, but it works!

Thank you!

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: mankvl, OrangeCat, sanmaodo, zerox and 318 guests