I try to send an apple event using Carbon framework.
Following the apple development guide
1. include Carbon.h and Carbon.framework into MACOSX APP
2. Using AECreateDesc, AECreateAppleEvent, AESend and so on, to create and send Apple Event
so, I create a new JUCE Console App, and following the guide, when I run the app, an “Automation Permission” dialog was shown, and all works fine.
then, I create a new JUCE GUI App, and using the same code and steps, none errors or warings occured when I buiding the project, but there is not any permission dialog show, and the apple event also not send, although the application successfully running.
when I use /JUCE/example/CMake template to create a CMake GuiAPP by CLion, and "target_link_library(MyApp PUBLIC “-framework Carbon”), the perission dialog also not showing.
I also try to enable the “Send Apple Events” and “Send Apple Events Text” in Projucer.
Here is my Apple Event Code
#include <iostream>
#include <Carbon/Carbon.h>
// SEND APPLE EVENT TO "PANG" APP
AEAddressDesc processAEAddressDesc; // Destination
AppleEvent appleEventToSend,appleEventReply; // Send Event & Response Event, NO REPLY
OSErr osError = noErr;
OSType PangSignature = 'PANG'; // Destination NAME
// Create Event Description
if(osError == noErr)
osError = AECreateDesc(typeApplSignature, &PangSignature, sizeof(PangSignature), &processAEAddressDesc);
// Create an apple event to send
if(osError == noErr)
// Custom Apple Event and Type Sd2a&SRgn
osError = AECreateAppleEvent('Sd2a','SRgn', &processAEAddressDesc, kAutoGenerateReturnID,kAnyTransactionID, &appleEventToSend);
// Create a NULL reply event because we don't expect any reply
if(osError == noErr)
osError = AECreateDesc(typeNull, NULL, 0, &appleEventReply);
// Send Event
if(osError == noErr)
osError = AESend(&appleEventToSend, &appleEventReply, kAEWaitReply|kAECanInteract,kAENormalPriority, kAEDefaultTimeout,NULL, NULL);