Skip to content

June 28, 2006

Tweaking the VoiceNotes Widget

I’ve tried various applications to help me get my thoughts down quickly into something more permanent, and recently I’ve tried WidgetMachine’s NotePad 2.0 and VoiceNotes. I really like NotePad 2.0, but couldn’t get VoiceNotes to record correctly. After fixing it, I like it just as much. The problem was that VoiceNotes could not record to its default location in my home folder since I have FileVault enabled. I tweaked the widget to remedy that and then modified it to minimize the likelihood that one recording would overwrite another. By default each new recording has the exact same name unless you title the recording. If I’m in a hurry to record what I’m thinking about, I don’t have time to name the recording first. So instructions to modify the widget are below. Note: the usual disclaimers apply – modify at your own risk. Also, make sure you register this excellent widget.

Download and Uncompress VoiceNotes.zip

– Control-Click (or right-click) the Widget that was uncompressed

– Select “Show Package Contents”

– Open “voicenotes.js” in your favorite text editor

– Modify line 2 to select where notes should be stored. If you’re using FileVault, make sure the folder is not in your FileVault-protected home folder.

– Comment out line 115 that reads:

edit_div.innerText = "New Note";

by putting two slashes in front:

// edit_div.innerText = "New Note";

– Then copy and paste the following code below that line:

// Define a mostly unique name for the recording.
// Since the naming does not take timezone or daylight savings time
// into account it is possible for there to be overlap of filenames
// which may result in one recording overwriting another. 
var right_now=new Date();

var name_year = right_now.getYear(); 
if (name_year < 2000) 
name_year = name_year + 1900; 

var name_month = right_now.getMonth() + 1;
if (name_month < 10)
name_month = "0"+ name_month;

var name_date = right_now.getDate();
if (name_date < 10)
name_date = "0" + name_date;

var name_hrs = right_now.getHours();
if (name_hrs < 10)
name_hrs = "0"+name_hrs;

var name_min = right_now.getMinutes();
if (name_min < 10)
name_min = "0"+name_min;

var name_sec = right_now.getSeconds();
if (name_sec < 10)
name_sec = "0"+name_sec;

var new_name = ""+name_year+name_month+name_date+name_hrs+name_min+name_sec;

edit_div.innerText = new_name;

- Save the file.

- Double-click the widget to install it.

- When you create a new recording, it will now place the recording where you like and it will title each new recording with the current date and time by default (e.g. 20060629071908)

Read more from Technical

Share your thoughts, post a comment.

(required)
(required)

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments