Thursday, March 3, 2011

Moving photos from a camera card with AutoHotkey

Just wanted to share a somewhat rough script I wrote using AutoHotkey (since my Python skills are weak and Windows-only is fine) for moving files from a camera SD card to folders organized by month.

I also set up an AutoRun.inf to run the compiled script when the card is inserted, similar to these instructions.


; AutoHotkey Version: 1.x
; Language:       English
;
; Script Function:
; Moving files from camera card (E:\DCIM\{etc}) to photos folder (H:\Photos\{date}) and then deleting them
; You may want to change H:\Photos\ throughout the code to something that actually exists on your computer.
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.

; Since the script is running from the camera card, we can use the variable A_ScriptDir to tell which drive letter the card got mounted as
SetWorkingDir %A_ScriptDir%\DCIM\

IfNotExist %DriveLetter%:\DCIM\
{
 MsgBox, 1, PhotoMover, Something is wrong, perhaps the camera card is not in the card reader.
 IfMsgBox, Cancel
  Return
}

; show a (sort of fake) progress bar and set the initial variables to zero
Progress, b,, Moving Photos, Moving Photos
Progress, 0
PhotoProgress = 0
VideoProgress = 0

; move the JPG files
; the 0 means don't include folder names, the 1 means recurse into subdirectories
Loop, *.JPG, 0, 1
{
; trim the date variable to the format YYYY-MM
StringLeft, FileDateYear, A_LoopFileTimeCreated, 4
FileDateMonth := SubStr(A_LoopFileTimeCreated, 5, 2)
FileDateYearDashMonth = %FileDateYear%-%FileDateMonth%

; make a month folder, if it doesn't already exist
IfNotExist H:\Photos\%FileDateYearDashMonth%\
 FileCreateDir H:\Photos\%FileDateYearDashMonth%\

; move the file to the appropriate folder in H:\Photos
FileMove, %A_LoopFileFullPath%, H:\Photos\%FileDateYearDashMonth%\

; Show (and increment) a progress bar
PhotoProgress+=1 ; increment the PhotoProgress variable
Progress, %PhotoProgress%
}

Progress, Off
if ErrorLevel
MsgBox, Well that didn't work... %ErrorCount% photos were not moved.

; and now move the MOV files
; first the progress bar
Progress, b,, Moving Videos, Moving Videos
Progress, 0

; the 0 means don't include folder names, the 1 means recurse into subdirectories
; we should probably do this for *.AVI files too
Loop, *.MOV, 0, 1
{
; trim the date variable to the format YYYY-MM
StringLeft, FileDateYear, A_LoopFileTimeCreated, 4
FileDateMonth := SubStr(A_LoopFileTimeCreated, 5, 2)
FileDateYearDashMonth = %FileDateYear%-%FileDateMonth%

; move the file to the appropriate folder in H:\Photos
FileMove, %A_LoopFileFullPath%, H:\Photos\%FileDateYearDashMonth%\

; Show (and increment) an approximate progress bar
VideoProgress+=1 ; increment the VideoProgress variable
Progress, %VideoProgress%
}

Progress, Off
if ErrorLevel
MsgBox, Well that didn't work... %ErrorCount% movies were not moved.

Tuesday, November 3, 2009

new blog

Since my job now involves blogging about technology, I'll be posting here less often.

In case you hadn't noticed already.

Anyway, if you want to check out my other blog, it's at eipstech.blogspot.com.

Saturday, October 31, 2009

Friday, October 23, 2009

podcast presentation

So you want your students to podcast


What’s a podcast?

Episodic downloadable audio (or video) content.

Does not require an iPod.

Usually has an associated RSS feed.


Recommended Podcasts

Technology: This Week in Tech

Science: Quirks and Quarks, Science Update

Social Studies: Stuff You Missed in History Class

Math: Math Grad

English Language Arts: CSTW Writers Talk

Arts: CBC Arts Podcasts

Medicine: White Coat, Black Art


How to create

Hardware (microphones, pop filters, etc)


How to create

Software

GarageBand

Audacity Portable

Myna


How to publish/share

hosting and syndication

technochild.net

mypodcast.com

ourmedia.org

feedburner.google.com


Music/Sound Effects

jamendo.com

audiofarm.org

musicalley.com

wikipedia.org/wiki/Podsafe


Legal Issues

Copyright or Creative Commons


Now let’s podcast…

Friday, October 16, 2009

recommended podcasts

A few podcasts that teachers may be interested in listening to:

Technology: This Week in Tech
Math: Math Grad
English Language Arts: CSTW Writers Talk

This is just a preliminary list to get you started, there are certainly others. Feel free to comment if there are others that you listen to.

Friday, September 25, 2009

picasa recognizes people

I'm a big fan of Picasa photo organizing software. They just recently introduced face recognition/tagging, which is very cool. It even seems to do fairly well at distinguishing the photos of our toddlers from their cousins, even though they look fairly similar.

We have a lot of photos (over 80 GB and counting), so it takes a while for it to scan through all of those to recognize faces, but it's doing fairly well so far.

Sunday, September 20, 2009

new features in Google Docs

Just a quick post to mention two new(ish) features of Google Docs.

The word count now includes some readability information.

It is now possible to insert an equation using an equation editor (LaTeX syntax, just like Wikipedia).