-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisionboard.lua
More file actions
65 lines (54 loc) · 2.03 KB
/
Copy pathvisionboard.lua
File metadata and controls
65 lines (54 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
local lastPaths = {}
local numSlots = 7
local isUpdating = false
function Initialize()
print("VisionBoard: Initializing Liquid Glass v8.1...")
for i=1, numSlots do
lastPaths[i] = ""
-- Pre-initialize variables to prevent '...' ToolTips
SKIN:Bang('!SetVariable', 'Name' .. i, 'Loading...')
end
end
-- This function is called by each measure's OnChangeAction or manually
function CheckUnique(slot)
if isUpdating then return end
local measure = SKIN:GetMeasure('MeasureImage' .. slot)
if not measure then return end
local currentPath = measure:GetStringValue()
if currentPath == "" then return end
-- Check for exact path duplicates in other slots
local isDuplicate = false
for i=1, numSlots do
if i ~= slot and lastPaths[i] == currentPath then
isDuplicate = true
break
end
end
if isDuplicate then
isUpdating = true
SKIN:Bang('!UpdateMeasure', 'MeasureImage' .. slot)
isUpdating = false
else
lastPaths[slot] = currentPath
-- Filename Cleaning: Strip path and extension
local filename = currentPath:match("^.+\\(.-)%..-$") or currentPath:match("^.+/(.-)%..-$") or currentPath:match("(.+)%..-$") or currentPath
-- Push to Rainmeter
SKIN:Bang('!SetVariable', 'Name' .. slot, filename)
SKIN:Bang('!UpdateMeter', 'MeterImage' .. slot)
print("VisionBoard: Slot " .. slot .. " verified: " .. filename)
end
end
function Update()
-- Ensure initial filenames are processed if measures are already populated
if lastPaths[1] == "" then
for i=1, numSlots do CheckUnique(i) end
end
end
function ShuffleAll()
print("VisionBoard: Shuffling all slots...")
for i=1, numSlots do
SKIN:Bang('!UpdateMeasure', 'MeasureImage' .. i)
-- CheckUnique will be triggered by OnChangeAction or manually if needed
CheckUnique(i)
end
end