Using AI for "randomizing" existing sentences

You can append the following line to the end of the script:

items[randomIndex].querySelector("a.replay-button.soundLink")?.click();

For reliability, it’s better to enable “Don’t play audio automatically” in the deck’s settings. This won’t work, if there is more than one sound that needs to be played, however (see this discussion: Turn off auto-play for hidden elements - #17 by dae). And will require additional workaround if intended to be used with AnkiDroid. I have a card template with a fully implemented randomized audio autoplay function, if you’d like a reference. It supports audio autoplay on AnkiWeb in addition to everything else as well:
Memrise card template [support thread] - #197 by Eltaurus

2 Likes