Josh_147
5 years agoContributor
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 get the FullName of the object (window) which is currently focus / topmost on the screen?
Thanks.
-------
Edited:
Basically I want to make this parameter as a dynamic parameter which a function will get the current focus window's FullName and pass into the script. Is there any function able to do this?
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; } }