Sign in to follow this  
Followers 0
akorx

Find min and max size of a windows

10 posts in this topic

Hi,

Sometimes a windows has a max size fixed by the developers; a user can resize it with the mousse... Is there a way with autoit to resize (= to restore) this windows at her "normal" size (this "normal" size is the defaut size when we start the program).


AkorxMail akorx@yahoo.fr

Share this post


Link to post
Share on other sites



Have alook at Win... functions e.g. WinMove.


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I know WinMove() but this function resize the program with my choices but not with her original size... I think something like WinSetState($hWnd, "", @SW_SHOWNORMAL) could be a solution but I doesn't work.

Is there another way with a windows function (or another autoit function that I've not seen) ?

Edited by akorx

AkorxMail akorx@yahoo.fr

Share this post


Link to post
Share on other sites

Should I ask autoit's developers to add something like @SW_RESET to do this?


AkorxMail akorx@yahoo.fr

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

no, just capture the values and then use winmove.  

This demo will open notepad, capture the original size with wingetpos, reshape it, then put it back using the array from wingetpos.

opt("WinTitleMatchMode" , 2)

ShellExecute("notepad.exe")

sleep(1000)

$hWindow = WinGetHandle("Notepad")

$aOriginalSize = WinGetPos($hWindow)

winmove($hWindow , "" , 160 , 200 , 340  , 400)

sleep (2000)

winmove($hWindow , "" , $aOriginalSize[0] , $aOriginalSize[1] , $aOriginalSize[2] , $aOriginalSize[3])

sleep (2000)

processclose("notepad.exe")
Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

The problem is that I can't capture the original size because my script doesn't run when the other program starts...


AkorxMail akorx@yahoo.fr

Share this post


Link to post
Share on other sites

Unless defaults are hard coded somewhere readable like a settings file or the registry I think you will have to use magic. 


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

"magic" ? what is it?


AkorxMail akorx@yahoo.fr

Share this post


Link to post
Share on other sites

I'm guessing you've tried the other WinSetState options, like @SW_RESTORE and @SW_MAXIMIZE

They should work if the resizing mechanism is correctly specified, else you are probably out of luck.

Can you make the window bigger than it is supposed to be?

If not, then you could loop through resizing (WinMove) and checking (WinGetPos) until it stops changing size.

You could then store the final value for future use, to avoid the loop method again.


AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

So far I have gathered that you want to start a process that retrieves historical application-specific information that is probably not logged. That requires you to be a wizard.  Unless of course there is anywhere you can go manually to see the default coordinates and size and then we can try and go read that.

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0