arjun Posted June 4, 2008 Share Posted June 4, 2008 Please help me how of doing.. Eg : I open up multiple notepad the default title would be "Untitled - Notepad", instead the first notepad TITLE should be started with 1 then subsequent notepad should be 2, 3 and so on... I tried using while loop and winsettitle. But the program was not efficient. !!!AUTOIT Rocks!!!^^^^^^^^^^^^ Link to comment Share on other sites More sharing options...
smashly Posted June 4, 2008 Share Posted June 4, 2008 Hi, I use a loop and it seems to be pretty quick for me. What's not efficient (Apart from the code I post)Dim $pID[5] For $i = 0 To 4 $pID[$i] = Run("notepad.exe") Sleep(40) Next Dim $WL = WinList("[REGEXPTITLE:(?i)Untitled - Notepad]") For $i = 1 To $WL[0][0] WinSetTitle($WL[$i][1], "", $i & ": Untitled - Notepad") Next MsgBox(0, "Click OK to exit.", $WL[0][0] & " x Notepads opened and numbered. " & @LF & "Click Ok to close the Notepads and Exit") For $i = 0 To 4 ProcessClose($pID[$i]) Next Cheers Link to comment Share on other sites More sharing options...
sandin Posted June 4, 2008 Share Posted June 4, 2008 maybe something like this: Global $CurNo = 0 While 1 $var = WinList() For $i = 1 to $var[0][0] If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then for $j = 1 to $var[0][0] If $var[$j][0] <> "" AND IsVisible($var[$j][1]) Then if $var[$j][0] = $var[$i][0] AND $var[$j][1] <> $var[$i][1] then $CurNo += 1 WinSetTitle($var[$i][0], "", $var[$i][0] & " #" & $CurNo/2+1) TrayTip("Window Name Changed", "Window [" & $var[$i][0] & "] allready exists," & @CRLF _ & "so it will be changed into:" & @CRLF _ & "[" & $var[$i][0] & " #" & $CurNo/2+1 & "]", 10, 1) EndIf EndIf Next EndIf Next Sleep(250) WEnd Func IsVisible($handle) If BitAnd( WinGetState($handle), 2 ) Then Return 1 Else Return 0 EndIf EndFunc though it has a flaw... if you close notepad and open a new one you still get one No. bigger than the last opened notepad, I'll lave you to fix this flaw :) p.s. No. is displayed at the end of the win title, but you can change this to be at the start of win title. Some cool glass and image menu | WinLIRC remote controler | Happy Holidays to all... | Bounce the sun, a game in which you must save the sun from falling by bouncing it back into the sky | Hook Leadtek WinFast TV Card Remote Control Msges | GDI+ sliding toolbar | MIDI Keyboard (early alpha stage, with lots of bugs to fix) | Alt+Tab replacement | CPU Benchmark with pretty GUI | Ini Editor - Edit/Create your ini files with great ease | Window Manager (take total control of your windows) Pretty GUI! | Pop-Up window from a button | Box slider for toolbar | Display sound volume on desktop | Switch hotkeys with mouse scroll Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now