Jump to content

Need help with WinList, Array and Variables


Recommended Posts

Hi I'm still kind of new here, I'm trying to figure out how to do the following with a script. Does anyone know which code/technique could be used for accomplishing this, because I cannot figure it out. 

1. First check for all open Notepad windows and send text into each one

- this one I can do by using the below and a ControlSend:

#include <Array.au3>


$List = WinList("[CLASS:Notepad]")
For $item = 1 To ($List[0][0])
    $Value = $List[$item][0]

Next

2. However I want to be able to check for any NEW notepad documents that open with a new title and when it detects a new notepad file is open, it will do ControlSend to that one as well. Then continue to send text into each new Notepad file I open, without repeatedly sending the text to any open notepad windows I've already had it send text to

Edited by jgq85
Link to comment
Share on other sites

Thanks. Well I'm trying to use the concept here and apply it to Instant Message windows in another program, so there would be no files. 

But I guess what you're saying is that you'd keep an array of open Windows, and any new windows introduced that aren't part of the existing array, will be dealt with then added into the existing array. right? 

Link to comment
Share on other sites

Yes, however, I would use processlist and track them by PID.

edit: It looks like you can monitor them by windows handle and use winlist if you prefer.

Edited by kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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