Last active
October 8, 2018 00:53
-
-
Save adamwalz/7671407 to your computer and use it in GitHub Desktop.
Batch changes the creation of notes in Evernote based on their notebook and a tag specifying the month to change to. The new creation date will be the last day of that month. For Example, notes with the tag "march" in the notebook "Receipts 2003" will all have the creation date "March 31, 2013"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/osascript | |
------------------------------------------------------------------------------ | |
-- FILE: redate_evernote_receipts.scpt | |
-- DESCRIPTION: Changes the created: attributes of notes in a Receipts Notebook | |
-- AUTHOR: Adam Walz <[email protected]> | |
-- VERSION: 1.0.0 | |
-- | |
-- This script changes the created: attribute of notes in a single notebook | |
-- to 11:59:59 on the last day of the month. | |
-- To do this, notes are required to be in a notebook titled "Receipts 2014" | |
-- for the year 2014. To change the year, set the yearnum variable to a different | |
-- integer. Each note in that notebook must be tagged with the month the receipt | |
-- was created in lowercase, i.e. "january". | |
-- Notes with multiple month tags will have their creation dates set to the | |
-- the latest tagged month. | |
-- | |
-- Leap year is not taken into account. | |
-- updated: attribute is not changed. | |
------------------------------------------------------------------------------ | |
tell application id "com.evernote.Evernote" | |
set yearnum to 2014 | |
set notebook_name to ("Receipts " & yearnum) | |
repeat with tag_month in {"january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"} | |
if (tag_month is in {"april", "june", "september", "november"}) then | |
set last_day to 30 | |
else if (tag_month is in {"january", "march", "may", "july", "august", "october", "december"}) then | |
set last_day to 31 | |
else | |
set last_day to 28 | |
end if | |
set filter to "notebook:\"" & notebook_name & "\" tag:" & tag_month | |
set matches to find notes filter | |
repeat with current_note in matches | |
set new_date to my date (tag_month & " " & last_day & ", " & yearnum & " at 11:59:59 PM" as string) | |
set creation date of current_note to new_date | |
end repeat | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment