Importing from Super Memo (SRS) to Drafts

Hello guys/gals,

I have this situation. I have this software called Super Memo (the original space repetition software) which exports their flashcards in this form, its called Q&A which stand for Questions and Answers and its a single text file (.txt) with the flashcards in the following format

Q: It's a slowly progressive, persistent airflow obstruction associated with chronic inflammation of the airway [...]
A: COPD

Q: An oximetry reading of = [...]% is generally acceptable in an asymptomatic client with COPD
A: 88

Q: In order to prevent aspiration the food should be thickened liquids and also make sure they are not [...] prior to having their meal.
A: sedated

Now I don’t know if Drafts can do this but here it goes, can Drafts import said text file (.txt) with these flashcards in this format and create single entries and not 1 big file containing them.

I tried to import the file and it just creates a big file in the same format but I have to create single entries of each Q: and A: so both of these would be a single entry with a space in between the Q: and A: like in this sample clip Single Entry Sample Clip of what I mean by this

So in essence each single entry would like this

Q: It's a slowly progressive, persistent airflow obstruction associated with chronic inflammation of the airway [...]

A: COPD

Thanks so much and I can buy you a beer or two for this script :slight_smile: thank guys/gals I’m hoping its within Drafts toolset to create this import and the rest via a script.

Or if after I import the big .txt with it then via script I can create the single entries as explained above that would work too into a Workspace I could designate to have these.

Gracias
Jorge

You can certainly import a file and create drafts separately, but it is a little more complicated than working with an existing draft and honestly, I need to get my kids ready for school very soon, so I’ll start with the principles in this one :laughing:

So here’s a script/action that splits your big draft on the text “Q:”, and tags new drafts with qacard for your workspace (you can of course modify that in the script (see line 2)).


const DELIM = "Q:";
const TAG = "qacard";
let astrCards = draft.content.split("\n" + DELIM);
astrCards.map(strCard =>
{
	if (strCard.length > 0)
	{
	    let dNew = Draft.create();
	    if (strCard.startsWith(DELIM)) dNew.content = strCard;
	    else dNew.content = DELIM + strCard;
	    dNew.addTag(TAG);
	    dNew.update();
	}
});

It leaves the original draft in place, but it would be easy to modify it to trash or archive the draft.

Hope that helps.

1 Like

i think @sylumer’s response should exactly do what you want - so I hope its fine to ask this “offtopic” question:

Do you use Drafts to roll through those flashcards or do you use Anki or sth. else to work through them?
Just interested in your workflow of learning cards :slight_smile:

1 Like

Oh my this is amazing and it works like a charm !! thank you, one last thing how do I add a space in between the Q: and the A:

Like this - Video Sample

Again, thank you much

I’ll reply later on at length to various workflow, yes - Anki, Super Memo, iDR etc. Cheers I love all this stuff

I’ve updated the action to add an extra line before the “A:”. Just get the updated action from the directory (same link).

1 Like

thanks !!! its perfect

emailed you so I would not fill the thread with an offtopic conversation

1 Like