Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

ruhi

macrumors member
Original poster
Jun 17, 2009
70
0
hello, i want to get the title of the active application's window...Please help me how can i get that?? :confused:

Thanks in advance.
 
You didn't say what you were using or what the purpose is. It sounds like you might want AppleScript (if the mystery window is not your app)?
 
active window title

i don't find any help in managing titles as i dont know which is the active application.

i can find the active application name with some other information my [[NSWorkspace sharedworkspace] activeapplication]; but i am not able to get the title of this active application's window.
 
active window title

i am not looking for my application if its active, i want it if any other application other than my own application is active i want its window title.

Please help me!
 
Here's an AppleScript I found that will do the job:

Code:
tell application "System Events"
	set frontApp to name of first application process whose frontmost is true
end tell
tell application frontApp
	if the (count of windows) is not 0 then
		set window_name to name of front window
	end if
end tell

You can call AppleScript from Cocoa using NSAppleScript, or you can do an NSTask and call it from the command-line using the osascript command. See this article for details. There might be a way to do it directly from Cocoa but I'm guessing AppleScript is going to be your best bet here.
 
Active window title

I am facing few problems with this apple script now.

Like when i open firefox, it shows a window "Where is Firefox-bin?"

why is this coming??
I think i need to do this by cocoa.

Please suugest me some way.
Thanks,
Ruhi.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.