Jump to content
danklim

auto-substitute a group of text in all of my notes

Recommended Posts

Hi

I’m wondering is there a way to auto-change out a group of text in all of my notes.

Use case: I use evernote for guitar chords and it would be easier to make all chords written in the same way. Ie 'Dbm' and 'C#m' are the same chord but C#m is easier to remember for me. Can i easily/automatically change every instance where Dbm  is written to be C#m instead (in all of my notes)? (With either evernote or a 3rd party tool.) If so, how?

Share this post


Link to post
14 hours ago, danklim said:

I’m wondering is there a way to auto-change out a group of text in all of my notes.

Mac: Applescript

Heres a generic handler for text replacement.  You also need code to cycle through the notes; see here

on replace_chars(this_textsearch_stringreplacement_string)
   set AppleScript's text item delimiters to the search_string
   set the item_list to every text item of this_text
   set AppleScript's text item delimiters to the replacement_string
   set this_text to the item_list as string
   set AppleScript's text item delimiters to ""
   return this_text
end replace_chars

 
  •  
  • Like 2

Share this post


Link to post
57 minutes ago, danklim said:

Hi

I’m wondering is there a way to auto-change out a group of text in all of my notes.

Use case: I use evernote for guitar chords and it would be easier to make all chords written in the same way. Ie 'Dbm' and 'C#m' are the same chord but C#m is easier to remember for me. Can i easily/automatically change every instance where Dbm  is written to be C#m instead (in all of my notes)? (With either evernote or a 3rd party tool.) If so, how?

You can export all the affected notes to an ENEX file, find/replace in that file using a text editor and then import the notes back into EN.  Do a few at a time to get the hang of it if you go this way.

  • Like 2

Share this post


Link to post
3 hours ago, CalS said:

You can export all the affected notes to an ENEX file, find/replace in that file using a text editor and then import the notes back into EN.  Do a few at a time to get the hang of it if you go this way.

If the notes are in multiple notebooks, beware that ENEX format doesn't preserve the notebook a note came from...

  • Like 1
  • Thanks 1

Share this post


Link to post
On 6/5/2018 at 12:27 PM, CalS said:
On 6/5/2018 at 4:28 PM, jefito said:

 

If the notes are in multiple notebooks, beware that ENEX format doesn't preserve the notebook a note came from...

Thanks! Ok i want to preserve notebook so i won't use ENEX.

 

On 6/5/2018 at 12:18 PM, DTLow said:

Mac: Applescript

Heres a generic handler for text replacement.  You also need code to cycle through the notes; see here

on replace_chars(this_textsearch_stringreplacement_string)
   set AppleScript's text item delimiters to the search_string
   set the item_list to every text item of this_text
   set AppleScript's text item delimiters to the replacement_string
   set this_text to the item_list as string
   set AppleScript's text item delimiters to ""
   return this_text
end replace_chars

 
  • Thanks!  I have very limited experience with apple script and not sure yet how to implement this? I just need to copy and paste this into script editor and run it, as well as re-write the code you supplied in the link and run that on a seperate instance of script editor? Or anything else? Any idea how long this will take or if should expect errors/obstacles?

 

Share this post


Link to post
2 hours ago, danklim said:

I have very limited experience with apple script and not sure yet how to implement this? I just need to copy and paste this into script editor and run it, as well as re-write the code you supplied in the link and run that on a seperate instance of script editor? Or anything else? Any idea how long this will take or if should expect errors/obstacles?

That's basically it; copy the code into the script editor app and click on run.

Start with something simple like "Hello World"
You should start out with a simple test and small set of notes.  
- This will test the changes give you a benchmark for timing.
- Try the code to pass through the note set, without changing any text
- Enable show-log so you get feedback on the progress.
- I use "selected notes" as the criteria to control the notes being processed

On my Mac (lightweight mini), it took about 3 hours for 10,000 notes.

Share this post


Link to post
3 hours ago, danklim said:

Thanks! Ok i want to preserve notebook so i won't use ENEX.

The missing notebook can be resolved by separate export/imports for each notebook.

Another gotcha of the .enex export/import is the import creates a new set of notes; you will have two sets of notes.

Any note links will point to the old set of notes.

Share this post


Link to post
4 hours ago, danklim said:

Thanks! Ok i want to preserve notebook so i won't use ENEX.

Export/Edit/Import by notebook to resolve this. 

Keep in mind the other considerations posed above.  To address the potential issues I don't change link names in EN.  Then should the link ever get broken I just search on the link title to find the note and re-establish the link if need be.  FWiW.

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...