Great, thanks. I will try.
On Sun, Jan 4, 2015 at 7:56 PM, Ronald Oussoren <ron...@ma...>
wrote:
>
> On 04 Jan 2015, at 01:43, Jake Wang <del...@gm...> 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
> Pyo...@li...
> https://lists.sourceforge.net/lists/listinfo/pyobjc-dev
>
>
>
|