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.
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.