Jump to content

[Solved] WinSetState Question


IanN1990
 Share

Recommended Posts

Heya, Small question :D

I have some windows i would like to minimize, but the first instance of the name changes. Instead of writing out every instance, is there a way i could make it check if it contains just part of it ?

while 1

    sleep(250)

WinSetState("Randomstarta - Example","",@SW_MINIMIZE)

WinSetState("Randomstartb - Example","",@SW_MINIMIZE)

WinSetState("Randomstartc - Example","",@SW_MINIMIZE)

WEnd

is there any way it could be written so if it contained " - Example" it would minimize it ?

Edited by IanN1990
Link to comment
Share on other sites

Look in the help, Using AutoIt >> Windows Titles and Text (Advanced)

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Link to comment
Share on other sites

Hello IanN1990,

If you know the exact name of the instance at startup, you could use WinGetHandle() which should never change, and use the handle for the rest of your functions. However if a new window is created rather than just the name being changed, then the handle will most definitely change as well.

Another Option is to use the option 'WinTitleMatchMode' and set it to match any substring since it appears 'Example' stays the same.

Example:

Opt('WinTitleMatchMode', 2 )

WinSetState('Example','',@SW_MINIMIZE)

My Contributions: Unix Timestamp: Calculate Unix time, or seconds since Epoch, accounting for your local timezone and daylight savings time. RegEdit Jumper: A Small & Simple interface based on Yashied's Reg Jumper Function, for searching Hives in your registry. 

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