Ankify icon indicating copy to clipboard operation
Ankify copied to clipboard

Having difficulty running the Ankify script

Open DryIce1 opened this issue 3 years ago • 13 comments

Hello,

thank you for your work, I have been wanting to incorporate this into my workflow since December last year and I have adopted Obsidian as my markdown writer recently.

I wonder if you could walk me through how to run your script? I am using Windows and have downloaded the Ankify package.

I don't know how to run "npm install" and nor run "npm link".

In the next step to run the script, do I open the command prompt and type "ankify"?

Thanks in advance. Tom

DryIce1 avatar Aug 29 '20 10:08 DryIce1

Hello, so the script is run in node.js, which needs to be run from the command prompt. You can install both node.js and npm here. Afterwards, you should be able to open up command prompt and type in npm -v to see the version for installation confirmation.

To run the script, open up command prompt and navigate to the script folder. Then, you can type npm install. This installs all of the dependencies for the script. Then, you can run npm link. This links the script so you can run ankify anywhere later on.

kangruixiang avatar Aug 29 '20 15:08 kangruixiang

Thank you, that was really well explained and I think the script has been properly installed.

I have summarised the installation process so that perhaps novices like myself may be able to walk themselves through the installation a bit more efficiently than I did.

  • The Ankify script needs some JavaScript software installed for it to run. Download and install node.js and npm via this website . Confirm correct installation by using the command prompt and typing npm -v and node -v
  • Download the Ankify zip, extract Ankify-master folder, and move it to a permanent location.
  • Edit and rename the .sample-env file as described in the ReadMe.
  • Next the Ankify script must be installed. Open the command prompt and navigate to the Ankify-master folder using the cd command (e.g. cd C:\Users\"User...."\....\Ankify-master). Then type npm install. Then type npm link. This allows the script to be run from anywhere when you open the command prompt.
  • To import new flashcards, run the open command prompt and type ankify. The script will copy new media files into the selected Anki Profile media collection and an html file in your MarkDown directory is created/updated with the new flashcards which can then be imported into Anki (using ctrl + shift + i).

DryIce1 avatar Aug 30 '20 01:08 DryIce1

Despite my successes above with installation, the script doesn't create any .html output file.

In the command line, I am getting a few errors. I wonder if you could take a look at it for me. How do you think I could troubleshoot this?

I have attached the env and script output as text files

DryIce1 avatar Aug 30 '20 01:08 DryIce1

Hey so I found fixed some of the code. It should work now in making the html code in the current folder. Also, for the anki profile folder, default is "Anki2\User 1\collection.media". You just change the User 1 part to your profile name.

kangruixiang avatar Aug 30 '20 13:08 kangruixiang

Thanks for your support @kangruixiang. I will fix my anki profile name in .env

I unlinked and uninstalled the ankify script, and then re-downloaded and installed it.

It hasn't worked successfully yet, but perhaps we are closer?

I know this is just a hobby, but if you are able to please assist at your convenience, Best Tom :)

DryIce1 avatar Sep 03 '20 20:09 DryIce1

Hello, thanks for trying. I rewrote the entire script with a different parser that should work more robust with less problems. Before you redownload the script, run npm unlink so you uninstall the previous version.

Let me know if this works or not. If not, we could set up a time for me to look at your screen. I've done that with 2 other people and helped them getting things to work. Otherwise, you can wait a few weeks for a version with interface to come out so you won't have to deal with command lines.

kangruixiang avatar Sep 04 '20 00:09 kangruixiang

Hi @kangruixiang! Perhaps we are getting closer....?

Command line output is Creating Anki card and it does 2 of the 3 things that your README file says it should do:

  1. copies all the images to anki media folder
  2. makes an html folder inside your markdown folder
  3. ~~converts all of the markdown files into one html file~~ No html file within the html folder :(

output.txt

thanks

DryIce1 avatar Sep 04 '20 20:09 DryIce1

ps: I would be happy to do a screenshare session. I am available this weekend. My timezone is GMT+10, if that helps! How would you like to connect?

tom

DryIce1 avatar Sep 04 '20 20:09 DryIce1

That sounds like the script worked but didn't find any MD files. Yeah I'm eastern time. Email me [email protected], and we can setup a time tomorrow.

kangruixiang avatar Sep 04 '20 22:09 kangruixiang

That sounds like the script worked but didn't find any MD files.

Yes, you're right I changed the ROOT_DIR to a folder which actually does contain a few MD files and it produced the Ankify html!

However, it is still not running properly. It doesn't recognise the MD files contained within deeper folders in the directory. You're doing well - almost there haha! Thanks :)

DryIce1 avatar Sep 05 '20 05:09 DryIce1

If you change line 68 of index.js let files = glob.sync(path.resolve(rootDir, "*.md")); to this: let files = glob.sync(path.resolve(rootDir, "**/*.md")); That should work.

kangruixiang avatar Sep 05 '20 12:09 kangruixiang

Thanks, I have it working well, and I can feel the workflow will be quite quick when going through my existing notes.

It is important to remember to use the ~ sign when importing!

What Text Expander software do you use on Windows? thanks

DryIce1 avatar Sep 06 '20 06:09 DryIce1

Yeah once set up it's really fast. I don't have to tailor my notes to making cards. I just add cards when I feel it's useful. I've been using espanso. It requires some setup but is rather simple.

kangruixiang avatar Sep 06 '20 12:09 kangruixiang