Re: Can we use PyObjc to call kAXTrustedCheckOptionPrompt?
Jake Wang <[email protected]> Sun, 4 Jan 2015 20:50:42 +0800
| Newsgroups | gmane.comp.python.pyobjc.devel |
|---|---|
| Message-ID | <CALtF2525D+kO6VWeguyBBBuAxsu5kSZb7dRy0HmMawisFOxcFQ@mail.gmail.com> |
Great, thanks. I will try. On Sun, Jan 4, 2015 at 7:56 PM, Ronald Oussoren <[email protected]> wrote: > > On 04 Jan 2015, at 01:43, Jake Wang <[email protected]> wrote: > > I would like to ask users for access of assistive devices in Python. > > In Objc, I saw it could be done via the code below: > > NSDictionary *options = @{(id)kAXTrustedCheckOptionPrompt : @YES}; > BOOL accessibilityEnabled = > AXIsProcessTrustedWithOptions((CFDictionaryRef)options); > > Can we use PyObjc to implement similar function in Python? > > > It is possbile to use this function using PyObjC, but you will have to do > some work to access the API because the ApplicationServices framework is > not yet wrapped. > > import objc > b = objc.loadBundle('CoreServices', globals(), > '/System/Library/Frameworks/ApplicationServices.framework') > objc.loadBundleFunctions(b, globals(), [('AXIsProcessTrustedWithOptions', > b'Z@')]) > objc.loadBundleVariables(b, globals(), [('kAXTrustedCheckOptionPrompt', b'@ > ')]) > > print AXIsProcessTrustedWithOptions({kAXTrustedCheckOptionPrompt: True}) > > Ronald > > Thanks a lot. > > ------------------------------------------------------------------------------ > Dive into the World of Parallel Programming! The Go Parallel Website, > sponsored by Intel and developed in partnership with Slashdot Media, is > your > hub for all things parallel software development, from weekly thought > leadership blogs to news, videos, case studies, tutorials and more. Take a > look and join the conversation now. > http://goparallel.sourceforge.net_______________________________________________ > Pyobjc-dev mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev > > > ------------------------------------------------------------------------------ Dive into the World of Parallel Programming! The Go Parallel Website, sponsored by Intel and developed in partnership with Slashdot Media, is your hub for all things parallel software development, from weekly thought leadership blogs to news, videos, case studies, tutorials and more. Take a look and join the conversation now. http://goparallel.sourceforge.net _______________________________________________ Pyobjc-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/pyobjc-dev