Jump to content

Know when the welcome screen disappears


Recommended Posts

I'm having problems with the windows welcome screen because I put a program in the start menu that has an opening and it is entering before the welcome screen disappears, there is only sound without image because the welcome screen covers the opening screen , I need to know when the welcome screen has completely disappeared to let my program open.

EDITED: I couldn't get window name nor process name that may exist while the welcome screen is visible

 

Edited by Belini
Link to comment
Share on other sites

do you know which commands turn off the welcome screen in autoit?

Edited by Belini
Link to comment
Share on other sites

Manually I already know how to do it but I wanted to do it by commands and it would be for windows 7 and higher.

Link to comment
Share on other sites

You could do a pixelsearch, so if the welcome screen is still active it wont start playing until it's gone.

Your program opens, but before it starts playing anything it checks if it is visible by using PixelGetColor(), looking for itself, loop until the pixel is found, then when the welcome screen disappears your program is visible and you can start playing the video.

 

If your program is fullscreen with no borders, then just look for pixels that are no longer the color of the welcome screen.

Some guy's script + some other guy's script = my script!

Link to comment
Share on other sites

I just put together a test to log the currently active window and handle, and that could be useful. I started from SciTE, locked the computer, unlocked it, and ended back at ScITE:

2023-05-07 16.15.16.786:    Current window: C:\Users\Raven\Documents\AutoIt\IsComputerLocked.au3 - SciTE [20 of 20] - 0x00000000000B1D98
2023-05-07 16.15.19.367:    Current window:  - 0x0000000000000000
2023-05-07 16.15.20.255:    Current window: Windows Default Lock Screen - 0x00000000000300CE
2023-05-07 16.15.22.714:    Current window:  - 0x0000000000000000
2023-05-07 16.15.26.396:    Current window: UnlockingWindow - 0x00000000008E2586
2023-05-07 16.15.26.881:    Current window: C:\Users\Raven\Documents\AutoIt\IsComputerLocked.au3 - SciTE [20 of 20] - 0x00000000000B1D98

Everything besides SciTE there is interesting for your use-case, I think. The empty window handle should only exists (I imagine) when on the lock screen or some other high level Windows screen, then the 'Default Lock Screen' and 'UnlockingWindow' would only exist while the user is signing in.

Here's the test:

Global $hWnd

While 1
    $hWnd = WinGetHandle('[ACTIVE]')
    ConsoleWrite(WinGetTitle($hWnd) & ' - ' & String($hWnd) & @CRLF)
    Sleep(100)
WEnd

I would recommend that you use something like this to test for your use-case and see what results you get. I don't really have a "welcome screen" myself, just the lock screen, and I don't normally restart my computer very often so I'm not going to test that for you, especially since I don't think that my setup would work for what you're looking for.

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

Link to comment
Share on other sites

I enriched the above script  - nice catch  @mistersquirrle

#include <WinAPIProc.au3>
Global $hWnd, $PID

HotKeySet("{END}", "_Sleep")

Sleep(1000)

While 1
    ConsoleWrite("--------------------------------------------------------------------------------" & @CRLF)
    $hWnd = WinGetHandle('[ACTIVE]')
    ConsoleWrite("$hWnd:" & String($hWnd) & @CRLF)
    ConsoleWrite("WinTitle:" & WinGetTitle($hWnd) & @CRLF)
    $PID = WinGetProcess($hWnd)
    ConsoleWrite("PID:" &  $PID & @CRLF)
    ConsoleWrite("PID FileName:" &  _WinAPI_GetProcessFileName($PID) & @CRLF)
    Sleep(1000)
WEnd

Func _Sleep()
    Send("#1")
EndFunc

 

--------------------------------------------------------------------------------
$hWnd:0x00010280
WinTitle:Windows Default Lock Screen
PID:9200
PID FileName:C:\Windows\SystemApps\Microsoft.LockApp_cw5n1h2txyewy\LockApp.exe
--------------------------------------------------------------------------------

 

I know that I know nothing

Link to comment
Share on other sites

Nice, @ioa747. There's another enhancement that could be done, but I didn't include it as when I tested it didn't give me any other results that I saw to be useful. It would be something like this:

#include <WinAPIProc.au3>
Global $hWnd, $PID, $hPrevWnd = -1
Global $aWindows
Global $sMsg = ''
Global $iPidTemp

; I'm not sure what the purpose of this is
;~ HotKeySet("{END}", "_Sleep")

Sleep(1000)

While 1
    Sleep(250)
    $hWnd = WinGetHandle('[ACTIVE]')
    If $hPrevWnd = $hWnd Then ContinueLoop

    $hPrevWnd = $hWnd
    ConsoleWrite("--------------------------------------------------------------------------------" & @CRLF)
    ConsoleWrite("$hWnd:" & String($hWnd) & @CRLF)
    ConsoleWrite("WinTitle:" & WinGetTitle($hWnd) & @CRLF)
    $PID = WinGetProcess($hWnd)
    ConsoleWrite("PID:" & $PID & @CRLF)
    ConsoleWrite("PID FileName:" & _WinAPI_GetProcessFileName($PID) & @CRLF)

    $aWindows = WinList()
    $sMsg = ''
    For $iWindow = 1 To $aWindows[0][0]
        ; If $aWindows[$iWindow][0] = 'Default IME' Then ContinueLoop ; I think that these can be safely skipped
        $iPidTemp = WinGetProcess($aWindows[$iWindow][1])
        If $iPidTemp = $PID And $aWindows[$iWindow][1] <> $hWnd Then
            $sMsg &= @TAB & "$hWnd:" & String($aWindows[$iWindow][1]) & @CRLF
            $sMsg &= @TAB & "WinTitle:" & String($aWindows[$iWindow][0]) & @CRLF
        EndIf
    Next

    If $sMsg <> '' Then
        ConsoleWrite('Additional windows: ' & @CRLF & $sMsg)
    EndIf
WEnd

;~ Func _Sleep()
;~     Send("#1")
;~ EndFunc

It didn't add anything for the blank handles or for "Windows Default Lock Screen", and for "UnlockingWindow" it's related to explorer.exe so it also listed all or most other open windows on the system.

Edited by mistersquirrle

We ought not to misbehave, but we should look as though we could.

Link to comment
Share on other sites

I couldn't define which window is the welcome screen and I ended up making an interface to open in black and my program is in a loop monitoring to see when it is visible, that is, while the welcome screen is on top my program is in a loop and when the black screen I created appears, it exits the loop and continues with its script, thanks to everyone who helped and gave tips as these alternatives may be useful in other cases.

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...