Jump to content

WinMove Does Not Work


Go to solution Solved by SaintBernard,

Recommended Posts

Posted

If WinExists("Word") Then
           Sleep (3000)
           MsgBox(0,"Word","Does Exist")
           Sleep (3000)
           WinActivate ("Word")
           Sleep (3000)
          WinMove("Word", 5, 5, 800, 560, 90)
Else
          Sleep (3000)
          MsgBox(0,"Word","Does Not Exist")
EndIf

 

Can anyone please tell me why the 'WinMove' statement in the code above does not work? The message box displaying 'Does Exist' does appear. I am running Windows 7 Professional 64.

Thank You!

  • Solution
Posted

I figured it out!

Here is my script:

;
; Resize Word
;
;    Resets 'Microsoft Word' to its Default Size
;
#include <MsgBoxConstants.au3>

AutoItSetOption ("MustDeclareVars",1)
AutoItSetOption ("WinTitleMatchMode",2)

Global Const $sz_Window_Name = "Microsoft Word"
Global Const $n_X_Coord = 0, $n_Y_Coord = 1, $nWidth = 800, $nHeight = 560

Global $n_Window_X_Y_Width_Height [4]

If WinExists ($sz_Window_Name) Then
      Sleep (1000)
      $n_Window_X_Y_Width_Height  = WinGetPos ($sz_Window_Name)
      Sleep (1000)

      WinMove ($sz_Window_Name,"",$n_Window_X_Y_Width_Height [$n_X_Coord],$n_Window_X_Y_Width_Height [$n_Y_Coord],$nWidth,$nHeight)
Else
      Sleep (1000)

      MsgBox ($MB_ICONERROR + $MB_OK,"Resize Word","Error: Unable to Locate an Instance of 'Microsoft Word' on the Desktop.")
EndIf

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...