Jump to content

Problems with WinMove in WindowsPE


Recommended Posts

Hi all, I'm new to AutoIT and I believe that I'm doing something pretty basic... but it's not working as I think it should.

I'm using AutoIT during an SCCM 2007 OS deployment. The deployment commences in a WinPE environment and during this stage I popup a HTA dialog to retrieve some user input. If anyone is familiar with SCCM OSD you'll know that MS places their own progress dialog in the center of the screen and have forced it to always be on top. This of course resulted in my HTA dialog being covered by the MS dialog.

So I created a quick AutoIt script to simply move the MS dialog off of the screen, wait for the closure of the HTA dialog and then move the MS dialog back. It almost works.... Here is my code....

;Declare variables
Dim $HTATitle
Dim $OSDTitle
Dim $OSDPosition
Dim $RetVal

;Get window titles and position
$OSDTitle = WinGetTitle("Installation","")
$HTATitle = WinGetTitle("OSD", "")
$OSDPosition = WinGetPos($OSDTitle)

;Set focus to OSD progress window and move
WinActivate($OSDTitle)
Sleep(500)
WinMove($OSDTitle,"",10000,10000)
Sleep(500)

; Pause script execution until 'HTA' window closes
WinWaitClose($HTATitle)
Sleep(500)

;Set focus to OSD progress window and move
WinActivate($OSDTitle)
Sleep(500)
WinMove($OSDTitle,"",$OSDPosition[0],$OSDPosition[1])   

Exit(0)

The script actually works, the issue is that once the HTA dialog is closed, the script doesn't automatically move the MS dialog back. However if I click the left mouse button on the WinPE background, the script comes to life and the MS dialog is moved back immediately. It's like it falls asleep after the WinWaitClose function and it need to be stimulated before it continues. Does anyone have any ideas.

If I place 'MsgBox' functions throughout the code (with timeouts), it works with no intervention. I tried placing a 'ControlClick' in the code, but it made no difference.

Thanks in advance.

David M.

Link to comment
Share on other sites

  • 1 year later...

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