Jump to content

How To Maximize A Child Window


 Share

Recommended Posts

Greets you elite AutoIt Masters of the Universe. I've been scripting every application I touch just for fun, hehe. Ever heard of Magic Packet? It's AMD freeware and it uses Wake on LAN technology. I used an IP scanner to get a plain text file with 3 columns, IP Address, Computer Name, and MAC address. You can open that plain text file in Magic Packet and then you can send a WOL packet to a specific IP address and wake that machine up remotely. Very useful for you PC Support types like me. Anway, the Magic Packet app is pretty simplistic, no command line features. I wrote a dinky script to run the program, open the file with everything in it, all using ControlSetText, ControlSend, blah blah, very nice. Anyway, I've got the file open and now I want to maximize the child window. As a workaround I just have Send( "!{space}{right}x" ) and that opens the control menu for the main app, then right arrow moves to the child window, and "x" tells it to maximize. SO! Is there a better way to tell this window to be maximized? I used WinSetState but it only seems to affect the parent window. TIA, and I recommend this program to everybody who would benefit from being able to remotely turn on PCs, it works great.

Link to comment
Share on other sites

I normally just maximise the window with the window commands. I start it up like this.

Opt("WinDetectHiddenText", 0)  ;0=don't detect, 1=do detect
Opt("WinSearchChildren", 1)    ;0=no, 1=search children also
Opt("WinTitleMatchMode", 1)    ;1=start, 2=subStr, 3=exact, 4=...
winsetstate("CashSales","",@SW_MAXIMIZE); this was using excel

If your child windows are created with the standard windows rules all you need if the child window option, and wella!

AutoIt3, the MACGYVER Pocket Knife for computers.

Link to comment
Share on other sites

Thanks for the suggestion, Valik, but that didn't work. The window spy doesn't differentiate a title whether you click on the parent or child window. The only thing that changes in the spy when you open the file is the parent window title gets a " - biglist.mp" tacked on to the end. Has anyone else run into this or figured this out?

Link to comment
Share on other sites

Then it would probably be necessary to find a program similar to Spy++ to have a look at the z-order and to try to find this "child" window and how it is related to the parent. It could have a different classname or some other unique characteristic about it.

Also, if the child and parent have the same title, with the parent having something appended to the end, try using the exact title match mode (3, I think).

Edit: I don't know where to get a Spy++-esque program on the web, I use Spy++ which came with Visual Studio.

Edited by Valik
Link to comment
Share on other sites

  • Developers

Thanks for the suggestion, Valik, but that didn't work.  The window spy doesn't differentiate a title whether you click on the parent or child window.  The only thing that changes in the spy when you open the file is the parent window title gets a " - biglist.mp" tacked on to the end.  Has anyone else run into this or figured this out?

Batch, are you sure you have set the opt as Scriptkitty suggested:

opt("WinTitleMatchMode", 1)

The main program window title is "Magic Packet Utility - [biglist.mp]" and the child window's title is "biglist.mp" .. so this should work:

Opt("WinDetectHiddenText", 0);0=don't detect, 1=do detect
Opt("WinSearchChildren", 1)  ;0=no, 1=search children also
Opt("WinTitleMatchMode", 1)  ;1=start, 2=subStr, 3=exact, 4=...
WinSetState("biglist.mp","",@SW_MAXIMIZE)
Edited by JdeB

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Thanks again both of you for your responses. The spy didn't show the child window title, didn't see "Book1" when I tried Excel either, but my problem was a timing issue it seems. I wasn't waiting for the child window before telling it to be maximized. The child window title was the name of the file that I opened. I just put a WinWait( "biglist.mp" ) and then a WinSetState( "biglist.mp", "", @SW_MAXIMIZE ) and it worked like a champ. Ya'll are the bomb.

Link to comment
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
 Share

  • Recently Browsing   0 members

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