TeXworks as a QtScript editor

Previous Next

(All of this section is a work in progress!)

TeXworks as an IDE for QtScript Tw-Api

TeXworks is not designed for editing scripts as such, but has design features that may help people new to scripting, who are not used to using any other IDE (Interactive Development Environment) for scripting already.  

You may find another editor more suited to your on-going scripting needs, but initially TeXworks is a surprisingly good place to start.

One of the decided advantages of using Tw as its own script editor, is that with many script it is quite useful to be able to execute them using their shortcut keys from within the script editor itself (see as an example.)

Another advantage of using Tw to edit scripts, is that when making user interfaces using Qt Creator,  you can make a Tw script to get the Qt Creator interface to load the correct .ui, if it has a name based on the script you are currently editing, see Script/Interface Naming for more information.

Customisable features of TeXworks as a script editor include.

    1. Coloured commands and functions
    2. Tab Key based autocompletion.
    3. Paired delimiters for matching/balancing
    4. Tag window for function, var, const, with - list display

(See the following: texworks-config.txt  syntax-patterns.txt  Tab Key  based auto-complete   tag-patterns.txt    set_syntax.js )

By altering the list of file types that Tw will filter in the File Open dialogue, common extensions for the Tw script plugins can be added. E.g.—

file-open-filter: Script documents (*.js *.qs *.py *.lua *.mod *.php *.bat *.txt *.csv)

file-open-filter: Graphics (*.jpg *.png *.pdf)

TeXworks lets you add coloured highlighting for common scripting editing needs. This also gives a common point of reference for explaining Tw scripting concepts.

I'll be using that colour scheme in these helps.

Follow the instructions on this page syntax-patterns.txt if you want to add QtScript "syntax-pattern" colourings to your Tw editor.

The colour scheme means when you have correctly typed a known QtScript or Tw-Api object, function name, or property, it will change colour for you.

Correctly named functions and objects will be coloured when typed accurately as in the loose example below, while punctuation, brackets, and operators, or unknown and user functions you make yourself, will all generally be black.

Some non-functioning examples of this:–

Paired delimiters for matching/balancing

If you are between matching braces {} () [] these may be detected by using Crtl B on the keyboard, or Balance Delimiters on the Edit menu.

Created with the Personal Edition of HelpNDoc: Free iPhone documentation generator