Placing your window on top during the WindowsPE stage

Back in March, Richard Smith wrote a post about how to move the Task Sequence window to one side so that you can display a new window in the centre of the screen without it being covered up by the “Always On Top” Task Sequence window.

Richard’s solution works great, however if you try to use it during the WindowsPE stage of any task sequence it exhibits some rather peculiar behaviour.  Basically, when launched in WindowsPE it tends to only work if you give the mouse a ‘waggle’ (yes, that is a technical term), i.e. the AutoIT code is executed but for some reason WindowsPE does not actually move the Task Sequence window until the mouse cursor is moved.

In order to make this work as expected in WindowsPE, you’ll need to bring the required application window to the top of the Z-order rather than move the Task Sequence window out of the way.  The only downside to this is that it might not be immediately obvious to the user that a new window has appeared (particularly if it is quite small) as it will appear on top of the Task Sequence window, whereas Richards method does not have this problem.

 

In order to tweak Richard’s AutoIT code for WindowsPE, you’ll need to amend the following code:

If WinExists("Systems Management Server") Then
    $size = WinGetPos("Systems Management Server")
    Mousemove($size[0]+50, $size[1]+50)
    MouseClick("left")
    WinMove("Systems Management Server", "", 0, 0)
    Exit
Else
    Exit
EndIf

To look like this:

If WinExists("MY WINDOW TITLE") Then
    WinSetOnTop("MY WINDOW TITLE", "", 1) 
    WinActivate("MY WINDOW TITLE") 
    Exit
Else
    Exit
EndIf

So, instead of moving the Task Sequence window aside, it is just looking for the specified window and then bringing it to the front.

 

This post was contributed by Daniel Oxley a consultant with Microsoft Services Spain