User guide for qankiadd


Abstract

Although current implementation of the qankiadd can be barely considered even as alpha version, and most probably only me can use it efficiently, I decided to create user manual already now anyway to structure features available in the current version. When I describe features of each step/version, I can better decide which features should be added on the next step, and which can be shifted to the later versions.

Getting started

Download the EXE installer from download page, run it and follow the steps of the installation program. After successfull installation run main.exe with the administrator rights. Make sure that in the folder with main.exe proper configuration file config.xml is stored.

Configuration file

To be able to run qankiadd you have to place the configuration file config.xml in the root folder of the program. This file contains all available configurations and can be changed by user based on his own needs. Example of the config.xml:

<?xml version='1.0' encoding='UTF-8'?>
<Root>
  <SaveAll>
    <Modifier>ctrl</Modifier>
    <Modifier>shift</Modifier>
    <Key>s</Key>
  </SaveAll>
  <ClearAll>
    <Modifier>ctrl</Modifier>
    <Modifier>shift</Modifier>
    <Key>l</Key>
  </ClearAll>
  <Quit>
    <Modifier>ctrl</Modifier>
    <Modifier>shift</Modifier>
    <Key>`</Key>
  </Quit>
  <ShowStatus>
    <Modifier>ctrl</Modifier>
    <Modifier>shift</Modifier>
    <Key>o</Key>
  </ShowStatus>
  <Configuration name="Foreign Language">
    <Field name="Question" addmode="Ignore" required="True">
      <Modifier>ctrl</Modifier>
      <Key>d</Key>
      <DataProvider>Clipboard</DataProvider>
    </Field>
    <Field name="Answer" addmode="Write" required="True">
      <ObservableField>Question</ObservableField>
      <DataProvider arg="RU">GoogleTranslate</DataProvider>
    </Field>
  </Configuration>
</Root>

Shortkeys

One of the main conepts of the qankiadd is shortkeys. By pressing the shortkeys you can perform some actions. In qankiadd shortkey consists of up to 4 Modifiers ("ctrl", "alt", "win", "shift") and 1 Key (any key of the keyboards). Shortkeys can be defined in the "config.xml" with the following syntax:

<Modifier>SomeModifier</Modifier>
<Key>SomeKeyboardKey</Key>

For example:

<Modifier>ctrl</Modifier>
<Modifier>shift</Modifier>
<Key>o</Key>

The above code defines the shortkey (('ctrl', 'shift'), 'o') which means that if you press Ctrl+Shift+O some action will be performed (e.g. copying selected text into the field).

Defining common shortkeys

At the beginning of the configuration file you have to define the shortkeys which will be available for all configurations. If you do not define them, the default shortkeys will be used.

The shortkey for saving all fields

The <SaveAll> shortkey is used to export the data stored in the fields into the file, which can be then imported in Anki.

To define the shortkey you have to use the following XML element:

<SaveAll>
  <Modifier>SomeModifier</Modifier>
  <Key>SomeKeyboardKey</Key>
</SaveAll>

The defulat shortkey is (('ctrl', 'shift'), 's')

The shortkey for clearing all fields

The <ClearAll> shortkey is used to clear all data stored in the fields.

To define the shortkey you have to use the following XML element:

<ClearAll>
  <Modifier>SomeModifier</Modifier>
  <Key>SomeKeyboardKey</Key>
</ClearAll>

The defulat shortkey is (('ctrl', 'shift'), 'l')

The shortkey for quiting the app

The <Quit> shortkey is used to stop the application.

To define the shortkey you have to use the following XML element:

<Quit>
  <Modifier>SomeModifier</Modifier>
  <Key>SomeKeyboardKey</Key>
</Quit>

The defulat shortkey is (('ctrl', 'shift'), '~')

The shortkey for showing the status

The <ShowStatus> shortkey shows current configuration:

  • Available fields
  • Shortkeys assigned to each field
  • Currently set text of the fields
  • Observers assigned to each field
  • Data provider assigned to each field

To define the shortkey you have to use the following XML element:

<ShowStatus>
  <Modifier>SomeModifier</Modifier>
  <Key>SomeKeyboardKey</Key>
</ShowStatus>

The defulat shortkey is (('ctrl', 'shift'), 'o')

Defining study configurations

At the startup of program you will be asked to select the configuration which you would like to use. Each <Configuration> consists of attrbute name and child elements <Field>. Any amount of <Configuration> elements can be defined within one config.xml file. Each <Configuration> can have any amount of the <Field> elements.

<Configuration name="Foreign Language">
  <Field name="Question" addmode="Ignore" required="True">
      (elements related to the field)
  </Field>
</Configuration>

Each field can be filled with the text which can be then exported to the Anki. To define field the <Field> XML element has to be used. This element can have the following attributes:

  • name - mandatory attribute which stands for the name of the field
  • addmode - not mandatory attribute which stands for the way of setting the text to the fields and can accpet the following options:
    • Ignore - if the field already contains some text do not update field with the new text. The default option.
    • Write - the text of the field will be rewritten with new text
    • Append - new text will be appended to the already existing field's text
  • required - not mandatory attribute and can have the value True or False (the default option). True means the fields will not be exported to the file until this field does not contain the text.

The field can be filled with the text by pressing user defined shortkey. One shortkey can be assigned to the field by using the following XML defintion:

<Configuration name="Foreign Language">
  <Field name="Question">
      <Modifier>SomeModifier</Modifier>
      <Key>SomeKey</Key>
  </Field>
</Configuration>

After the shortkey assigned to the field is pressed, the data retreived from the data provider is set to the field. By defult Clipboard data provider is used. To assign another data provider to the field the <DataProvider> element has to be used. The following data providers currently available:

  • Clipboard - if you select some text, and press the shortkey of the field which has Clipboard data provider, the selected text will be added to this field. This data provider do the following:

    1. Simulates press of the Ctrl+C key, so that the selected data is copied into the clipboard buffer
    2. Retreives the data from the clipboard buffer.
  • GoogleTranslate - the data provider which returns the translation of the passed text. This data provider has attribute arg which contains the information about the destinition language (to which language the text has to be translated). Currently this attribute accepts the following options:

    • RU - translate to russian language

    • EN - translate to english language

    • DE - translate to german language

      <Field name="Answer" addmode="Write" required="True">
          <DataProvider arg="RU">GoogleTranslate</DataProvider>
      </Field>
      

It is also possible to make so, that after pressing the shortkey of the Field1, the updated text of the Field1 is sent to the obeservers, e.g. Field2. After Field2 receives the text it passes this text to the assigned data provider and updates its own text with the text returned by the data provider. For defining obersvers add element <ObservableField> to the field you want to make observable. Inside this element put the name of the field to observe. E.g. let's take an example:

<Field name="Question" addmode="Ignore" required="True">
    <Modifier>ctrl</Modifier>
    <Key>d</Key>
    <DataProvider>Clipboard</DataProvider>
</Field>
<Field name="Answer" addmode="Write" required="True">
    <ObservableField>Question</ObservableField>
    <DataProvider arg="RU">GoogleTranslate</DataProvider>
</Field>

The following steps will be executed with the above defined configuration if a user presses Ctrl+D key:

  1. the field Question is updated with the selected text (because Clipboard data provider is used).
  2. the selected text is sent to the field Answer, because this field is an observer of the field Question (see element <ObservableField> which contains the name Question).
  3. the field Answer receives the text and:
    1. passes it to the GoogleTranslate data provider
    2. GoogleTranslate translates the passed text and returns the result back to the field Answer
    3. Answer receives the text from GoogleTranslate and updates its own text with the received one.

This concept allows you very quickly create flash cards by only pressing the user defined shortkeys - qankiadd will automatically update all observer fields by using defined data providers.

Console

Console not only provides usefull information about the current status of the fields, but also allows to manage some of the qankiadd settings.

After you start qankiadd first of all you will be asked to enable or disable the sound settings:

Do you want to enable sound notifications (y/n):

If you input n and press n+Enter or just press Enter the sound will be disabled and you will be asked next question. In case you input y and press Enter sound settings will be enabled. This means that after each successfull saving of all fields into the file you will hear beep sound. If you try to save all fields and will not hear any sound, it will mean that some of the required fields are still empty or the app encoutered some error. Moreover another beep sound with the lower frequency you will hear in case the text can't be set to the field because of some reasons.

After the question about sound settings, the list of all available configurations will appear and you will be asked to select the wanted configuration:

Please select the configuration:
0. Foreign Language
1. Programming

Here you have to input the number of the configuration. If you press Enter the first configuration will be selected.

After the configuration is selected, you will see the status of the registered keys:

Registering the shortkey [('ctrl', 'shift'), 's']
Registering the shortkey [('ctrl', 'shift'), 'l']
Unable to register the shortkey
Registering the shortkey [('ctrl', 'shift'), 'o']
Unable to register the shortkey
Registering the shortkey [('ctrl',), 'd']

Please make sure that you don't see "Unable to register the shortkey" text. This text means that some of the applications in the system uses already the defined hotkey, and, therefore, this shorktey couldn't be registered by qankiadd. You can either disable another application which uses this shortkey, or redefine the shortkey in config.xml.

Fields export

After all required fields contain the data, you can export these fields into the file (e.g. by pressing the related shortkey). Currently only Anki export is supported, but later some more options can appear.

All exported files are stored under the folder ./output/ in the main app directory.

Directory of C:\qankiadd\output

09/02/2018  01:15 PM    <DIR>          .
09/02/2018  01:15 PM    <DIR>          ..
09/02/2018  01:15 PM            11,376 anki_2018-09-02_13-14-27.733103.txt
09/02/2018  01:15 PM             3,388 anki_2018-09-02_13-15-17.061169.txt

After each new run of the app new file is created (with the name which includes the current time), and after each field's export the data is appended to the end of the created file. If the size of the file exceeds 1 MB, new file is created.