#zero_pad from http://kenclark.me/2009/10/an-applescript-function-to-zero-pad-integers/ on zero_pad(value, string_length) set string_zeroes to "" set digits_to_pad to string_length - (length of (value as string)) if digits_to_pad > 0 then repeat digits_to_pad times set string_zeroes to string_zeroes & "0" as string end repeat end if set padded_value to string_zeroes & value as string return padded_value end zero_pad on current_date_string() set year_str to ((year of (current date) as number) as string) set month_str to zero_pad((month of (current date) as number), 2) set day_str to zero_pad((day of (current date) as number), 2) return year_str & "/" & month_str & "/" & day_str end current_date_string #set textToAppend to "test string for testing" on process(textToAppend) set todays_page to "Journal " & current_date_string() set current_time_string to return & return & current_date_string() & " - " & (time string of (current date)) & ":" set ourDocument to "" tell application "VoodooPad" set documentList to every document whose name is not equal to "VPWikkaDocs.vpdoc" and name is not equal to "test.vpdoc" if (count of documentList) is equal to 1 then set ourDocument to item 1 of documentList else set listOfDocumentNames to {} repeat with currentDoc in documentList set currentDocName to (the name of currentDoc) copy currentDocName to the end of listOfDocumentNames end repeat activate set ourDocumentName to item 1 of (choose from list listOfDocumentNames with prompt "Pick the document to Journal:") set ourDocument to document ourDocumentName end if get "our doument is " & name of ourDocument tell ourDocument open page with name todays_page tell page todays_page append text return & current_time_string & return & textToAppend & return end tell open page with name "Journal Index" set pagestring to text of page "Journal Index" if pagestring does not contain todays_page then tell page "Journal Index" append text return & return & todays_page & return end tell end if open page with name todays_page end tell activate end tell end process