Forum Discussion

Josh_147's avatar
Josh_147
Contributor
5 years ago

How to get the FullName of current focus/VisibleOnScreen window?

Hi all,   In VBScript, we used to hard-coded the parameter like this: Set sDlg = Sys.Process("notepad").Window("Notepad", "New Text Document.txt - Notepad", 1)   Instead of hard-coded it, can we...
  • AlexKaras's avatar
    AlexKaras
    5 years ago

    Hi,

     

    Something like this (untested pseudocode):

      arWindows = <process>.FindAllChildren("WndClass", "*", 1).toArray(); // top-level children
    
      var strFullName = '';
      if (arWindows.length > 0)
      {
        for (var i = 0; i < arWindows.length; i++)
          if (arWindows[i].Focused)
          {
            strFullName = arWindows[i].FullName;
            break;
          }
      }