启用辅助功能

时间:2018-04-12 05:00:35

标签: electron

如何在Mac OS中将此代码添加到Electron Application?

CFStringRef kAXManualAccessibility = CFSTR("AXManualAccessibility");

+ (void)enableAccessibility:(BOOL)enable inElectronApplication:(NSRunningApplication *)app
{
    AXUIElementRef appRef = AXUIElementCreateApplication(app.processIdentifier);
    if (appRef == nil)
        return;

    CFBooleanRef value = enable ? kCFBooleanTrue : kCFBooleanFalse;
    AXUIElementSetAttributeValue(appRef, kAXManualAccessibility, value);
    CFRelease(appRef);
}

我对说明感到困惑:https://github.com/electron/electron/blob/v2.0.0-beta.6/docs/tutorial/accessibility.md#enabling-accessibility

是的我是初学者,我只是想了解这个电子特征。谢谢。

0 个答案:

没有答案