Platforms to show: All Mac Windows Linux Cross-Platform

/MacOSX/Accessibility services/Current Window Title


Required plugins for this example: MBS MacCF Plugin, MBS Main Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /MacOSX/Accessibility services/Current Window Title

This example is the version from Thu, 6th Feb 2013.

Project "Current Window Title.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Löschen"
Const kFileQuit = "Beenden"
Const kFileQuitShortcut = ""
End Class
Class Window1 Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
End Control
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() List.InsertRow 0,CurrentWindowTitle End EventHandler
End Control
Function CurrentWindowTitle() As string dim SystemWideElement,FocusedApplicationElement,FocusedWindowElement as AXUIElementMBS dim FocusedApplication,FocusedWindow,Title as AXValueMBS dim s as String dim cs as CFStringMBS SystemWideElement=AccessibilityMBS.SystemWideAXUIElement if SystemWideElement<>nil then FocusedApplication=SystemWideElement.AttributeValue(AccessibilityMBS.kAXFocusedApplicationAttribute) if FocusedApplication.Type=AccessibilityMBS.kAXUIElementMBSTypeID then FocusedApplicationElement=new AXUIElementMBS FocusedApplicationElement.Handle=FocusedApplication.Handle FocusedApplicationElement.RetainObject FocusedWindow=FocusedApplicationElement.AttributeValue(AccessibilityMBS.kAXFocusedWindowAttribute) if FocusedWindow<>nil and AccessibilityMBS.kAXUIElementMBSTypeID=FocusedWindow.Type then FocusedWindowElement=new AXUIElementMBS FocusedWindowElement.Handle=FocusedWindow.Handle FocusedWindowElement.RetainObject Title=FocusedWindowElement.AttributeValue(AccessibilityMBS.kAXTitleAttribute) if Title<>nil and Title.Type=kCFStringMBSTypeID then cs=new CFStringMBS cs.handle=Title.Handle cs.RetainObject Return cs.str end if end if end if end if End Function
End Class
MenuBar MenuBar1
MenuItem FileMenu = "&Ablage"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Bearbeiten"
MenuItem EditUndo = "&Rückgängig"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "&Ausschneiden"
MenuItem EditCopy = "&Kopieren"
MenuItem EditPaste = "&Einfügen"
MenuItem EditClear = "#App.kEditClear"
MenuItem UntitledMenu0 = "-"
MenuItem EditSelectAll = "&Alles auswählen"
End MenuBar
End Project

See also:

The items on this page are in the following plugins: MBS MacOSX Plugin.


The biggest plugin in space...