Jump to content

NikolayBPetrov

Level 1
  • Posts

    6
  • Joined

  • Last visited

Posts posted by NikolayBPetrov

  1. On 8/24/2023 at 12:16 PM, bwydoogh said:

    Update on this issue: After numerous emails and back-and-forth communication, Evernote has confirmed that there is an issue with the UpdateNote method. They have assured me that they will be working on a fix in the upcoming weeks.

    Finally.

    And confirmed by @Federico Simionato 😉.

    A few "upcoming weeks" later and this still does not work for me. Anyone else?

  2. Here's a workaround. A bad one. But a workaround nonetheless.

    Use case: you have notes tag with a specific tag and you want the notes in that tag to be sorted by Location (i.e. notebook).

    How to: Use the API to get all the notes of that tag, sort them however you want, then update their date created such that when you sort by date created in EN, they are in the desired order. Schedule that script to run every morning. Set up a shortcut or w/e to run the script at any point.

    Limitations: Takes a while to run (20-ish seconds). You can't have one of the notes open while running the script.

    Sample code:

    # import hashlib
    # import binascii
    import os
    from base64 import b64encode
    import pandas as pd
    import time
    
    from evernote.api.client import EvernoteClient
    import evernote.edam.userstore.constants as UserStoreConstants
    # import evernote.edam.type.ttypes as Types
    from evernote.edam.notestore.ttypes import NoteFilter, NotesMetadataResultSpec
    
    import inspect
    if not hasattr(inspect, 'getargspec'):
        inspect.getargspec = inspect.getfullargspec
    
        
    auth_token = "your token..."
    
    sandbox=False
    china=False
    
    client = EvernoteClient(token=auth_token, sandbox=sandbox,china=china)
    
    note_store = client.get_note_store()
    
    next_tag_guid = "<tag guid here>"
    filter = NoteFilter()
    filter.tagGuids = [next_tag_guid]
    spec = NotesMetadataResultSpec()
    spec.includeTitle = True
    spec.includeNotebookGuid = True
    # spec.includeTagGuids = True
    notes_list = note_store.findNotesMetadata(auth_token, filter, 0, 1000, spec)
    
    notebooks_guid_name_map = {}
    for notebook in note_store.listNotebooks(auth_token):
        notebooks_guid_name_map[notebook.guid] = notebook.name
    
    notebook_order = ['Notebook 1', 'Notebook 2', 'Notebook 3']
    
    mylist = [{'note_guid': e.guid, 'notebook_guid': e.notebookGuid, 'notebook_name': notebooks_guid_name_map[e.notebookGuid]} for e in notes_list.notes]
    df = pd.DataFrame(mylist)
    
    # Check if all elements of the df column are present in the order array
    if set(df['notebook_name'].unique()).issubset(set(notebook_order)):
        print("All elements of the df column are present in the order array.")
    else:
        print("Not all elements of the df column are present in the order array.")
    
    # Create a categorical data type with the given order
    df['notebook_name'] = pd.Categorical(df['notebook_name'], categories=notebook_order, ordered=True)
    
    df = df.sort_values('notebook_name', ascending=True).reset_index(drop=True)
    
    for ind, row in df.iterrows():
        existing_note = note_store.getNote(row['note_guid'], True, True, True, True)
        new_date_created = int(round(time.time()*1000)) - (ind*24*60*60*1000)
        existing_note.created = new_date_created
        note_store.updateNote(existing_note)

    In any case, this, among other things, is why I am considering switching to Notion...

    • Like 2
  3. For what it's worth, here's an AHK script to open a new note window and move it to the default inbox. It's a bit slow but for quicker captures the default Alt+S shortcut (open evernote helper) works fine.

    ;create new note in default window global shortcut
    ;shift-alt-n
    +!n::
    Send ^!n ;default "create new note" shortcut, global
    Sleep 500
    Send !+m ;"move note" shortcut
    Sleep 1000
    SendInput {Raw}Inbox
    Send {Down}
    Send {Enter}

     

    Feel free to tinker with the Sleep numbers depending on how quick your PC is. Really a shame that there isn't a better way.

×
×
  • Create New...