Rainmeter Samurize utilities forum

Rainmeter
plugins
& mods

Plugins / mods for the Rainmeter desktop widget app

Rainmeter Macro mod

This mod (modified Rainmeter) is a custom build, which adds code macros. A macro is a way to programmatically expand code. This mod offers these features:

  • Copies: measures and meters dynamically created from a single template
  • Tables: table layout for data that needs to be shown as a table
  • Name tokens: names of measures and meters automatically broken into smaller pieces, so they can be used to reference other elements
  • Line spacing: adjustable distance between lines of text
  • Fixes a bug in Rainmeter for correct meter display

Copies

Demo spectrum analyzer

Rainmeter often needs repeating chunks of code, e.g. for forecast days in a weather skin, bars in a spectrum analyzer etc. This mod can automatically create such copies from one template: a single "master" element (measure or meter).

To make copies from the template, add a property called "Copies=", specifying how many copies you want. This mod will replace the template with copies. In the template's name (and wherever else within the template you wish), use a macro variable called <COPY>. When copies are created, <COPY> will contain the current copy number, starting at 0. For 5 copies, <COPY> will range from 0 to 4. This variable can be used to adjust the position of each copy, to access indexes etc. This sample skin (download below) creates a 14-bar spectrum analyzer from just 2 templates: an AudioLevel band measure and a bar meter (19 lines).

[msBand<COPY>]
Measure=Plugin
Plugin=AudioLevel
Parent=MeasureAudio
Type=Band
BandIdx=<COPY>
Copies=14

[mBand<COPY>]
Meter=Bar
MeasureName=msBand<COPY>
X=(<COPY>*#off#+3)
Y=5
W=10
H=#height#
BarImage=#@#Images\SpecBar.gif
SolidColor=#bgCol#
BarOrientation=Vertical
Copies=14

Note: this mod creates measures or meters that do not exist directly in the code. If you want to access them at runtime, refer to the numbered copies, not the template (it won't exist anymore). Copies (and the <COPY> variable) apply only to the template element they're in. If you want two sets of interacting copies, create an equal number of copies from two templates.

Right now, there's a hard-coded sanity check of 128 copies maximum, so you don't end up with 1000s of copies by typing an extra digit.

Tables

Numeric data (e.g. crypto balances) often require display in a table. To avoid the drudgery of laying out all the info in a table, this mod can create a table of data from a single template meter.

To create a table from a template meter, add properties called "Rows=" and "Columns=", specifying the table dimensions you want. This mod will replace the template with a copy for each table cell. In the template's name (and wherever else within the template you wish), use macro variables called <ROW> and <COL>. When copies are created, <ROW> and <COL>will contain the current row and column numbers, starting at 0. For 5 rows <ROW>, will range from 0 to 4. These variables can be used to adjust the position of each copy, to access indexes etc. The sample skin in the CoinTracking plugin shows data as a table.

[mCoin<ROW><COL>]
Meter=String
X=(<COL>*#offX#)
Y=(<ROW>*#offY#)
W=10
H=#offY#
Text=Custom info for row <ROW>, column <COL>
Rows=5
Columns=3

Name tokens

For a skin that's easy to maintain, you need a consistent, uniform naming scheme for measures and meters, e.g. mCoin0Value, mCoin0Gain. This way, elements can be cross-referenced. To make this easy, this mod splits the name of an element into tokens (smaller bits), which can be used as variables to refer to other elements. The meter name is broken into tokens as follows:

  • The beginning of the meter name starts a token of lowercase letters
  • A capital letter starts a token of lowercase letters
  • A digit starts a token of a series of digits
  • Optionally, separators can be used: "." (a period), "_" or "-" (a hyphen)
Token examples

mCoin12Value

m | Coin | 12 | Value

mDay5Temp

m | Day | 5 | Temp

measure.Separated_By-Separators

measure | Separated | By | Seperators
 

This mod supports 8 tokens. To access them, use variables called #SEC... (short for "section name"), ranging from #SEC0#, #SEC1#... to #SEC7#. The last token (whatever its actual index) is always stored as #SECLAST#.

This code example below uses a table layout. It shows how the table cells correctly report their row and column indexes with section name tokens.

Token demonstration

 
[mCoin<ROW><COL>]
Meter=String
X=(<COL>*#offX#)
Y=(<ROW>*#offY#)
W=30
H=#offY#
Text=#SEC2##SEC3#
Columns=3
Rows=5

Line spacing

To use less screen space, this mod can reduce the spacing between lines of text. Use InlineSetting, and add a 4th parameter to CharacterSpacing: 1=100% (default line spacing), 0.85=85% etc.

InlineSetting=CharacterSpacing | 0 | 0 | -1 | 0.85	

Download

Change log:

4.4.0.3321

First release: copy macro added

4.4.0.4

Fixed a meter bug in the meter official Rainmeter

4.4.1.0

Added tables and name tokens

4.4.2.0

Added line spacing adjustment

"Macro mod" added to differentiate this build from the official release.

Macro mod

Rainmeter_x64_4.4.2.0_macro_mod.zip (2.6 MB)

Rainmeter_x32_4.4.2.0_macro_mod.zip (2.1 MB)

Demo skins (incl. a 14-bar spectrum analyzer and the WeatherHub forecast skin converted to uses copies (i.e. it works with this mod):

Macro_mod_demo_skins_1.1.rmskin (4 KB)

Released under GNU GPL 2
Source code available on request.