bikeNik Posted February 17, 2019 Posted February 17, 2019 (edited) Ok. One more attempt to make the workflow for Anki cards generating. Or rather filling into Anki fields the content via Alfred. For me this way much handy than native Anki app. Obviously, it's not a full replacement for all cases. Something like Anki-Express. Anki: Powerful, intelligent flash cards. anki card generator: Create New Cards into any Decks with any "Note Type". Install $ npm install --global alfred-anki or as anki.alfredworkflow Requires: Node.js 7.6+, Alfred Powerpack, Anki intelligent flashcards, AnkiConnect plugin for Anki Also you can consider DrLulz/Anki-Templates Usage In Alfred, type :anki, Enter/Click on the any field to fill it in Enter/Click to save current value the same staps to edit. type :anki!, to setting menu. This workflow uses Markdown syntax: markdow-it library with Syntax highlighting (highlighjs.org), <ins> tag plugin for markdown-it ++inserted++ => <ins>inserted</ins>, <mark> tag plugin for markdown-it ==marked== => <mark>inserted</mark> Emojies Shortcuts (emoticons): 🙂 😞 8-) <abbr> tag plugin for markdown-it : *[HTML]: Hyper Text Markup Language The HTML specification On the card fields: hit ⌃ + ↩ to remember last input after created card. hit ⌃ + ↩ one more time to toggle switch this option hit ⌥ + ↩ to reset text from all fields hit ⇧(shift) to preview parsed fields of the card for line break type '\n' (with space or without), also should be handy to use 'Alfred's snippets'. to add an image from clipboard use Alfred snippet >>img needs install pngpaste check out another Alfred's snippets To use your own icons for your Model's fields just you should call the png files the same as fields [name-of-field].png and put it into icons folder of this Workflow directory. Recommended use two instances of each icon where second icon (with some mark) will be called as [name-of-field]_marked.png for "remember last import" option. ToDo Add sound to the field. (needs something universal) Add to the card and move the local image file to the foldercollection.media via Alfred Snippet p.s. It would be great to hear some more feature ideas to improve workflows like this. Edited February 28, 2019 by bikeNik update to v1.2.0
bikeNik Posted February 18, 2019 Author Posted February 18, 2019 (edited) Update: Added Markdown-it library for use markdown. This awesome library works with Syntax highlighting (highlighjs.org). To quick add some markdown highlighting code into Anki field via Alfred: ```js function $initHighlight(block, cls) { try { if (cls.search(/\bno\-highlight\b/) != -1) return process(block, true, 0x0F) + ` class="${cls}"`; } catch (e) { /* handle exception */ } for (var i = 0 / 2; i < classes.length; i++) { if (checkCondition(classes[i]) === undefined) console.log('undefined'); } } export $initHighlight; ``` I use a little lifehack with Alfred's snippet trigger (which has line breaks). Cause I suppose Alfred doesn't allow to carry a new line of in his input's field. Edited February 21, 2019 by bikeNik
deanishe Posted February 18, 2019 Posted February 18, 2019 6 minutes ago, bikeNik said: Cause I suppose Alfred doesn't allow to carry a new line of in his input's field. You can enter a newline into Alfred's query box, just not by hitting the RETURN key.
bikeNik Posted February 18, 2019 Author Posted February 18, 2019 (edited) 😎 ) And what would replace RETURN key.? .. I mean It works only when I paste text with line breaks. Edited February 18, 2019 by bikeNik
deanishe Posted February 19, 2019 Posted February 19, 2019 Yup. Pasting… I suppose you could also have your script expand escapes, so you could enter \n for a newline.
bikeNik Posted February 19, 2019 Author Posted February 19, 2019 (edited) 14 minutes ago, deanishe said: I suppose you could also have your script expand escapes, so you could enter \n for a newline. mm.. I don't think so. The point is, I need to see this new line in Alfred's query box with Large-Type (⌘L). And it won't convenient to edit the current field. So I think to make the trigger snippet like (>>n) which contains line break - would be better. I'm just pasting empty line break. Edited February 19, 2019 by bikeNik
deanishe Posted February 19, 2019 Posted February 19, 2019 Snippet is good, too. 1 minute ago, bikeNik said: I need to see this new line in Alfred's query box with Large-Type (⌘L) ⌘L directly from the query box? Otherwise, there'd always be the chance to put a script to replace the \n (or whatever) before it reaches the Large Type. I was thinking of escapes as it would make it much easier to edit the query again in Alfred, as it'd be on one line.
bikeNik Posted February 19, 2019 Author Posted February 19, 2019 (edited) @deanishe Thnx btw. I need something to improve this workflow. Any suggestion would not be out of place. Edited February 19, 2019 by bikeNik
deanishe Posted February 19, 2019 Posted February 19, 2019 I love flashcards, but I'm a Studies.app guy, I'm afraid, so I don't have any useful feedback. Anki is crazy expensive on iOS
bikeNik Posted February 20, 2019 Author Posted February 20, 2019 At the end of the end in practice, the method suggested by Deanishe works better. Cause it doesn’t take clipboard. I combine (‘\n ’) with snippets. Workflow updated.
bikeNik Posted February 21, 2019 Author Posted February 21, 2019 Update: Added a preview of parsed fields of the card by ⇧[shift]. The data is updated every time when the field text will save.
AZK Posted June 20, 2019 Posted June 20, 2019 Hi, love your workflow, would be great if it worked with alfred 4, though. Do you have any plans to update it?
bikeNik Posted June 20, 2019 Author Posted June 20, 2019 2 hours ago, AZK said: Do you have any plans to update it? Thanks. Yes, in near future. I'm busy now a little. Sorry.
bikeNik Posted August 5, 2019 Author Posted August 5, 2019 (edited) was updated: - moved the database to /Users/…/Library/Application Support/Alfred/Workflow Data/org.bikenik.anki - update for Alfred 4 (please, save (backup) your data which in the workflow folder (json files) before updating) Edited August 5, 2019 by bikeNik p.s.
Artyom Posted August 27, 2019 Posted August 27, 2019 (edited) @bikeNik Could you clarify how can I install your workflow? From your instructions `npm install --global alfred-anki` does nothing for me. I can see it installed to /usr/local/lib/node_modules/alfred-anki but there are no changes in Alfred. Other link "anki.alfredworkflow" sends me to github releases page, and there are no .alfredworkflow file inside, only source code Edited August 27, 2019 by Artyom
bikeNik Posted October 16, 2019 Author Posted October 16, 2019 @Artyom Try this release and install as anki.alfredworkflow Artyom 1
CuteCat Posted October 21, 2019 Posted October 21, 2019 Downloaded latest update and ankiconnect but im getting a message saying waiting-for-refresh. Nothing happens when I use the refresh under settings, would appreciate some advice!
bikeNik Posted November 23, 2019 Author Posted November 23, 2019 (edited) On 10/21/2019 at 3:58 PM, CuteCat said: Downloaded latest update and ankiconnect but im getting a message saying waiting-for-refresh. Nothing happens when I use the refresh under settings, would appreciate some advice! @CuteCat For my WF I changed the next section in python files (__init__.py) in AnkiConnect add-on: @api() def loadProfile(self, name): if name not in self.window().pm.profiles(): # return False return self.window().pm.profiles() if not self.window().isVisible(): self.window().pm.load(name) self.window().loadProfile() self.window().profileDiag.closeWithoutQuitting() else: cur_profile = self.window().pm.name if cur_profile != name: self.window().unloadProfileAndShowProfileManager() self.loadProfile(name) # return True return self.window().pm.profiles() I changed lines in comments - ("return False" & "return True") Edited November 23, 2019 by bikeNik CuteCat 1
bot4343 Posted December 16, 2019 Posted December 16, 2019 (edited) Downloaded latest update and ankiconnect but im getting a message saying waiting-for-refresh. Nothing happens when I use the refresh under settings, would appreciate some advice! Basically I have the same problem, how could I solve it? UPD: sorry, problem is solved: Anki Connect didn't work properly Edited December 16, 2019 by bot4343 CuteCat 1
Astatine-213 Posted April 9, 2020 Posted April 9, 2020 It said that I'm working without anki connect. But I've already installed the plugin and restarted anki. I also have installed node.js 12+ I'm currently working on Catalina with Alfred 4. Does't anyone has similar issue?
bikeNik Posted April 9, 2020 Author Posted April 9, 2020 (edited) 3 hours ago, Astatine-213 said: I've already installed the plugin and restarted anki. @Astatine-213 Please, check this address. http://127.0.0.1:8765 you should get return with the following text: AnkiConnect v.6 Edited April 9, 2020 by bikeNik
Daniele Posted May 14, 2020 Posted May 14, 2020 Installed. but there's something wrong. I don't know what. When I digit ":anki" how I should use it? How I can insert e new card? I Set the profile with my email address. It seems ok, but when I digit ":anki" it says the same "set some profile for workflow" . How can i fix this? Thank you very much
henrik Posted June 22, 2020 Posted June 22, 2020 (edited) Great workflow! The only issue I'm having is that I can only add a "front" but not a "back". When I press "back" (in my case "Rückseite"), there is a brief flash of the following image: Right after, I get the following (blank) Alfred bar with the Anki icon: I'm using Catalina 10.15.4. Any idea what's wrong? Thanks for your help! Best, Henrik Edited June 22, 2020 by henrik
bikeNik Posted June 22, 2020 Author Posted June 22, 2020 @henrik Yes. I've allready got this issue. https://github.com/bikenik/alfred-anki/issues/7#issuecomment-590779941 I'm making update with some new feature. I'll update soon. Thanks.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now