I have a script that works fine for image fields, but when used to call out sound file fields, all the sounds play in order, rather than only the randomly selected one. Does anyone know a way to correct this?
I think the root of the problem is that your approach simply hides all but one random audio buttons, however, Anki will automatically play all the sounds even if the replay buttons are hidden.
The following script seems to work fine on my computer. It tries to work around the issue by using JS to ‘click’ on the randomly selected replay button, which in turn should prevent the automatic reproduction of all other audio files: