No announcement yet.

Get Current Active Window Title ?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Get Current Active Window Title ?

    Hi guys,

    I'm attempting to get the title of the currently active window.
    Not necessarily the AMS project window.

    The same title string if you were to alt-tab to a single instance of
    an application.

    Please correct me if wrong on following, I would love that !
    Unless I'm overlooking something we have at our disposal:

    - Window.SetText (not GetText), this doesn't help
    - Winapi.GetActiveWindow (which returns windows handle, not title)
    - Window.EnumerateTitles(); which is a lot of messing around to target the active window title
    as there could be many child processes for that application. (I maybe missing something here ?)

    I've looked at other script languages which appear to handle GetActiveWindow
    and return the active window title.

    For example.

    currentwin = WinGetactive( )
    Message("WinGetActive", "Current window is %currentwin%.")

    However, like all of us, its much nicer to keep the project all native AMS/Lua code.

    I thought I would find Window.GetText in our standard actions in a second.
    I believe the solution would help everybody. If I have overlooked something,
    apologies, and thanks for reading.

  • #2
    Maybe I just found it...


    It would appear I cant see "the tree" from the forest !

    Heres hoping......


    • #3
      Hi Automan ,
      try this example : GetForegroundWindow.apz


      • #4
        Top of the Morning to you charliechaps !

        That's a great example of doing exactly what I'm doing, in a much more direct, simplified and elegant approach.
        Thank you ! I would like to also acknowledge the very pleasant guitar loop whilst perusing your example.
        Would that be your work ? I'm a guitarist of 40 years and thats some relaxing slick tones there
        Thank you kind sir !