Jump to content
Sign in to follow this  
AutoitMike

WinSetTitle not working Win7

Recommended Posts

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.

 

 

 

 

Share this post


Link to post
Share on other sites

Works for me, what program are you trying to rename?

del.PNG

del.PNG

Edited by rcmaehl

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites
10 minutes ago, AutoitMike said:

Its a propitiatory inspection reporting program called HomeGauge.

You can download a trial version.

 

Work PC won't let me install it, I'll take a look at it tonight and see what's up.


My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Share this post


Link to post
Share on other sites

rcmaehl,

I think it might be futile to change the title bar text.

The title bar gets reset every time a new section is selected. I am going to have to get the authors of the program to put the value I need in the title bar.

Otherwise, I would have to have a program running in the background monitoring multiple instances of this program keeping the respective title bars updated.

What i am looking to do is to put the report number as an addition to the existing text or to replace what is in the title bar so that 2 or more reports for the same client produce unique window titles.

 

 

Share this post


Link to post
Share on other sites

Seems, this is a behaviour from the app you want to automate, which also uses a feature to change titlebar text. Use a adlib func with short time (maybe 50 ms) to set the text you need.

But title changing don't change the Hwnd returned from WinActivate. So i suggest read about:

  • Window Titles and Text (Basic)

  • Window Titles and Text (Advanced)

in helpfile. The Hwnd can be used for (all?) most Win* functions for example WinWaitActive. And each from your instances have his own Hwnd.

Edited by AutoBert

Share this post


Link to post
Share on other sites

Interesting function, Adlib. However, I just got a brainstorm.

Once ANY window is created in windows, under no circumstance, the window handle is duplicated, right ?

