Archive for the ‘Tech How To’ Category

A Robot Completed My Inventory: Fun with AppleScript

June 4th, 2009

Granted, a human had to go to the shelves and scan 13,822 barcodes.

Another bonus for the human: the ability to generate creative code.

When I scanned a section of my library into my inventory, the scanner saved all of those barcodes as a text file. But here’s a mistake I had made (did I mention 13,822 barcodes?): I had closed all of the previous librarians’ inventories. It asked me what to do with books I hadn’t inventoried yet. I said to mark them as lost, since when I manually scanned a book in, our catalog responds, “This copy had been marked as lost, but will now be found” (or something to that effect). After scanning all of the books, what was left would be truly lost books.

Little did I know that when you use a portable scanner to store up a list of barcodes, when you import that list it says that lost books had now been found, but didn’t update the copy status (they’d still be considered lost until someone hand-scanned them in)(even though I just got done scanning them with a portable scanner).

Since it was already 9pm, I didn’t want to type in 3,000 barcodes by hand.

This morning I wrote my first script in AppleScript. What makes AppleScript different from other programming languages is that it is set up specifically to automate programs that you already have.

I wrote a program that would check the file from the scanner, type in a barcode, press enter, and move on to the next line and repeat the process (like a robot typing in each barcode, line by line).

I set it up so that you run the code, choose the text file holding your barcodes, and then have time to click on the place in your catalog where you type in for books to be checked in. You have to manually click on that text box in your catalog at the start, but I set it up like that so that if your catalog wasn’t set up exactly like mine, you could still use my script.

Here’s the script:
-- variable for carriage return/enter key
set CR to ASCII character of 13

set the source_file to choose file with prompt "That freaking file is located here:"
--give me time to switch back to the circulation
delay 5

-- get file data
set fp to open for access source_file
set barcodes to read fp
close access fp

-- types each line in and presses enter/carriage return
set single_barcode to every paragraph of barcodes
set AppleScript's text item delimiters to ""
repeat with thisBarcode in single_barcode
tell application "System Events"
keystroke thisBarcode & CR
delay 5
end tell
end repeat

Feel free to run it in your AppleScript editor (located in Applications on, I think, every new Mac). I have not found something like this on a Windows machine, but I haven’t really looked.

I’m a Mac fan because my MacBook has sped up my workflow considerably, and this is another example adding to my fanboy-ness. The Apple language is very easy to understand. I saved myself hours just by creating a script this morning.

Oceanography Videos

April 14th, 2009

As Crowell’s class is working on oceanography iMovies, these sites might be a good place for videos to use in your projects:

Michael Johnson Marine Natural History Photography

Cosmeo from Discovery Channel

For teachers to sign up for videos:
Teachers’ Domain

Potential Anti-virus Software

April 1st, 2009

Here are some recommendations from the Yahoo Tech guy.

If these break your computer, blame him.

Microsoft’s Web-Based Scanner
Symantec
TrendMicro

Google Docs Add-Ons – One Day Only

April 1st, 2009

picture-12
Did you see some of the functions that Google Docs offers? I’m going to try out the subliminal messages for my next PowerPoint. It’ll even change your data to fit your hypothesis. I don’t know if I trust the CADIE sentence completer, though.

Check out more of what it can do by clicking here.

I think the robot brain may have gotten out of control.

Chilton’s Exercise Jingles

November 14th, 2008

In GarageBand, “Share->Export to Disk” and save it in your documents.

Click here for the link to the Virtual Classroom. Log in like you log in at school. If this is your first time using a VC, you’ll need to update some user information.

In the Virtual Classroom, it’s the Exercise Jingles database and you’ll add an entry and choose your .m4a file.

‘08 Podcasts

November 10th, 2008

