I changed the Apple Scripting in the above example to the following, and I now no longer have to enter a password.
do shell script "bless -mount /Volumes/Windows -legacy -setBoot -nextonly" password "[YourPassword]" with administrator privileges
do shell script "shutdown -r now" password "[YourPassword]" with administrator privileges
Windows is the name of my Bootcamp volume.
Replace [YourPassword] with the appropriate password.
Works a treat. Thanks to the original author for the inspiration.