# Load environment variables ext = md_search.getNotesExtension() # p = md_search.getNotesPath() query = Tools.getArgv(1) todos = md_search.todoSearch(query) wf = Items() if len(todos) > 0: for i in todos: md_path = urllib.pathname2url(i['path']) md_title = i['title'] if i['title'] != str() else Tools.chop( i['filename'], ext) wf.setItem(title=i['todo'], subtitle=u'\u2192 {0} (Created: {1})'.format( md_title.decode('utf-8'), Tools.getDateStr(i['ctime'])), arg=i['path'], valid=True, type='file') wf.setIcon('icons/unchecked.png', 'image') # Mod for CMD - new action menu wf.addMod(key="cmd", arg="{0}>{1}".format(i['path'], query), subtitle="Actions..", icon_path="icons/action.png", icon_type="image") # TODO: REmove # wf.addModsToItem() wf.addItem() else: wf.setItem(title="No todo found!",
md_search = MyNotes.Search() # Load environment variables ext = md_search.getNotesExtension() p = md_search.getNotesPath() query = Tools.getArgv(1) todos = md_search.todoSearch(query) wf = Items() if len(todos) > 0: for i in todos: md_path = urllib.pathname2url(i['path']) md_title = i['title'] if i['title'] != str() else Tools.chop(i['filename'], ext) wf.setItem( title=i['todo'], subtitle=u'\u2192 %s (Created: %s)' % (md_title.decode('utf-8'), Tools.getDateStr(i['ctime'])), arg=i['path'], valid=True, type='file' ) wf.setIcon('icons/unchecked.png','image') # Mod for CTRL - delete a Note wf.addMod( key="ctrl", arg=Tools.strJoin(i['path'], '|', query), subtitle="Delete Note", valid=True, icon_path="icons/delete.png", icon_type="image" ) wf.addModsToItem()
# Get Search config with AND and OR search_terms, search_type = md_search.get_search_config(query) # create WF object wf = Items() # exec search if search terms were entered if len(search_terms) > 0: sorted_file_list = md_search.notes_search(search_terms, search_type) # get full list of file in case no search was entered else: sorted_file_list = md_search.getFilesListSorted() # Write search results into WF object for f in sorted_file_list: c_date = Tools.getDateStr(f['ctime']) m_date = Tools.getDateStr(f['mtime']) wf.setItem( title=f['title'], subtitle= u"Created: {0}, Modified: {1} ({2} \u2192 Actions, {3} \u2192 Quicklook)" .format(c_date, m_date, u'\u2318', u'\u21E7'), type='file', arg=f['path']) # Mod for CMD - new action menu wf.addMod(key="cmd", arg="{0}>{1}".format(f['path'], query), subtitle="Enter Actions Menu for the Note...", icon_path="icons/action.png", icon_type="image") wf.addModsToItem()
subtitle=u"\u23CE to start again", arg="*RESTART*", valid=True) wf.setIcon('attention.png', 'png') wf.addItem() # if file search has no results elif len(file_list) == 0: wf.setItem(title='Cannot find file starting with "{0}"'.format(query), valid=False) wf.setIcon('attention.png', 'png') wf.addItem() # Expose sorted file list to Script Filter else: for d in file_list: path = d['path'] size = RecentFiles.convertFileSize( d['size']) if os.path.isfile(path) else '-' filename = d['filename'] a_date = Tools.getDateStr(d['time'], date_format) wf.setItem( title=filename, type='file', subtitle=u'Added: {0}, Size: {1} (\u2318 Reveal in Finder)'.format( a_date, size), arg=path, quicklookurl=path) wf.setIcon(path, 'fileicon') wf.addItem() wf.write()