Jump to content
  • 0

(Archived) Request: Batch Attribute Edit


mootoh

Idea

7 replies to this idea

Recommended Posts

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

Link to comment
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)?

Link to comment

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

Link to comment

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.

Link to comment

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.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...