Here's what's worked for me (and explained to me many years ago by my college trumpet teacher):
Don't think of the notes and the tonguing as having to be coordinated -- the notes go by too fast to think about that way.
Essentially you have two mechanisms at work, and if they operate at the same speed and start at the same instant, they mesh up perfectly.
1) practice tonguing on a single pitch at the speed you want to play the passage (start with short passages to develop this procedure);
2) practice slurring the passage you are trying to learn, making sure to play it at the same speed your triple tonguing on the single note was;
3) play the passage with the multiple tonguing and it should work.
My teacher taught me (and I've never seen reason to change) that the tonguing part of the music should be automatic and should require no thought other than when to start and stop the multiple-tonguing and what speed to do it at. Essentially it's a machine you turn on, off and adjust the speed of with very little mental attention. That way the majority of your thinking power can be applied to the much more complex fingering patterns and keeping the fingerings moving at the proper speed.
Once he got me to stop thinking of "ta" "ta" "ka" with each pitch along the way (G-ta, A-ta, B-ka, C-ta, D-ta, E-ka, etc) and got my tonguing to be automatic, he freed up my playing so that now even without having practiced a passage I can do a respectable (even if not perfect) job of triple-tonguing or double-tonguing a passage the first time, and then practice it to get it perfect after that.