Кодирование событий Apple
У меня очень простой AppleScript:
tell application "Opera"
get URL of active tab of window 1
end tell
Это перевод к AppleEvents:
osascript browser.scpt
{core,getd target='psn '[Opera] {----={form=prop,want=prop,seld=URL ,from={form=prop,want=prop,seld=acTa,from={form=indx,want=cwin,seld=1,from=NULL-impl}}}} attr:{csig=65536 returnID=15130}
По некоторым причинам я не могу использовать AppleScript, поэтому мне нужно перевести эти события в C-код.
До сих пор у меня есть это после просмотра некоторых примеров и чтения некоторых документов:
AppleEvent theEvent;
AEIdleUPP theIdleProc = NewAEIdleUPP((AEIdleProcPtr)&TheIdleFunction );
if( NULL != theIdleProc )
{
char* arg = "Opera";
AEAddressDesc addDesc;
err = AECreateDesc( typeProcessSerialNumber, &arg, sizeof( arg ), &addDesc );
printf("AECreateDesc error --> %d\n", err);
if( noErr == err )
{
// my event creation
// create event:
err = AECreateAppleEvent( 'core', 'getd', &addDesc, kAutoGenerateReturnID, kAnyTransactionID, &theEvent );
// create descriptors needed
AEDesc indexDescriptor;
long indexVerb = 'indx';
err = AECreateDesc('enum',&indexVerb,4,&indexDescriptor);
AEDesc nullDsc;
err = AECreateDesc(typeNull, nil, 0, &nullDsc);
//seld = 1
long seldIndex = 1;
AEDesc seldIndexDesc;
err = AECreateDesc(typeSInt64 ,&seldIndex,4,&seldIndexDesc);
err = CreateObjSpecifier('cwin',&nullDsc,'ID ',&theSeldDesc,true,&theThirdObjSpec);
}
}
return 0;
Но я застрял здесь. Как подключить "form=indx", например, к "want=cwin" Нужно ли создавать AEDesc для части формы, затем для части хот, а также для продажи?
И что означает последняя строка в необработанном событии? "attr:{csig=65536 returnID=15130}"
Я отчасти потерян с этим. Буду признателен за небольшой пример для использования в качестве руководства
заранее спасибо