Click here for the link to Ms. Redfield’s Virtual Classroom.
Here’s a re-posting of the instructions:

  1. In your GarageBand project, click on Share (in your top menu) and then Export podcast to disk. Remember where you save it, because you’ll need to browse for the file later. It should be saved as a .m4a file.
  2. Go to the podcasting virtual classroom by clicking here. (You may need to open a new window (File->New Window to be able to view the instructions here and work in the classroom.)
  3. Log in with the same user name and password that you use to get onto the computers at school.
  4. Fill in the required profile information. This site is closed to only people in our district, so share what you are comfortable with.
  5. Type in the enrollment key that you got from your teacher and click on the Enroll Me button.
  6. On the virtual classroom’s main page, click on the link for your specific hour.
    Photobucket
  7. This represents a student-made database of podcast files.
  8. Click on Add Entry.
    Photobucket
  9. Type in your podcast description title and a short description.
  10. At the bottom of the screen is a place to upload the actual podcast file. Browse for the file and then make sure to Save and view.
    Photobucket
  11. Now you can view other groups’ podcasts.

Google Pages changes to Google Sites

October 1st, 2008

Google Pages now has morphed into Google Sites. The part that I appreciate with the upgrade is that it now looks like it runs well in Safari.

Check out the Future Professionals site:
http://sites.google.com/site/futureprofs/.

Use TextEdit to create your HTML. We’re practicing creating links and referencing images:

Create your page with the title “Welcome” and the number of the computer that you’re on. Also, don’t put any mention of your name online.

Creating a Newspaper in Word

August 25th, 2008

Here are some simple graphic design tricks I learned from my friend in New York:

  1. Make sure that your Formatting Palette is available. If you can’t see it, click on View->Formatting Palette
  2. Click on the Insert Table button. (The blue grid.)
  3. Select the 2X3 table
  4. For your banner/newspaper name, highlight the top three cells
  5. Hold down Control and then click on the highlighted cells (it’s like a right-click on a PC)
  6. Choose Merge Cells
  7. Type in your headline.
  8. In the bottom-left cell, start typing your first article.
  9. You can copy and paste pictures into your articles. (Remember the Control + Shift + Apple + 4 screenshot trick.)
  10. To change a picture’s wrapping (how the words flow around it) click on Wrapping->Square
  11. Once your article is completely typed, you can turn off the lines of your table/cells. Highlight your table. From the top menu, click on Table->Table Properties
  12. Click on the Borders and Shading button. Select “None”.

ActionScript for Advanced Computers

March 12th, 2008

(and for Future Professionals, but we’ve been working on this)

The first type of code that I like to introduce is “stop();”. Put this in the ActionScript for the first frame. Test the movie. Instead of moving on through the frames, it stops in frame 1. How exciting.
Photobucket

Let’s animate a figure.
Photobucket
This is circleman. He is a very complex character with artwork that took me hours to draw.

To be able to easily reuse circleman, instead of drawing him on the stage, I made him a separate movie clip in the Flash file’s library. That way I don’t have to spend hours re-drawing him.

Right now he’s kindof boring in his new layer on frame 1, especially since the “stop();” command doesn’t move the animation anywhere. But for this movie, all of the fun will happen in one frame.

Make sure that circleman is selected, click on his ActionScript button, and type in the code that you see in the picture:
Photobucket

The onClipEvent(load) is a one time thing when that movie clip shows up in the frame the first time around. You’re setting up the initial values of the speed.

The onClipEvent(enterFrame) is every time the frame loops. With the LEFT function, it’s making your xspeed value a negative one. Outside of the Key.isDown(Key.LEFT) function the _x and _y is being added to whatever your xspeed and yspeed values are. It will do this each time the frame loops (many times per second). This creates the constant motion. If you don’t like the constant motion, you could put the _x += xspeed; part inside the Key.isDown function to add the xspeed only when the key is down.

Remember: Brackets start and stop a function. Every time there’s an open bracket it has to close the function somewhere with a close bracket.

Back to the Key.isDown, the way we’ve got it set up, circleman moves left until he is stuck in the netherworld called “Offscreen” with no hope of return. Add some UP, DOWN, and RIGHT Key.isDown functions.

Boundaries
Here’s where stuff gets crazy.

Create a movie called “bounds”.
Photobucket
This will be your environment/world/level.
Put the movie bounds on the stage. Name its instance “wall”.
Photobucket

In circleman’s ActionScript, add a hitTest after your Key.isDown code but before your _y+=yspeed; stuff.
Photobucket
If the character hits the bounds, it stops and then moves to new x,y coordinates.

This ActionScript dictionary is officially your best friend.

The onClipEvent code

March 5th, 2008

is in wonderful text file format here:onclipevent.txt