Contents |
Introduction
nCore provides core utility functions which all other nModules use. It parses user input, reads configuration files, keeps track of existing windows, manages inter-modules communication, handles the dynamic text functionality, provides most of the `!`Bang commands, and the scripting library.
Loading
To load nCore you need to add a `LoadModule` line pointing to nCore in your configuration, like this:
LoadModule "$ModulesDir$nCore-0.5.dll"
Or, if you are using NetLoadModule:
- NetLoadModule nCore-0.5
Make sure to load nCore _before_ any other nModule(put the nCore `LoadModule` line above any other nModule `LoadModule` line in your configuration)
Dynamic Text Service
nCore manages the dynamic text language, which is used by some modules.
Syntax
Standard Functions
Most text functions are added by other modules
Time
Time prints the current time. It calls wcsftime directly, so the formatting string is as defined on MSDN.
Format:
Time(format = '%H:%M')
!WindowTitle
!WindowTitle retrieves the Window Title of the first window with the specified window class.
Format:
WindowTitle(wndClass)
Scripting
nCore lets you run !JavaScript code, using Google's v8 engine.
Loading script code
Script files are loaded by including `*nIncludeScript` lines in your configuration.
e.g.
- nIncludeScript "$ScriptDir$Taskbar.js"
Bang Commands
nCore provides the following bang commands for running scripts.
`!nAlertScript`
Executes a piece of JavaScript code and shows the result in a message box.
`!nExecScript`
Executes a piece of JavaScript code.
Standard Objects
Modules may provide their own global objects. These are the standard objects which are provided by nCore.
LiteStep
Provides functions for interacting with the LiteStep core.
Bangs =
Add
Execute
List
Remove
Evars
Get
LiteStep.Evars.Get(key)
Gets the value of the evar, as a string.
!GetNumeric
LiteStep.Evars.GetNumeric(key, default = 0.0)
Gets the numeric value of the evar.
Set
LiteStep.Evars.Set(key)
Sets the value of the evar.
Modules
List
Reload
Unload
Recycle
Refresh =
nCore
Provides functions for interacting with nCore.
Move
nCore.Move('WindowName', x, y, duration, 'easing')
Moves a window
Size
Position
Sample
The following is an excerpt from my own theme, which sizes the taskbar when the tray has changed size.
//
// Sizes the elements of the taskbar, as necessary.
//
LiteStep.Evars.Set('SystemTrayOnResize', '!nExecScript SizeTaskbarElements()');
function SizeTaskbarElements()
{
var taskbarWidth = LiteStep.Evars.GetNumeric("MainTaskbarWidth") - LiteStep.Evars.GetNumeric("TaskbarX") - LiteStep.Evars.GetNumeric("SystemTrayCurrentWidth") - LiteStep.Evars.GetNumeric("MainTaskbarClockWidth"); var taskbarHeight = LiteStep.Evars.GetNumeric("TaskbarHeight"); nCore.Size('Taskbar', taskbarWidth, taskbarHeight);
}