Custom pop-up box using Apps Script

Spreadsheets: beyond the basics

7th grade students have a handle on using spreadsheets to store and display information, so we are taking our learning to the next level with Apps Scripts!

In our first class back from break, we started with a stock script and then got to hacking apart the code.  Although it looked scary, everyone succeeded in finding some info in the code that they could change to alter the outcome.

The script we started with was actually 2 scripts in one:

function onOpen() {
var sps = SpreadsheetApp.getActiveSpreadsheet();
var sheet = sps.getSheets()[0];

var menuEntries = [ {name: "Ask Name", functionName: "whatIsName"}];
sps.addMenu("CLICK HERE SILLY", menuEntries);

}

function whatIsName() {
var sps = SpreadsheetApp.getActiveSpreadsheet();
var sheet = sps.getSheets()[0];

var myValue = Browser.inputBox("What is your name?");
sheet.getRange("B8").setValue("is silly.");

var b1Range = sheet.getRange("A8").setValue(myValue);
}​

The first function in this script creates a custom menu button called “Click here silly”. When clicked, a drop down menu appears with a single option, “Ask Name”.

Custom Spreadsheet Menu - "Click here silly"

Custom Spreadsheet Menu - "Click here silly"

The second function is called “askName” and it runs when someone clicks on the custom menu button.  This function pops up an alert window that asks the user’s name, and then places the answer in box A8 along with a message in box B8.

Custom pop-up box using Apps Script

Custom pop-up box using Apps Script

For our next class, we took a closer look at the script we used and took some notes on what we found:

//script – code that tells a computer what to do
//variable – placeholder that represents data (number, text) that can change

//Google Apps uses Javascript

//Parts of Javascript
// = “commenting out” tells the computer to ignore
//var = variable

//red text = display text, code computer should consider text
//blue text = variables

Marketing: audience, purpose, context

8th grade students spent December in the Tech Lab reinforcing concepts from other classes.  When writing essays, History and Language Arts teachers ask students to focus on audience and purpose.

In tech, we used these same ideas to analyze our school’s radio commercials.  These ads play on the local NPR affiliate and students often hear them when carpooling to school in the morning.  Students commented that the ads are boring and clearly intended for parents in the Seattle area who might consider an independent school.

8th grade students then chose a specific audience, a purpose and a specific local radio station to target. We then used Audacity and Garageband to record our messages.

Abbey, Sophie and Nicole thought it would be useful to create an ad for NPR that speaks directly to the kids in the carpools.  They decided that they would record a song to capture attention and deliver a message.  Their final product also includes a clear call to action:

Billings Jingle – created by Sophie, Abbey and Nicole

Tech in the News: CES and Apple

So much exciting tech in the news lately…8th grade students discussed a few of the stand-out stories of the last week:

Apple becomes a distribution channel for OSX applications – Apple has taken their iTunes model (sell other people’s music and take a bit of money from each sale) and successfully applied it to iPhone apps. Now they are moving ahead and allowing Apple computer owners to do the same thing.

Two stories from CES 2011

Microsoft announces Surface 2.0

Snowboarding goes high tech

Independent project spotlight: Rory

Over break, 6th grade student Rory spent some time creating some absolutely amazing Scratch projects at home.  He created some games and some stories as well.  Rory offers some advice to others interested in learning more about Scratch:

I think the most useful functions I used were if/then/else statements and variables…as far as advice goes I would say to use simple controls, variables, lots of show/hides for different levels and broadcasting (though I didn’t use broadcasting for this one).

The Scuba Game took about 25 hours since I got a lot better at Scratch over the course of making the game.  At the moment in Scratch I’m working on a game/simulation of a chemistry lab and various smaller projects (like seasonal animations and simulations).

Learn more about this project

Logic statements – if, then, else

6th grade students have been playing with Scratch for a couple of weeks now and our understanding of programming is growing. There is one function that is so important that we dedicated an entire class period to understanding it- the if/then/else logic statement.

We began by talking about how parents use logic statements all the time:
“If you clean your room, you can have a sleepover, else you’ll be hanging out with your little brother tonight.”
“If you finish all your homework, we can watch Glee, else it’ll be straight to bed.”

Next we created if, then and else statements on sticky notes and used a random name generator to decide who would place a blue (if), pink (then), or purple (else) statement on the board. Once we had a complete logic statement we would run the program, using ourselves as the computer. Here are some of our favorites:

if you’ve poked yourself with a pencil in the last 24 hours
then leave the room by crawling
else jump up and down for 30 seconds

created by Simon, Will, Alex

if your room is dirty
sit on the floor and meditate
else go to the computer and look up “Pi day”

created by Gwen, Alex

if you have decorative shoelaces (colored or with patterns)
storm angrily out of the room
else do 10 jumping jacks

created by Colin, Fiona, Cooper

if you know what r(pi)cubed*4/3 is
then say “uh oh spagetti-os”
else go get a drink of water

created by Colin, Dillon, Arthur

Jake's Scratch programming for the moons of Jupiter

Moons of Jupiter: part 2

6th graders used their recently acquired Scratch skills to build orbital paths for the Galilean moons.  We took a look at a few useful tools: move, rotate, pen down, forever loops, and wait.  Below is Jake’s final product and a screenshot of one moon’s code.


Jake's code for moons of Jupiter

Jake's code for moons of Jupiter

IMG_2448

Mission to Mars: Crater Rover

6th grade students found out today that our Mars outpost water levels were dangerously low.  We realized that we needed to send a probe out to search for water at the base of the crater we were stationed on, but didn’t have any batteries to propel the craft.  Students used their knowledge from the simple machines unit to build rovers which could minimize friction and use gravity to move over distance.

We tested our crater rovers on 3 different angled inclined planes and recorded the metric results in a table.  This class reinforced previous science and math lessons of ramps, data recording, angles, the metric system and experiment design.  Students were also introduced  to the Lego Mindstorm kits that we’ll be using for the next month or so in conjunction with our intro to programming series in tech class.

IMG_7676

Moons of Jupiter

From our Mars outpost we have a really clear view of Jupiter.  6th grade STEM students spent class today experiencing these Galilean moons.

Students built scale models of the system at a 1:5,000,000 scale. Students calculated and cut moons to scaled size and then recorded accurate relative distances (which took about 3 meters).

house of cards - billings students and engineering

Applied math: house of cards

Written by Nick S.

In AML we were inspired by the world record holder Brian Berg to build card houses. The project was to build 3 different kinds of card houses. The first was a cardhouse made out of triangle shapes. The second was built out of cubes. The last one was made out of whatever shape we wanted. The object of this project was to see how many coins the structure could hold on top of it. My second structure held about 200 coins on it.

house of cards - billings students and engineeringhouse of cards - engineering

IMG_2303

Mission to Mars: Egg Drop

Safely at our Mars outpost, students are beginning to explore this foreign planet.  We were tasked by mission control with creating a protective deployment technique that would allow a raw egg to survive a 24 foot drop off the roof of the school.  NASA gave each team of engineers $7M to complete the project, but materials weren’t cheap – for example, a 7″ x 7″ piece of cardboard cost $500,000!

Go to Top