Sign in to follow this  
Followers 0
SleepyXtreme

Rename Duplicates in WinList()

9 posts in this topic

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.

Share this post


Link to post
Share on other sites

BUMP, someone please help!

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

The only problem is that WinSetTitle($WindowList[$x + 1][1], "", $NewTitle) only recognizes one window at a time so i have to repeat the renaming command somehow

Share this post


Link to post
Share on other sites

The nested for statment i posted checks each title agianst each other title...really it works :shocked:

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

may stem from the fact that when renaming the window you have to do it based on title (which is ambigius). Maybe try decremitnting the loop counter if it does find an identical window, that way it will run that same loop agian.

Share this post


Link to post
Share on other sites

do you think you can add the code to it cause i'm tired of playingwith it

Share this post


Link to post
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
Sign in to follow this  
Followers 0