'After Onset' snippet is the best for sending an EEG trigger, since that snippet is called right after the event onset (when the event is presented on the screen). You should use the runtime command
of the port element, when it works in the manual mode. Alternatively, you can use a port element in the 'Output on the event onset' mode, and then change the trigger value in the 'Before Onset' snippet. This also makes sending triggers slightly faster (about 1 ms) than in the manual mode.