Code: Select all
EnableExplicit
ImportC ""
AXIsProcessTrusted()
AXIsProcessTrustedWithOptions(options)
EndImport
Global kCFBooleanTrue = PeekI(dlsym_(#RTLD_DEFAULT, "kCFBooleanTrue"))
Global kAXTrustedCheckOptionPrompt = PeekI(dlsym_(#RTLD_DEFAULT, "kAXTrustedCheckOptionPrompt"))
Global dic = CocoaMessage(0, 0, "NSDictionary dictionaryWithObject:", kCFBooleanTrue, "forKey:", kAXTrustedCheckOptionPrompt)
;Global dic = CocoaMessage(0, 0, "NSDictionary dictionaryWithObject:", #YES, "forKey:$", @"kAXTrustedCheckOptionPrompt")
If AXIsProcessTrustedWithOptions(dic)
MessageRequester("Test", "Permissions are granted")
EndIf
Global w = OpenWindow(0, 0, 0, 200, 100, "Test")
Repeat
Global e = WaitWindowEvent()
Until e = #PB_Event_CloseWindow
However, macOS automatically adds the wrong path to the Accessibility dialog. It adds the path to the binary itself (hence the shown 'terminal icon') instead of the path to the package ('package icon'). The package path is needed to make it actually have permissions... (needs second run). How to make it add the .pkg path? plist hack?