Get Window Title - template

I have a procedure, and it has a standard Window defined. I need to create a CODE template that gets the Window title, so in this example, it should return the ‘My title here’ string:
Window WINDOW('My title here')

I suppose the template should

  • first check if the procedure has a standard window
  • and then return the title part.

How can I do this, please? any example?

I can use %ProcedureDescription but it can be different from Title.

Also, tried TARGET{prop:text}, but sometimes returns not exact Title, but all titles for all opened in current thread windows.


UPDATED WITH SOLUTION:

#Declare(%MyMdiWindowTitle)
#Set(%MyMdiWindowTitle,EXTRACT(%WindowStatement,'WINDOW',0))
1 Like

You could also have an APPLICATION i.e. Frame. You probably would not use your code template there, but for completeness something like this:

 #Declare(%MyMdiWindowTitle)
 #IF (EXTRACT(%WindowStatement, 'APPLICATION'))
    #Set(%MyMdiWindowTitle,EXTRACT(%WindowStatement,'APPLICATION',0))
 #ELSE
    #Set(%MyMdiWindowTitle,EXTRACT(%WindowStatement,'WINDOW',0))
 #ENDIF
2 Likes