Teacher Tech blog with Alice Keeler

Paperless Is Not a Pedagogy

Alice Keeler

You Can Copy Paste, So You Can Code

You Can Copy Paste, So You Can Code

If you can copy and paste you can code

Coding Requirements: Copy and Paste

I code with Google Apps Script which is based on JavaScript. How do I code… I copy and paste. There is a TON of sample code out on the Internet that you can steal. At first, I would copy and paste code. Then I would need to read through it and figure out what I needed to adjust. I copy and paste a lot less code now, by using “analyze over memorize” I got this!

script.google.com

You can create a new script at script.google.com. Choose “New script” in the upper left hand corner.
new script

Try This

create a Google Doc

Copy and paste the code below into the script editor.

function createDoc() {

DocumentApp.create(‘Alice Keeler Document’);

}

Now, modify it! After copying and pasting the code, try to make sense of it and modify it slightly!

Breaking Down the Code

1. function

You can have more than one function. A function is a chunk of code. It starts with lowercase function and then a space and then what you want to name the function. Note that your function name can not have a space. To use more than one word, smash the words together and capitalize the 2nd word.

Remember function notation from algebra? f(x) = x + 2.
The function f has a parameter (x). If you had f(5) you would replace all the x’s with 5’s. f(5) = (5) + 2.
It’s like that!!! Except usually, I do not have parameters when I code so it’s more like f().
So you need the empty parenthesis to say that your function does not have parameters!

2. Curly Braces

Curly braces trap the code for that function.

3. What App Are You Using?

Typically my first line of code is “What Google App are you using?” In this case I am coding a Google Doc so it is DocumentApp. Notice the capital D and A. It’s important.

4. Period

When you type a period in Google Apps Script it will give you a multiple choice menu for what methods (code) you can use. The awesome thing about Google Apps Script is that it is super readable!

5. Create

Reading the list of multiple choice options one of them says “Create().” I KNOW WHAT THAT DOES! It will create a Google Doc. In the parenthesis you can name the Google Doc you are creating! I named mine ‘Alice Keeler Document.’ Notice the single quotations! All text strings (stuff you want to type) must be in quotations.

6. Semicolon

At the end of each line of code you want to have a semicolon!

Save and Run

Modify something small! (Hoping you changed what I named the document) then press the save button (or Control S) and press the Run button (triangle icon.) You will be prompted to name the script and authorize the script. You may get a screen that has a button that says “Return to safety.” Ignore that button and click on “Advanced” and then click on the link that says “unsafe” (it is safe, you coded it so you know it is not malicious code.)

Check Google Drive

You just created a Google text document. Check recent to see if it worked!

Now Modify

We used DocumentApp to create a new Google Doc. Do you think you can create another type of Google App?

SlidesApp
FormApp
SpreadsheetApp
CalendarApp
MapsApp
ContactsApp
DriveApp
GmailApp

DocumentApp

On the Google Apps developer site is sample code you can copy and paste!! Check out this page for DocumentApp. Scroll through and find code that you can copy and paste!
copy Google Docs

Modify My Code

alicekeeler.com/scripts

Copy and paste MY scripts! Go to my scripts page make a copy of one of my templates. Use the Tools menu and choose “Script editor.”

alice keeler codes




© 2024 All Rights Reserved.

💥 FREE OTIS WORKSHOP

Join Alice Keeler, Thursday Mar 21st or register to gain access to the recording.
Create a free OTIS account.

Join Alice Keeler for this session as we learn how to revolutionize your assessment strategies. We will dive into the essentials of crafting high-quality rubrics that go beyond traditional scoring methods to offer rich, meaningful feedback. We’ll learn about the components of an effective rubric and how to mathematically ensure the accuracy of your assessments.

Exit this pop up by pressing escape or clicking anywhere off the pop up.