I tried this and noticed that some devices take a 30 seconds break after 5 attempts. Ducky is not aware of that and keeps sending codes, and these codes are not executed. So after 5 attempts there must be a wait for 30 seconds or more build in the script.
The double enter is also not needed but only after 5 attempts to klick the warning away.
The changed script can be found here:
http://pastebin.com/4x53pkya