Forum Discussion

Oferv's avatar
Oferv
Super Contributor
13 years ago

window cannot be moved since it's maximized error

Hi,



I have this command Aliases["Explorer"]["wndCabinetWClass"]["Position"](300, 200, 600, 400) to resize a window but,if the window is maximize it's unable to reset its position and says "window cannot be moved since it's maximized." how can i make sure that even if the window is maximized the script won't stuck?



thanks

1 Reply

  • spatel_1's avatar
    spatel_1
    Occasional Contributor
    Hi Ofer,



    Here's how I would do it:

    var window = myWindow;

    if(window["IsMaximized"])  //If the window is maximized


        window["Restore"](); //Unmaximize it 


    window["Position"](500, 500, 500, 500); // Set the window's position.

     

    It's possible however that your window won't have the IsMaximized property.  If this is the case, then I would use the Top and Left properties to determine if it's maximized.  These properties are both equal to -8 when the window is maximized (at least they are for me).  



    var window = myWindow;

    if(window["Top"]  == -8 && window["Left"] == -8)  //If the window is maximized


        window["Restore"](); //Unmaximize it 


    window["Position"](500, 500, 500, 500); // Set the window's position.