Jump to content

Rename Duplicates in WinList()


Recommended Posts

CODE

$WindowList = WinList()

For $x = 1 to $WindowList[0][0]

$temp=$WindowList[$x][0]

if $WindowList[$x+1][0] = $temp Then

$WindowList[$x+1][0] = $WindowList[$x+1][0] & " " &$x+1

EndIf

Next

I have a feeling I'm doing something wrong cause it doesn't work lol

I want to rename the windows in WinList() that have the same title to be like Internet explorer 1, Internet explorer 2, Internet explorer 3, Internet explorer 4, if there are,for instance, 4 windows with the title Internet explorer.

Link to comment
Share on other sites

All that does is change the COPY of window title in your array, not the title of the actual window.

Maybe:

$WindowList = WinList()
For $x = 1 To $WindowList[0][0]
    $temp = $WindowList[$x][0]
    If $WindowList[$x + 1][0] = $temp Then
        $NewTitle = $WindowList[$x + 1][0] & " " & $x + 1
        $WindowList[$x + 1][0] = $NewTitle
        WinSetTitle($WindowList[$x + 1][1], "", $NewTitle)
    EndIf
Next

:shocked:

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Link to comment
Share on other sites

$list= WinList()
for $x=1 to $list[0][0]
    for $y=2 to $list[0][0]
        if $list[$x][0]= $list[$y][0] and $list[$x][0]<>"" then 
            WinSetTitle($list[$y][0],"",$list[$y][0] & Random(0,10))            
        EndIf
    Next
Next

Logic is probly somthing liek that...you'll probably want to change it to only check visable windows and add a seqentail number rather than a random.

Link to comment
Share on other sites

I tried it but it only changes the name of one window......

CODE

Global $WindowList = WinList()

for $x=1 to $WindowList[0][0]

for $y=2 to $WindowList[0][0]

If $WindowList[$x][0] <> "" AND BitAnd( WinGetState($WindowList[$x][1]), 2 ) AND $WindowList[$x][0] <> "Program Manager"Then

WinSetTitle($WindowList[$y][0],"",$WindowList[$y][0] & Random(0,10))

EndIf

Next

Next

; For $x = 1 to $WindowList[0][0]

; If $WindowList[$x][0] <> "" AND BitAnd( WinGetState($WindowList[$x][1]), 2 ) AND $WindowList[$x][0] <> "Program Manager"Then

; For $y= 1 to $WindowList[0][0]

; If $WindowList[$x][0]=$WindowList[$y][0] Then

; WinSetTitle($WindowList[$y][0], "", $WindowList[$y][0] & " " & Random(0,10))

; EndIf

; Next

; EndIf

; Next

For $x = 1 to $WindowList[0][0]

If $WindowList[$x][0] <> "" AND BitAnd( WinGetState($WindowList[$x][1]), 2 ) AND $WindowList[$x][0] <> "Program Manager"Then

WinSetState($WindowList[$x][0], "", @SW_HIDE)

EndIf

Next

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