Jump to content

WinList() With Variables Possible?


DarkAqua
 Share

Recommended Posts

I was working trying to get a script that would use WinList() to create and display an array of windows with the tile defined by REGEXPTITLE such as Google Chrome.

Example:

#include <Array.au3>

$list = WinList("[REGEXPTITLE:(?i)(.*Google*)]")

_ArrayDisplay($list)

I have with the code above made an array listing all windows with the title google which works great but my question is that, is it possible to use a variable in place of the Google in the above code? I have tried the below codes but am unable to get it to work. The array always comes back empty.

The first two i have tried with a quotation around Google but still revive an empty array.

#include <Array.au3>

$wintitle = Google

$list = WinList("[REGEXPTITLE:(?i)(.*$Wintitle*)]")

_ArrayDisplay($list)
#include <Array.au3>

$wintitle = Google

$list = WinList('"[REGEXPTITLE:(?i)(.*' & $Wintitle & '*)]"')

_ArrayDisplay($list)
#include <Array.au3>

$wintitle = "[REGEXPTITLE:(?i)(.*Google*)]"

$list = WinList($wintitle)

_ArrayDisplay($list)
#include <Array.au3>

$app = Google

$wintitle = '"[REGEXPTITLE:(?i)(.*' & $app & '*)]"'

$list = WinList($wintitle)

_ArrayDisplay($list)
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...