Warning, /graphics/kst-plot/README.kstScript is written in an unsupported language. File is not indexed.

0001 For information on how to create Kst scripts in python, please see hen.astro.utoronto.ca/pyKst
0002 
0003 Kst implements a client-server interface for scripting. Scripts interacts with a running kst session.
0004 
0005 This server is implemented in scriptserver.cpp.
0006 
0007 Upon receiving a socket message from QLocalSocket, ScriptServer parses it. ScriptServer implements a map
0008 between command strings and ScriptServer member functions. 
0009 
0010 These commands include "newVector()", "getPlotList()", etc.
0011 
0012 To edit a vector, you would call "beginEdit(Vector Name)". This would open an "interface". One interface
0013 is DialogScriptInterface which simply allows a script to control a hidden dialog. Where speed is important,
0014 other (hard-coded) interfaces are created. To close the interface, one would call "endEdit()".
0015 
0016 ScriptServer also implements a very minimalistic language providing:
0017 
0018   - if statements in the form:
0019 
0020     if(...)
0021     fi()
0022 
0023   - variables in the form:
0024     $a=blah
0025     setText($a)
0026 
0027   - macros in the form:
0028     newMacro(a,d=c)
0029     setText($a)
0030     setColor($d)
0031     endMacro()
0032 
0033     Note that 'c' is not a default argument: they initialize a and d so you can run a macro while writing it.
0034     newMacro(...) runs the macro while it is being written. newMacro_(...) does not)
0035 
0036 Note that kstScript (that is, the simple language ScriptServer understands) never uses quotes. It is therefore
0037 important that extra spacing is not added. Comments are also not supported. I feel that it is not worth improving
0038 this 'language'. If someone should have time, a port to javascript would certainly be better.
0039 
0040 You can use tests/kstcontrol to write kstScript macros. A list of possible commands is shown inside kstcontrol on the
0041 right hand side. To make macros permanent (i.e., load on start of kst) add them to the file "kstScript.txt".
0042 kstcontrol outputs macros you create to stdout on endMacro().
0043 
0044 IMPORTANT
0045 ===========
0046 Writing macros is preferred over implementing them directly in a language (say, python) because the underlying API is
0047 not guaranteed to be consistent and macros allow multiple languages to all have similar functionality with better code
0048 reuse.
0049 
0050 To get a feel for how they are written, please see kstScript.txt.
0051 
0052 To give a language the ability to communicate with kst, implement functions which use QLocalSocket to communicate with
0053 ScriptServer. Refer to pykst whose source is available in pykst/pykst.py and pykst/pykstpp.py.