Autoexec system

From Miranda NG
Jump to: navigation, search
Other languages:
English • ‎русский

Autoexec is a system for batch addition of multiple settings to the database. The goal is to provide a flexible ability for bulk-setting of many database settings.

Put code to autoexec_<anyname>.ini (name template can be changed, see "[AutoExec]" section of Mirandaboot.ini) and place that file to Miranda root folder.

Also see Mirandaboot.ini for additional autoexec-related settings.

;This is a sample file showing how the autoexec system works

;This file does *not* become part of the database - it is only read
;and imported by Miranda, then discarded.

;Short intro to the capabilities of the Miranda database:
;The database stores 4 different types of information:
; 1) Contacts. These are merely structural, they don't actually store any
;    info themselves. There is a 'me' contact and zero or more real contacts.
;    Each contact contains settings and events.
; 2) Settings. These are quadruplets: module name, setting name, data type,
;    data value. More on these later because that's what all this is about.
; 3) Events. History events and suchlike.
; 4) Module names. An internal structure for space efficiency. Forget this, I
;    just included it for completeness.

;The autoexec system is for changing settings belonging to the 'me' contact,
;because that's where all the preferences are stored. Nothing else can be
;altered using this file.

;You should probably use DbEditor++ because that can display and change all
;the settings in the database (including those belonging to the other contacts).

;More on those quadruplets:
;Consider, for example, the background bitmap of the contact tree. If you look
;in the options you'll see that there are three basic settings controlling it:
;Whether to use that or a solid color, the filename to use, and a mass of
;check boxes.
;These three categories map on to three database settings that you can see
;with database editor.
;"CLC" is the module name, and "UseBitmap", "BkBitmap", "BkBmpUse" are the
;setting names.
;Clicking on the "UseBitmap" setting you'll see the final two parts of the
;setting: type and value. In this case type is a byte, and the value is 0 or 1.

;Everything is case sensitive, and the type of the setting is just as important
;as its name. If you give a setting a type other than that which Miranda
;expects things will go badly. There are five different types: byte, word,
;double-word are the three numeric ones of various magnitudes; strings for
;textual data; and blobs for variable-length binary data.

;The encoding of "BkBmpUse" will probably have you baffled, so you can either
;peruse clcopts.c to figure out what's going on or, far easier, set what you
;want and just copy the value down.

;Note about security:
;This file clearly makes it possible to sneak in a change to a user's ICQ
;login server, for instance, while you change their color scheme. This could
;be used to glean UINs and passwords without their knowledge.
;Miranda has security in place that means the user will be warned before any
;changes are made to the settings of modules that are not known to be safe.
;The default settings and how to change them are documented in mirandaboot.ini

;Note that some parts of Miranda won't notice changes on-the-fly, so it will
;be necessary to restart Miranda before the changes take effect.

;The example that follows, then, is a heavily annotated script to provide a
;new background bitmap for the contact list and set the text color to yellow.
;It's assumed that you have packaged background.bmp in a .zip with this file
;and provided the user with instructions to dump both files in their Miranda

[CLC]   ;settings from here to the next change will apply to the "CLC" module.

;Assign the byte 1 to the setting "UseBitmap". b stands for byte.
;There must be no space around the equals sign or after the b.

;s stands for string.

;w is for word. The 3 I just copied out of database editor. It means stretch to
;width and height.

;Font0 is the 'standard contacts' setting on the list text options page.
;Font0Col, therefore, is the color setting of that font.
;d is for dword.
;The 0x prefix is signifying this number as hexadecimal. You can also prefix
;0 to use octal, and negative numbers work too.
;ffff00 you will recognize as yellow from your HTML experience.

;--end of example--

;There are two data types that haven't been used here: blob and delete.
;Delete is easy: just use e.g., "BkColour=l" (that's a lowercase L). This example
;causes the background solid color to be the same color as the users choice
;for 3D objects facing straight on, e.g., most of the taskbar.
;Blobs are of the form "Font=n03 f5 2a" where those are hexadecimal pairs
;representing each byte to set.

;The final thing to note is that there are settings that it is possible to
;change using this file, but that you'll wreck consistency if you do so. It's
;obvious the settings where this is the case, the typical example being
;the whole CListGroups module. Luckily you don't want to change any of the
;settings where this is a problem.

;--Module and setting deletion--

;This module will be completely removed with all the settings it contains.
;Starting from 0.95.12 you can also use "-" instead of "?".

;Only this particular setting will be removed.