How do I get the name of the frontmost window?

Hey Ed,

It takes a while before you think about those darn text-tokens. :smiley:

On another note – your AppleScript is incorrect. The try block without an error-handler is masking the error – there is NO “name” attribute for windows available from System Events.

There is a “name” property.

Try this:

tell application "System Events"
  tell (first process whose frontmost is true) to return name of window 1
end tell

Also try these and note the difference:

tell application "System Events"
  tell (first process whose frontmost is true) to return attributes
end tell
tell application "System Events"
  tell (first process whose frontmost is true) to return properties
end tell

-Chris

2 Likes