Sometimes you need to rename files before submitting them to the office to be processed. At my work, the initial assignment (or the StartUp assignment) needs to be submitted to school’s office to be processed — ie to get the proper funding. The format they office wishes the file name to be in is:
StartUp_LASTNAME_FirstName_CourseNameAndSection.pdf
I do ask the students to rename the file before they submitting the file — but many do not. So here is a shortcut — it is a bookmark in the browser tab. The code looks at the Student’s Name and the Course & Section Name and adds required code that the office needs. Watch the following video and they code is down below.
The following code is used for D2L’s Brightspace for the bookmark url:
javascript:prompt(“copy”,”StartUp_”+document.body.innerHTML.slice(document.body.innerHTML.indexOf(“<label><strong>”)+15,document.body.innerHTML.indexOf(“</strong></label>”)).slice(0,document.body.innerHTML.slice(document.body.innerHTML.indexOf(“<label><strong>”)+15,document.body.innerHTML.indexOf(“</strong></label>”)).indexOf(“Id”)-2).split(“”).reverse().join(“”).slice(0,document.body.innerHTML.slice(document.body.innerHTML.indexOf(“<label><strong>”)+15,document.body.innerHTML.indexOf(“</strong></label>”)).slice(0,document.body.innerHTML.slice(document.body.innerHTML.indexOf(“<label><strong>”)+15,document.body.innerHTML.indexOf(“</strong></label>”)).indexOf(“Id”)-2).split(“”).reverse().join(“”).indexOf(” “)).split(“”).reverse().join(“”).toUpperCase()+”_”+document.body.innerHTML.slice(document.body.innerHTML.indexOf(“<label><strong>”)+15,document.body.innerHTML.indexOf(“</strong></label>”)).slice(0,document.body.innerHTML.slice(document.body.innerHTML.indexOf(“<label><strong>”)+15,document.body.innerHTML.indexOf(“</strong></label>”)).indexOf(“Id”)-2).slice(0,document.body.innerHTML.slice(document.body.innerHTML.indexOf(“<label><strong>”)+15,document.body.innerHTML.indexOf(“</strong></label>”)).slice(0,document.body.innerHTML.slice(document.body.innerHTML.indexOf(“<label><strong>”)+15,document.body.innerHTML.indexOf(“</strong></label>”)).indexOf(“Id”)-2).indexOf(” “))+”_”+document.getElementsByClassName(“d2l-menuflyout-link-link”)[0].innerHTML.replace(“/”,”-“)+”_”+(document.getElementsByClassName(“d2l-menuflyout-link-link”)[0].innerHTML.replace(“/”,”-“).indexOf(“ummer”)>0?”SS”:”FY”))