Jump to content
mootoh

mac (Archived) Request: Batch Attribute Edit

Recommended Posts

Is there a way to edit multiple notes to set the same attributes at once?

I often import old documents and want to set its created date to the same one.

  • Like 1

Share this post


Link to post

I've written AppleScripts for some of my clients to do this... :D

For example, here's one that I wrote for someone who wanted to be able to change the Month and Year of every item in a selected Notebook:

(Comments included to give you a sense for how each part works)

tell application "Evernote"
(* EVERNOTE NOTEBOOK SELECTION SUBROUTINE *)
set listOfNotebooks to {}
set EVNotebooks to every notebook
repeat with currentNotebook in EVNotebooks
set currentNotebookName to (the name of currentNotebook)
copy currentNotebookName to the end of listOfNotebooks
end repeat

(*SORT THE FOLDER LIST *)
set Folders_sorted to my simple_sort(listOfNotebooks)

(*USER SELECTION FROM NOTEBOOK LIST *)
set SelNotebook to choose from list of Folders_sorted with title "Select Notebook For Date Change" with prompt ¬
"Available Evernote Notebooks" OK button name "OK"
set EVnotebook to item 1 of SelNotebook

(*PREPARE TO GET EVERNOTE'S LIST OF NOTES *)
set listofNotes to {}

(*CHANGE YEAR *)
repeat
display dialog "" & ¬
"Enter Year" with title "Evernote | Date Changer" default answer "" buttons {"OK", "Cancel"} default button "OK" cancel button ¬
"Cancel" with icon path to resource "Evernote.icns" in bundle (path to application "Evernote")
try
set dialogresult to the result
set changeyear to text returned of dialogresult
set ButtonSel to button returned of dialogresult

if changeyear is "" then error
if changeyear is not "" then ¬
set changeyear to changeyear as number
if changeyear mod 1 is equal to 0 then
set changeyear to changeyear div 1
exit repeat
end if
on error
beep
end try
end repeat

(*CHANGE MONTH *)
set the low_value to 1
set the high_value to 12
repeat
display dialog "" & ¬
"Enter Month (1-12)" with title "Evernote | Date Changer" default answer "" buttons {"OK", "Cancel"} default button "OK" cancel button ¬
"Cancel" with icon path to resource "Evernote.icns" in bundle (path to application "Evernote")
try
set dialogresult to the result
set changemonth to text returned of dialogresult
set ButtonSel to button returned of dialogresult

if changemonth is "" then error
if changemonth is not "" then ¬
set changemonth to changemonth as number
if changemonth mod 1 is equal to 0 and ¬
changemonth is greater than or equal to low_value and ¬
changemonth is less than or equal to high_value then
set changemonth to changemonth div 1
exit repeat
end if
on error
beep
end try
end repeat

(* DATE CHANGES *)
set allNotes to every note in notebook EVnotebook
repeat with currentNote in allNotes
--CREATION DATE CHANGES
set CreNotes to the creation date of currentNote
set CreDates to the day of CreNotes
set CreMonths to the month of CreNotes
set CreYears to the year of CreNotes
set NewCreDate to "" & changemonth & " " & CreDates & ", " & changeyear
set (creation date) of currentNote to date NewCreDate

--MODIFICATION DATE CHANGES
set ModNotes to the modification date of currentNote
set ModDates to the day of ModNotes
set ModMonths to the month of ModNotes
set ModYears to the year of ModNotes
set NewModDate to "" & changemonth & " " & ModDates & ", " & changeyear
set (modification date) of currentNote to date NewModDate

end repeat
end tell

--REPLACE SUBROUTINE
on replaceString(theString, theOriginalString, theNewString)
set {od, AppleScript's text item delimiters} to {AppleScript's text item delimiters, theOriginalString}
set theStringParts to text items of theString
if (count of theStringParts) is greater than 1 then
set theString to text item 1 of theStringParts as string
repeat with eachPart in items 2 thru -1 of theStringParts
set theString to theString & theNewString & eachPart as string
end repeat
end if
set AppleScript's text item delimiters to od
return theString
end replaceString

--SORT SUBROUTINE
on simple_sort(my_list)
set the index_list to {}
set the sorted_list to {}
repeat (the number of items in my_list) times
set the low_item to ""
repeat with i from 1 to (number of items in my_list)
if i is not in the index_list then
set this_item to item i of my_list as text
if the low_item is "" then
set the low_item to this_item
set the low_item_index to i
else if this_item comes before the low_item then
set the low_item to this_item
set the low_item_index to i
end if
end if
end repeat
set the end of sorted_list to the low_item
set the end of the index_list to the low_item_index
end repeat
return the sorted_list
end simple_sort

Share this post


Link to post
I've written AppleScripts for some of my clients to do this... :D

For example, here's one that I wrote for someone who wanted to be able to change the Month and Year of every item in a selected Notebook:

nice. thanks for posting.

i haven't learned how to program in applescript. is there a version of this for changing the date and time of the currently selected notes (as opposed to all notes within a selected notebook)?

Share this post


Link to post

Sadly, there's currently no way to expose which items you've selected in Evernote to an AppleScript.

(See this thread for more: viewtopic.php?f=38&t=12604&p=62519&hilit=applescript#p62519 )

My personal belief is that a few simple improvements to the AppleScript functionality of Evernote would allow users to interact with their notes in a lot of very useful ways not currently possible.

If you agree, you should add your voice to those asking for Evernote's development team to bump AppleScript up on their priority list. They do read and respond to feedback -- so don't be shy about asking for what you need! :D

Share this post


Link to post

Realized that I didn't emphasize an important point, which is:

Although Evernote doesn't expose a "selected items" class to AppleScript yet, you can make an AppleScript Dialog that allows you to select multiple notes. This is something I utilize in several of my other scripts.

Share this post


Link to post

Add my voice here, too.

 

I'd also love a way to batch edit certain attributes, mostly dates. Sometimes, I have to change tags after a while, in such a case, the edit date is changed as well and so I have to manually edit this date back in every single note. A way to batch edit dates would save me quite some time.

Share this post


Link to post
Guest
This topic is now closed to further replies.

×
×
  • Create New...