Created
August 27, 2013 18:26
-
-
Save swbuehler/6357171 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
tell application "Evernote" | |
set theNotebooks to every notebook | |
repeat with eachNotebook in theNotebooks | |
set theNotes to (every note in (eachNotebook) whose creation date is greater than or equal to (the (current date) - the (time of the (current date)) - 1 * weeks)) | |
repeat with eachNote in theNotes | |
set theTitle to the title of eachNote | |
try | |
set dateflag to 1 | |
set theMonth to word 2 of theTitle as integer | |
set theDay to word 3 of theTitle as integer | |
set theYear to word 1 of theTitle as integer | |
on error errmesg number errnumber | |
set dateflag to 0 | |
end try | |
try | |
set timeflag to 1 | |
set theTime to (word 4 of theTitle as integer) | |
set theHours to (characters 1 thru 2 of word 4 of theTitle as string) as integer | |
set theMinutes to (characters 3 thru 4 of word 4 of theTitle as string) as integer | |
set theSeconds to (characters 5 thru 6 of word 4 of theTitle as string) as integer | |
on error errmesg number errnumber | |
set timeflag to 0 | |
end try | |
if dateflag is 1 then | |
set theNewDate to date "Monday, January 1, 1900 12:00:00 AM" | |
set the year of theNewDate to theYear | |
set the day of theNewDate to theDay | |
set the month of theNewDate to theMonth | |
set the time of theNewDate to 0 | |
end if | |
if timeflag is 1 then | |
set theNewDate to (theNewDate + (theHours * hours) + (theMinutes * minutes) + (theSeconds)) | |
end if | |
if dateflag is 1 then | |
if the creation date of eachNote is not equal to theNewDate or the subject date of eachNote is not equal to theNewDate then | |
set the creation date of eachNote to theNewDate | |
set the subject date of eachNote to theNewDate | |
assign tag "Script Corrected" to eachNote | |
unassign tag "Script Corrected" from eachNote | |
end if | |
end if | |
end repeat | |
end repeat | |
synchronize | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment