Quantcast
Channel: Rainmeter Forums
Viewing all articles
Browse latest Browse all 1575

Help: Rainmeter Skins • Re: Help me : Want to display data only match with system date

$
0
0
An example of pagination.
preview.png
Usage:
- Scroll the mouse wheel to switch pages on the skin.
- Right-click on the skin to show context menu.
💡 Menu > Skin scaling > 100%-500%
pagination.png
Pagination.Example.zip
The default location of the Skins: C:\Users\%UserName%\Documents\Rainmeter\Skins


How the skin works:

* book1.txt (modified)

Code:

<01>2024-01-01</01><02>Adam</02> <03>Adam.jpg</03> <04>New York</04> <05>4.30 PM</05> <06>6.30 PM</06> <07>1/4/2024 10.30 PM</07><01>2024-01-02</01><02>Clain</02> <03>Clain.jpg</03> <04>California</04> <05>12.50 PM</05> <06>3.30 PM</06> <07>1/15/2024 5.55 PM</07>...<01>2024-12-31</01><02>William</02> <03>William.jpg</03> <04>Kansas</04> <05>11.25 PM</05> <06>1.25 PM</06> <07>1/18/2024 09.30 PM</07>
* Lua table

Code:

_items = {{ '2024-01-01', 'Adam', 'Adam.jpg', 'New York', '4.30 PM', '6.30 PM', '1/4/2024 10.30 PM' },{ '2024-01-02', 'Clain', 'Clain.jpg', 'California', '12.50 PM', '3.30 PM', '1/15/2024 5.55 PM' },...{ '2024-12-31', 'William', 'William.jpg', 'Kansas', '11.25 PM', '1.25 PM', '1/18/2024 09.30 PM' }}
Read the text file (exported by Excel book) using Lua and generate a Lua table. 📗 Lua Scripting (Rainmeter Docs)

A part of @Resources\Scripts\init.lua

Code:

local number_of_elements = 7------------------------------------------------------------------------------- Read the text file (output by Excel book) and generate an items table-- **UTF-8 encoded file or ANSI ONLY**---- @see  Input and Output| https://www.lua.org/manual/5.1/manual.html#5.7-- @see  Tables Tutorial | http://lua-users.org/wiki/TablesTutorial-----------------------------------------------------------------------------local function read_book_data(file_path)    _items = {}    local fh = io.open(file_path, 'r')    if fh then        local t        for line in fh:lines() do            if line:find('^%s*<01>') then                t = {}                for i=1, number_of_elements do                    table.insert(t, line:match(string.format('<%02d>(.-)</%02d>', i, i)) or '')                end                table.insert(_items, t)            end        end        fh:close()    endend------------------------------------------------------------------------------- Increase or Decrease item_index number by mouse wheel scrolling then call load_item()---- @param  {number}  d      scrolling direction. `-1` scroll up, `1` scroll down.-- @example                 MouseScrollDownAction=[!CommandMeasure MeasureScript "background_scroll(1)"]--                          MouseScrollUpAction=[!CommandMeasure MeasureScript "background_scroll(-1)"]---- @see    Creating a "counter" or "loop" by jsmorley | https://forum.rainmeter.net/viewtopic.php?p=96827#p96827-----------------------------------------------------------------------------function background_scroll(d)    if 0<#items then        load_item((item_index + d - 1) % #items + 1)    endend

Statistics: Posted by nek — Yesterday, 7:14 pm



Viewing all articles
Browse latest Browse all 1575

Trending Articles