Don't script it - just paste the link into the Insert Media pop-up - two buttons to the left of the smiley icon (or if you prefer, the next 'active' button to the left). You can specify dimensions when you do that, if you like (max width of 800 pixels to display properly here).