# import sys
# # import the main window object (mw) from aqt
# from aqt import mw
# # import the "show info" tool from utils.py
# from aqt.utils import showInfo
# # import all of the Qt GUI library
# from aqt.qt import *
# from anki.hooks import addHook
from anki.hooks import wrap
from aqt.editor import Editor
def mySaveNow(self, callback, keepFocus=False):
if self.note: # 有时候竟然会出现None
with open(r'D:\b.txt', 'w', encoding='utf8') as file:
file.write('{} {}'.format(self.note.tags, self.note.fields))
Editor.saveNow = wrap(Editor.saveNow, mySaveNow)