ATOMac - class BaseAXUIElement

getAppRefByPid(pid)
Returns the top level element for the specified pid
Usage:
import atomac
application_element = atomac.getAppRefByPid(process_id)
#Return value is a python element representation of the specified Application(Source: getAppRefByPid)

getAppRefByBundleId(bundle_id)
Returns the top level element for the specified bundle id 
(Sample Bundle ID: com.apple.iTunes)
Usage:
itunes = atomac.getAppRefByBundleId("com.apple.iTunes")
#Return value will be the python object representation of the iTunes
(Source: getAppRefByBundleId)

getAppRefByLocalizedName(application_name)
Returns the top level element for the specified localized name
(Sample Localized Name: Safari)
Usage:
safari = atomac.getAppRefByLocalizedName("Safari")
#Return value is a python object representation of the Safari
(Source: getAppRefByLocalizedName)

getFrontmostApp

Returns the current frontmost application. ValueError exception will be thrown if there is no GUI application running.
Usage:
front_most_app = atomac.getFrontmostApp()
#Return value is a python object representation of the front most app (Source: getFrontmostApp)

getAnyAppWithWindow

Returns any of the application running with windows
Usage:
Say iTunes, Terminal and Safari is running currently
one_of_running_app = getAnyAppWithWindow()
#Returns value is a python object representation of any of the application running with UI having at-least one active window. ValueError exception will be thrown if there is no GUI application running (Source: getAnyAppWithWindow)

getSystemObject
Returns the top level system accessibility object
Usage:
getSystemObject()
#Return value is a python object representation of the top most application (Source: getSystemObject)


setSystemWideTimeout(timeout_in_seconds)

Sets  the timeout for system wide accessibility.
Usage:
setSystemWideTimeout(10)
#Returns none.
Here system wide timeout is set as 10 seconds. By default the system wide accessibility is set as 0 second.
Note: This function does not return anything(Source: setSystemWideTimeout)

launchAppByBundleId(bundle_id)

Launches the application using the "Bundle Id" specified.
Usage:
launchAppByBundleId("com.apple.Safari")
This will launch the 'Safari' browser. Does not return anything.
A RuntimeError will be thrown if the specified bundle id is not found in the list of installed apps. (Source: launchAppByBundleId)

launchAppByBundlePath(path_of_application)
Launches the application using the path specified
Usage:
launchAppByBundleId("/Applications/Firefox.app")
This will launch the 'Safari' browser. Returns 'true' if succeeds. Returns 'false' if fails (Source: launchAppByBundlePath)

terminateAppByBundleId(bundle_id)

Terminates the application using the "Bundle Id" specified.
Usage:
terminateAppByBundleId("com.apple.Safari")
This will terminate the 'Safari' browser provided the browser is in the list of running apps. Returns 'true' if succeeds. Returns 'false' if fails (Source: terminateAppByBundleId)

2 comments:

  1. In getAppRefByBundleId(bundle_id), you have posted itunes = atomac.getAppRefByPid("com.apple.iTunes")
    I think it should be itunes = atomac.getAppRefByBundleId("com.apple.iTunes").

    ReplyDelete
    Replies
    1. Hello. I appreciate your help. Thanks much for the correction. Updated the page

      Delete