In its simplest form such a script would be just a combination of SendModelingCommand() with MCOMMAND_CONVERTSELECTION to convert the selection and CallCommand() to switch the mode (command ID can be found in Script Log).
Right now, I'm in a hurry. Pretty sure, until I will find some time tomorrow, somebody will have copy/pasted something for you. If not, please ping me via PM and I can do it for you in a few minutes.