Jump to content

How to minimise windows with variable title?


Recommended Posts

When I launch my charting program, some chart windows are automatically opened up and I would like to close them. The chart windows have different titles according to the name of the stock and being intra day charts, some have 60 mins, 120 mins, etc next to the title. My two methods of solving my problem does not work.

1) This is what I got when I use the script writer.

WinWait("ST ENGG.SG [120 Min]"," Processing data. Pl")

If Not WinActive("ST ENGG.SG [120 Min]"," Processing data. Pl") Then WinActivate("ST ENGG.SG [120 Min]"," Processing data. Pl")

WinWaitActive("ST ENGG.SG [120 Min]"," Processing data. Pl")

But the code below does not work.

Opt("WinTitleMatchMode", 2)

WinWait(""," Processing data. Pl", 8)

If WinActive(""," Processing data. Pl") Then

WinSetState(""," Processing data. Pl", @SW_MINIMIZE)

Endif

2) If I set Winsetontop the program on top of all the charts it opened, the chart windows become invisible even after resetting winsetontop with '0'. Minimising the program cannot reveal the charts.

Here are some more window info:

>>>> Window <<<<

Title:

Class: Shell_TrayWnd

Position: -2, 737

Size: 1028, 33

Style: 0x96840000

ExStyle: 0x00000188

Handle: 0x00030044

Link to comment
Share on other sites

Hello.

Does something like so work?

Opt ("WinTitleMatchMode", 2)
;   1 = Match the title from the start (default)
;   2 = Match any substring in the title
;   3 = Exact title match
;   4 = Advanced mode, see Window Titles & Text (Advanced)

$aList = WinList("ST ENGG.SG")

For $a = 1 to UBound ($aList) - 1
    WinSetState ($aList[$a][1], "", @SW_MINIMIZE)
Next

Cheers,

Brett

Link to comment
Share on other sites

Brett,

"ST ENGG.SG" is the code name of just a stock which means it varies depending on the stock. So instead of

"ST ENGG.SG", it could be "ASL.SG" OR "NOL.SG", etc. But " Processing data. Pl"is the constant. Do you think substituting it will work? " Processing data. Pl" is not the title.

Thanks.

Thomas

Link to comment
Share on other sites

Link to comment
Share on other sites

Thanks, Brett.

I will try it out when I get back to work on Monday.

Thomas

#include <Array.au3>

Opt ("WinTitleMatchMode", 2)

$aList = WinList ("", "Processing data")
_ArrayDisplay ($aList)

Cheers,

Brett

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...