In C++ SDK is example of Listener. It generates C++ code. But if you look at these data it are same data as in ScriptListener.log but in another language. So you can modify listener example code to generate clean javascript instead c++ and compile it into library and get rid of current version script listener. This is AM for new layer: var idMk = charIDToTypeID( "Mk " ); var desc1430 = new ActionDescriptor(); var idnull = charIDToTypeID( "null" ); var ref709 = new ActionReference(); var idLyr = charIDToTypeID( "Lyr " ); ref709.putClass( idLyr ); desc1430.putReference( idnull, ref709 ); var idLyrI = charIDToTypeID( "LyrI" ); desc1430.putInteger( idLyrI, 36 ); executeAction( idMk, desc1430, DialogModes.NO ); This is generated C++ for new layer: SPErr PlayeventMake(/*your parameters go here*/void) { PIActionDescriptor result = NULL; DescriptorTypeID runtimeKeyID; DescriptorTypeID runtimeTypeID; DescriptorTypeID runtimeObjID; DescriptorTypeID runtimeEnumID; DescriptorTypeID runtimeClassID; DescriptorTypeID runtimePropID; DescriptorTypeID runtimeUnitID; SPErr error = kSPNoError; // Move this to the top of the routine! PIActionDescriptor desc0000000000b55578 = NULL; error = sPSActionDescriptor->Make(&desc0000000000b55578); if (error) goto returnError; // Move this to the top of the routine! PIActionReference ref0000000000a83e30 = NULL; error = sPSActionReference->Make(&ref0000000000a83e30); if (error) goto returnError; error = sPSActionReference->PutClass(ref0000000000a83e30, classLayer); if (error) goto returnError; error = sPSActionDescriptor->PutReference(desc0000000000b55578, keyNull, ref0000000000A83E30); if (error) goto returnError; error = sPSActionDescriptor->PutInteger(desc0000000000b55578, keyLayerID, 36); if (error) goto returnError; error = sPSActionControl->Play(&result, eventMake, desc0000000000B55578, plugInDialogSilent); if (error) goto returnError; returnError: if (result != NULL) sPSActionDescriptor->Free(result); if (desc0000000000b55578 != NULL) sPSActionDescriptor->Free(desc0000000000b55578); if (ref0000000000a83e30 != NULL) sPSActionReference->Free(ref0000000000a83e30); return error; }
... View more