Navigation:  Using iKog >

Automating from the command line

Previous pageReturn to chapter overviewNext page

from version 1.86

It is possible to automatically run the program automatically from the command line.  This may be useful if you want to add tasks from another script.  You can run commands when iKog starts by entering:

ikog.py mydata.dat commands

 

Note that you must define the external data file that you are using; in this example mydata.dat is being used.  If you are using internal data, just use a full stop in place of the file name.  e.g.

ikog.py . commands

 

The commands part of the line is just a list of valid iKog commands separated by  / . Note that you must have a space either side of the / character.  So to apply a filter of @Computer and then list the tasks, we could start the program as follows:

ikog.py . FILTER @Computer / LIST


The program will run the commands when it starts and will then stay active waiting for user input.  If you want to exit automatically, you must add a QUIT command as well.


The main use of this feature is to allow the program to be automated via a script.  So to add a task from a script we could use:

ikog.py . + Buy some bread / QUIT


Because we want iKog to exit once it has finished, we added the QUIT command at the end.


If you are automating the program in this way, ensure that you do not use any commands that require user input as the program will wait for the input.


Deleting tasks is a little trickier as you need to be able to find the task to delete it.  Using task numbers is not appropriate as these can change and also require user confirmation.  To delete tasks from the command line, use the FILTER command to find some unique text.  So to delete a task that uniquely contains the text henspace you could run:

ikog.py . FILTER henspace / KILL THIS / QUIT

 

The FILTER command finds the task, the KILL THIS command then deletes the current task and finally QUIT exits.


Because you need a unique reference to delete tasks automatically it is a good idea to give each task a unique reference, e.g ref_1234 when you add it.


Do not use the caret symbol, e.g. KILL ^, as the symbol has a special interpretation on some systems.  Always use THIS instead.