Platforms to show: All Mac Windows Linux Cross-Platform

/MacOSX/Accessibility services/Frontmost Window


Required plugins for this example: MBS Util Plugin, MBS MacCF Plugin, MBS Picture 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/Frontmost Window

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

Project "Frontmost Window.xojo_binary_project"
Class Window1 Inherits Window
Control Timer1 Inherits Timer
ControlInstance Timer1 Inherits Timer
EventHandler Sub Action() dim e1,e2,e3 as AXUIElementMBS dim a1,a2,a3,a4 as AXValueMBS dim typ as integer dim ok as integer dim l,t,w,h as single e1=AccessibilityMBS.SystemWideAXUIElement a1=e1.AttributeValue(AccessibilityMBS.kAXFocusedApplicationAttribute) typ=a1.Type if typ=AccessibilityMBS.kAXUIElementMBSTypeID then e2=new AXUIElementMBS e2.Handle=a1.Handle e2.RetainObject a3=e2.AttributeValue(AccessibilityMBS.kAXFocusedWindowAttribute) if a3<>nil then typ=a3.Type if typ=AccessibilityMBS.kAXUIElementMBSTypeID then e3=new AXUIElementMBS e3.Handle=a3.Handle e3.RetainObject a4=e3.AttributeValue(AccessibilityMBS.kAXPositionAttribute) if a4<>nil and a4.AXGetCGPoint(l,t) then ok=ok+1 end if a4=e3.AttributeValue(AccessibilityMBS.kAXSizeAttribute) if a4<>nil and a4.AXGetCGSize(w,h) then ok=ok+1 end if end if end if end if if ok=2 and not app.FrontmostMBS then Backdrop=ScreenshotRectMBS(l,t,w,h) end if Exception End EventHandler
End Control
EventHandler Sub Open() if not AccessibilityMBS.Available then MsgBox "The framework for the Accessible API could not be loaded." quit end if if not AccessibilityMBS.AXAPIEnabled then MsgBox "The Accessible API is not enabled" quit end if End EventHandler
Property Protected last As string
Property Protected obj(0) As cfobjectMBS
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

See also:

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


The biggest plugin in space...