Jump to content

Window Counter


g3wtter
 Share

Recommended Posts

Hello,

I am new to scripting and only have only  very limited programming knowledge. What I want to do is create a script that will loop through the open windows of a programm and when the window count is <4 the script should open another window.

The following lines work for the title:

opt("WinTitleMatchMode", 2)
$j = 0
$winlist = WinList()
for $i = 0 to $winlist[0][0]
if stringinstr($winlist[$i][0], "abc") then
    $j = $j + 1
endif

I pretty much need something like this but for "CLASS:" as identfier since the title isnt specific enough. 

Link to comment
Share on other sites

Hi and welcome!

I would take a look at the Window Titles and Text (Advanced) section of the help file.

; Checks if a window with these properties exists:
;  - RegExpTitle: the title matches .*abc.* (something abc something)
;  - Class: matches your class
;  - Instance: it's the fourth matching window
WinExists("[REGEXPTITLE:.*abc.*;CLASS:myClass;INSTANCE:4]")

All my code provided is Public Domain... but it may not work. ;) Use it, change it, break it, whatever you want.

Spoiler

My Humble Contributions:
Personal Function Documentation - A personal HelpFile for your functions
Acro.au3 UDF - Automating Acrobat Pro
ToDo Finder - Find #ToDo: lines in your scripts
UI-SimpleWrappers UDF - Use UI Automation more Simply-er
KeePass UDF - Automate KeePass, a password manager
InputBoxes - Simple Input boxes for various variable types

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