vatobeto Posted August 8, 2008 Share Posted August 8, 2008 Working on an installer. There are times I need to remove my copy of Office, then reinstall later. Anyway, the following code works when is in a HDD folder, but once it's burned to a DVD and run from there, the Setup Window can't be detected until I manually use the physical mouse to click in it, then the script continues. Why would that be? #RequireAdmin Dim $DBPos[1] $title1 = "[CLASS:TForm1;TITLE:Microsoft 2007]" $ctrl1 = "TEdit1" $title2 = "[CLASS:SetupExe;TITLE:2007 Microsoft Office system]" $ctrl2 = "NetUIHWND_CatalystFlexUI1" $title3 = "[CLASS:SetupExe;TITLE:Microsoft Office Enterprise 2007]" $ctrl3 = "RichEdit20W1" $text1 = "NUIDocumentWindow" ;Start Setup Run("Setup.exe") Sleep(6000) If WinExists($title2,"") Then ;Window not recognized here MsgBox(16,"Debug","Here") WinActivate($title2,"") EndIf $DBPos = WinGetPos($title2,"") If @error == 1 Then MsgBox(16,"Error","Error3") $XClick = $DBPos[0] + 50 $YClick = $DBPos[1] + 50 MouseClick("left",$XClick,$YClick) ControlFocus($title2,"",$ctrl2) SLeep(1000) Send("{DOWN}") Send("{ENTER}") WinWaitActive($title3,$text1) ControlFocus($title3,$text1,$ctrl3) ControlSend($title3,$text1,$ctrl3,$key) Send("{ENTER}") WinWaitActive($title3,$text1) Send("{ENTER}") WinWaitClose($title3,$text1) WinWaitActive($title3,$text1) Send("{TAB}") Send("{ENTER}") The Setup Window image is attached The Info is : >>>> Window <<<< Title: 2007 Microsoft Office system Class: SetupExe Position: 202, 108 Size: 619, 522 Style: 0x14C80000 ExStyle: 0x00000100 Handle: 0x00070DD2 >>>> Control <<<< Class: NetUIHWND_CatalystFlexUI Instance: 1 ClassnameNN: NetUIHWND_CatalystFlexUI1 ID: Text: Position: 0, 0 Size: 613, 496 ControlClick Coords: 201, 259 Style: 0x56000000 ExStyle: 0x00000000 Handle: 0x000D0CBC >>>> Mouse <<<< Position: 406, 390 Cursor ID: 2 Color: 0xFFFFFF >>>> StatusBar <<<< >>>> Visible Text <<<< NUIDocumentWindow Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now