Search the Community
Showing results for tags 'winsettitle'.
-
I have a function that opens Notepad and sets its window title. However, the title reverts to whatever its default was when the Notepad window gets focus. To reproduce, run my script and do not move the cursor or type anything. Note that the Notepad window has a title of "abc 123". Now, move the mouse over the Notepad window. The title reverts to the default "Untitled - Notepad". Note: This behavior is also produced when running the F1 Help example script WinSetTitle.au3. Just move the mouse during the 2 second delay. My test script: Global $_Hwnd = 0 _OpenNotepad("abc 123") Func _OpenNotepad($sTitle) Local $pNotepad , $ret = 0 If $_Hwnd = 0 And WinExists($sTitle) Then $_Hwnd = WinGetHandle($sTitle) If IsHWnd($_Hwnd) Then ; Another session already started, so use it If WinExists($_Hwnd) Then $ret = 2 ; The session is still active EndIf EndIf If ($ret = 0) Then Local $exe, $class ; Start Notepad and save its window handle $exe = "Notepad" $class = "[CLASS:Notepad]" $pNotepad = Run($exe) WinWait($class) $_Hwnd = WinGetHandle($class) If $pNotepad = WinGetProcess($_Hwnd) Then Local $rrr1, $rrr2 $rrr1 = WinActivate($_Hwnd) $rrr2 = WinSetTitle($_Hwnd, "", String($sTitle)) ConsoleWrite("+++: $rrr1 = " & $rrr1 & ", $rrr2 = " & $rrr2 & @CRLF) Else $ret = 3 EndIf EndIf Return SetError($ret, 0, 0) EndFunc ;=>_OpenNotepad
-
I am using WinSetTitle to add a word to titles of windows. For some software it works for some it doesn't. Is there anything I can do or consider to make it work ?
-
I saw a post dated 2013 about WinSetTitle not working in Win7 64bit. No answer there for me. I am trying to set the title of a window, the function returns success and the title is changed for about 50 ms and then reverts back to its original value. #RequireAdmin makes no difference in operation. I have tried using the handle, the title and the class to define the window. Operation is the same for all three ways. EG: WinSetTitle("Old Title", "", "New Title") WinSetTitle("[Class:Class name]","","New Title") WinSetTitle(handle,"","New Title") ;======================================================================================= All functions report success. WinActivate("PxxCXpbHG", "Text") WinSetTitle("PxxCXpbHG ", "Text","New title") $M1=WinGetTitle("[ACTIVE]","") sleep (100) $M2=WinGetTitle("[ACTIVE]","") MsgBox(0,"", $M1 & " " & $M2) ;------------------> "New Title" "PxxCXpbHG" If I change Sleep to 50 , then it is "New Title", "New Title" so somewhere between 50 and 100 ms it gets changed back,but by what?? Thanks for any help in this matter.