6 The Autostart Script
When QCad is started, it automatically searches for a script to
execute. This script can be used to for example customize the
user interface of QCad.
Location
The autostart script is always named 'autostart.qs' and must
be placed in a location where QCad can find it. This is typically
the sub directory 'scripts' of your QCad installation or the
directory '.qcad' in your home directory
(e.g. /home/tux/.qcad/autostart.qs).
Adding Custom Toolbars
The autostart script can be used to add custom toolbars with
buttons to quickly access scripts or insert parts from the
part library.
The following script adds two toolbars to the user interface of
QCad. One that features buttons to run some selected scripts and
one with some buttons to insert parts from the part library.
function main() {
// add a toolbar with some script buttons:
var tbScripts = new ToolBar("Scripts Tool Bar");
tbScripts.addScriptButton("entities01.qs");
tbScripts.addScriptButton("layer01.qs");
tbScripts.addScriptButton("math01.qs");
tbScripts.addScriptButton("plot01.qs");
tbScripts.addScriptButton("spiral.qs");
// add a toolbar with some block buttons:
var tbBlocks = new ToolBar("Blocks Tool Bar");
tbBlocks.addBlockButton("misc/t-part.dxf");
tbBlocks.addBlockButton("misc/screw.dxf");
}
|