Once an instance of the application is opened, I can grab its handle, store it in my automation app. and use it to select the correct window when needed?

 

 

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  

  • Similar Content

    • By lonardd
      Hi,
      I have a very strange problem concerning MouseClick function.
      I need to start Control Panel, navigate it on the Display Section (Adjust screen resolution link), click on it, and from the next Dialog choose Intel Graphic tool tab and navigate into it when it opens. 
      I wasn't using MouseClick() at first when I tried to use Control IDs, but I was fed up with the Autoit Window Info poor and inaccurate info (It flickers and the moment I click on the control the control ID and class disappear) so I ended up choosing the easiest way.
      The code I'm posting worked OK until two weeks ago, the mouse clicks were accurately performed and the Script reached the end with no errors...and I was happy.
      All of a sudden, between one try and the other, I noticed the cursor not flying exactly where it was supposed to, namely to the Control Panel ->Display->Adjust screen resolution link   but it clicked some 30 pixels below and some 30 pixels to the left, choosing obviously and undesired function and from that point it screwed the whole thing up. And from that moment onward, it seems I can no longer regain the mouse to click on that sequence.
      Could it be because my Control Panel ->Display form moved slightly from one test to another and therefore I got that small offside?
      If you believe this is the reason, I should then re position the Control Panel ->Display window to 0,0 and recalculate all the clicks. 
      do you have a suggestion?
       
      Thanks a lot
      Dave
       
       
       
      RotateDisplays.au3
    • By lonardd
      I need to open an INTEL Graphic Tool clicking on a Win7 Tray Icon. This icon is not shown on the Win7 Tray but it is shown once you click on a button that shows a little  arrow-up. This button opens up an extension of the tray and there is my INTEL Graphic Tool Icon. 
      The first ControlClick('[Class:Shell_TrayWnd]', '', 1502 ) at line 26 of my source code (Rotatedisplays.au3) works fine as it clicks on the up-arrow shown on the uparrowfirst Menu.jpg  picture and opens up an extension of the tray. Then I'm trying to click on the INTEL Graphic Tool Icon which is the first blue icon (up-left) of the tray extension but I failed all my attempts. Can somebody help me out?
      Thanks 
      Dave


      RotateDisplays.au3
    • By JohnNash
      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 ? 
    • By imitto
      Hello all!
      I was in read-only until today, started to use Autoit 3 weeks ago. It can really make things easy, I really love it
      I have some script now that works and make our job effective, but I have problems with the latest. It works if I open the script's folder and run the exe directly. If I use the shortcut that I created on the desktop, it's not working properly. Activates the window, but not opening/exporting my files, just opens the last msgbox. I use ftp becouse the PC and the destination PC is not on the same network.
      Here's the script:
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Icon=..\microsoft_excel.ico #AutoIt3Wrapper_Res_Comment=send file over ftp #AutoIt3Wrapper_Res_Description=send file over ftp for process #AutoIt3Wrapper_Res_Language=1038 #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.14.2 Author: imitto Script Function: Rename and put playlist file on ftp #ce ---------------------------------------------------------------------------- #RequireAdmin #include <File.au3> #include <FileConstants.au3> #include <AutoItConstants.au3> #include <MsgBoxConstants.au3> #include <FTPEx.au3> ; Script Start Global $playlistname=@YEAR&@MON&@MDAY&"-playlist.pll" BlockInput($BI_DISABLE) Opt ("WinTitleMatchMode", 2) WinActivate("MAIN SCHED") WinWaitActive("MAIN SCHED") ;Opt ("WinTitleMatchMode", 1) Send("!fo") WinWaitActive("Open") Send("Z:\playlist\"&$playlistname&"{ENTER}") Sleep(2000) Send("!fe") WinWaitActive("MCon") Send("{ENTER}") WinWaitActive("Save") Send("C:\sendFileForXLS\lista.txt{ENTER}") Sleep(500) Send("!fc") BlockInput($BI_ENABLE) Sleep(50) Opt ("WinTitleMatchMode", 1) Local $hOpen = _FTP_Open('MyFTP Control') $ftp=_FTP_Connect($hOpen, "**********", "******", "******") If @error Then MsgBox($MB_SYSTEMMODAL, '_FTP_Connect', 'ERROR=' & @error) Else _FTP_FilePut($ftp, @ScriptDir&"\lista.txt", "/lista.txt") EndIf Local $iFtpc = _FTP_Close($hOpen) FileDelete(@ScriptDir&"\lista.txt") MsgBox(0, "", "Playlist exported", 2) Exit  
    • By meows
      no web server atm. so the win7 file properties images I can't show you but they are totally different from the variables I am getting..But then I am just guesstamating the code needed from any and all sources i can find to just get the Minutes difference between 2 files.
      I can touch the files to change anything, but can't get the value to use it and using FilesetTime/ only works with the Help code. and it is way over my head. I have searched the web looking for a step by step but it's all in arrays that array me.
      The FileSetTime
      ;Modified help file #include <FileConstants.au3> #include <MsgBoxConstants.au3> $sFilePath=("C:\file1.txt") Local $iFileSetTime = FileSetTime($sFilePath, "20031101121101"  )     ; Display the modified timestamp of the file and return as a string in the format YYYYMMDDHHMMSS.     If $iFileSetTime Then        ; MsgBox($MB_SYSTEMMODAL, "", "Timestamp:" & @CRLF & FileGetTime($sFilePath, $FT_ACCESSED, 2  ))  RETURNS Timestamp:     ;   MsgBox($MB_SYSTEMMODAL, "", "Timestamp:" & @CRLF & FileGetTime($sFilePath, 2  ))                  RETURNS Timestamp:       ; MsgBox($MB_SYSTEMMODAL, "", "Timestamp:" & @CRLF & FileGetTime($sFilePath, "YYYYMMDDHHMMSS"  ))  RETURNS Timestamp:       ; MsgBox($MB_SYSTEMMODAL, "", "Timestamp:" & @CRLF & FileGetTime($sFilePath, $FT_MODIFIED, 1))       RETURNS Timestamp:       The only one that returns Anything is the last one and it returns the whole string..Timestamp:20031101121101  ; RETURNS  Timestamp:20031101121101      File Properties accessed time and date ?Saturday, ?November ?01, ?2003, ??1:01:00 AM File EndIf changed created date but displays YYYYMMDDHHMMSS"
      So I got creative and after /////..... and more of that got this to work.. "Kinda"
      #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=TimeCK.exe #AutoIt3Wrapper_Res_Fileversion=21 #AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator #AutoIt3Wrapper_Add_Constants=n #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include<File.au3> #include <FileConstants.au3> #include <Constants.au3> #include <MsgBoxConstants.au3> #Include <Date.au3> ;change file.au3's "modified" timestamp to 1st Nov 2003 and current time ;Local $var = FileSetTime("file.au3", "20031101") ;Local $iFileSetTime = FileSetTime($sFilePath, "20031101", $FT_MODIFIED) ;Local $iFileSetTime = FileSetTime("c:\2a.jpg", "20031101", 1) ;change file.au3's "modified" timestamp to 1st Nov 2003 and current time ;Local $v = FileSetTime(@ScriptDir &"\00\2a.jpg", "20031101", 1) Local $v = FileSetTime(@ScriptDir &"\00\2a.jpg", "2003110120031101121101", 1) If Not @error Then    ; Local $HHMMSS =  $v[0] & "/" &  $v[1] & "/" &  $v[2]      Local $MMss =  ($v )     MsgBox(0, "Creation date of 2a", $MMss) EndIf Local $t = FileGetTime(@ScriptDir & "\00\Files\core\2a.jpg", 1) ;HH:MM:SS If Not @error Then ;      Local $hhmms = $t[0] & "/" & $t[1] & "/" & $t[2]     Local $mm = $t[1]     MsgBox(0, "time change", $mm) ;Local $t = FileGetTime("c:\2a.jpg", 1) ;HH:MM:SS ;If Not @error Then ;      Local $hhmms = $t[0] & "/" & $t[1] & "/" & $t[2]  ;   Local $mm = $t[2]   ;  MsgBox(0, "Creation date of notepad.exe", $mm) EndIf The issue is it gives 3 totally different times for the Minute.. I only want the minute difference.
      the "Creation date of 2a" tag gives a 0 minute value==and in 3 hours now it still gives the 0 minute value
      the "time change" tag gives a 28 minute value ==== and in 3 hours now it still gives the 28 minute value
      Win7 "File Properties" tag gives
      ?Sunday, ?June ?22, ?2014, ??1:11:42 PM   ------------FileSetTime(@ScriptDir &"002a.jpg", "2003110120031101121101", 1)
      Saturday, ?June ?28, ?2014, ??3:05:36 PM
      Sunday, ?June ?22, ?2014, ??1:11:42 PM



      Saturday, ?November ?01, ?2003, ??7:03:11 PM --------------------FileGetTime(@ScriptDir & "00Filescore2a.jpg", 1)
      Saturday, ?June ?28, ?2014, ??3:05:36 PM
      ?Today, ?June ?30, ?2014, ??5 minutes ago   
       
      U know I think I learned more in the two hours it took to write this very bad dissertation of the issue. Researching everything I wanted to say and try to explain the steps took to get the results.
×
×
  • Create New...