WinExeName

Returns the name of the executable file which created a specified window.

Syntax:

WinExeName (partial-winname)

Parameters:

(s) partial-winname the initial part of, or an entire, window name.

Returns:

(s) name of the EXE file, or "" on failure.

 

Returns the name of the EXE file which created the first window found whose title matches partial-winname.

Partial-winname is the initial part of a window name, and may be a complete window name. It is case-sensitive. You should specify enough characters so that partial-winname matches only one existing window.

A partial-winname of "" (null string) specifies the window making the current call to the WIL Interpreter. WinExeName("") will return a full path to the program making the current call to the WIL Interpreter.

Notes:

This function works only with top-level (parent) application windows.

This function relies on performance monitoring being enabled.

Windows NT or newer, this function returns module names instead of full program names. The module name is usually the same as the root name of the program, without the extension.

WinExeName will return the string "(16-bit application)" for ANY 16-bit application.

If WinExeName returns "" (null string), it means the function failed. You might be able to get extended error information from the wwwbatch.ini file:

On XP: "C:\Documents and Settings\{username}\Application Data\WinBatch\Settings\wwwbatch.ini"

On Vista and newer: "C:\Users\{username}\AppData\Roaming\WinBatch\Settings\wwwbatch.ini"

 

UAC Notes: attempting to query information about an elevated process may cause the function to error when executed from a restricted user account.

Example:

Run("notepad.exe","")
prog = WinExename("~Notepad")
WinClose("~Notepad")
TimeDelay(5)
Run(prog, "")
See Also:

AppExist, AppWaitClose, Run, WinExist, WinGetActive, WinName, Partial Window Names, IntControl 46