It is currently April 19th, 2024, 11:29 pm

LuaLauncher

Skins to open folders and launch applications and websites
User avatar
XANCI
Posts: 104
Joined: September 18th, 2011, 6:37 am
Location: Nanjing, China

LuaLauncher

Post by XANCI »

A Launcher that display 3 items per page, you can add ANY number of items
Click "P" to previous page and "N" to next page
The last page's width depend on how many items(1 to 3) it has

First a Settings.inc file:

Code: Select all

[Variables]
LauncherNum=N
Launcher1=
LauncherIcon1=
LauncherPath1=
Launcher2=
LauncherIcon2=
LauncherPath2=
...
...
...
LauncherN=
LauncherIconN=
LauncherPathN=
"LauncherX" is the item's Name which will display as ToolTipText
"LauncherIconX" is the item's Icon path
"LauncherPathX" is the item's Path
Make sure "LauncherNum" matches your items below

In your skin file:

Code: Select all

[Rainmeter]

[Metadata]

[Variables]
@Include=#CURRENTPATH#Settings.inc
Slot=3
SlotNum=1
Page=1
Dock1=#Launcher1#
DockIcon1=#LauncherIcon1#
DockPath1=#LauncherPath1#
Dock2=#Launcher2#
DockIcon2=#LauncherIcon2#
DockPath2=#LauncherPath2#
Dock3=#Launcher3#
DockIcon3=#LauncherIcon3#
DockPath3=#LauncherPath3#

[ms]
Measure=Script
ScriptFile="#CURRENTPATH#Launcher.lua"

[bg]
Meter=IMAGE
W=(56+(#SlotNum#*48))
H=88
DynamicVariables=1
SolidColor=00000080

[p]
Meter=STRING
X=20
Y=20
W=16
H=16
SolidColor=ffffff
DynamicVariables=1
Text="P"
LeftMouseUpAction=!Execute [!SetVariable Page #PP#][!HideMeterGroup Dock][!Update]

[n]
Meter=STRING
X=20
Y=52
W=16
H=16
SolidColor=ffffff
DynamicVariables=1
Text="N"
LeftMouseUpAction=!Execute [!SetVariable Page #PN#][!HideMeterGroup Dock][!Update]

[l1]
Group=Dock
Meter=IMAGE
ImageName=#DockIcon1#
X=36
Y=20
W=48
H=48
DynamicVariables=1
ToolTipText="#Dock1#"
LeftMouseUpAction=!Execute ["#DockPath1#"]

[l2]
Group=Dock
Meter=IMAGE
ImageName=#DockIcon2#
X=R
Y=r
W=48
H=48
DynamicVariables=1
ToolTipText="#Dock2#"
LeftMouseUpAction=!Execute ["#DockPath2#"]

[l3]
Group=Dock
Meter=IMAGE
ImageName=#DockIcon3#
X=R
Y=r
W=48
H=48
DynamicVariables=1
ToolTipText="#Dock3#"
LeftMouseUpAction=!Execute ["#DockPath3#"]
Launcher.lua file:

Code: Select all

function Initialize()
  iSlot=tonumber(SKIN:GetVariable("Slot"))
  iLN=tonumber(SKIN:GetVariable("LauncherNum"))
  sL={}
  sLI={}
  sLP={}
  for i=1,iLN do
    sL[i]=tostring(SKIN:GetVariable("Launcher"..i))
    sLI[i]=tostring(SKIN:GetVariable("LauncherIcon"..i))
    sLP[i]=tostring(SKIN:GetVariable("LauncherPath"..i))
  end
  iPN=math.floor(iLN/iSlot)+1
  iPR=iLN%iSlot
  SKIN:Bang("!SetVariable PageNum "..iPN)
  SKIN:Bang("!SetVariable PageRemain "..iPR)
end

function Update()
  iPage=tonumber(SKIN:GetVariable("Page"))
  if iPage<iPN then
    for i=1,iSlot do
      SKIN:Bang("!SetVariable Dock"..i.." \""..sL[(iPage-1)*3+i].."\"")
      SKIN:Bang("!SetVariable DockIcon"..i.." \""..sLI[(iPage-1)*3+i].."\"")
      SKIN:Bang("!SetVariable DockPath"..i.." \""..sLP[(iPage-1)*3+i].."\"")
      SKIN:Bang("!SetVariable SlotNum "..iSlot)
      SKIN:Bang("!ShowMeter l"..i)
    end
  else
    for i=1,iPR do
      SKIN:Bang("!SetVariable Dock"..i.." \""..sL[(iPage-1)*3+i].."\"")
      SKIN:Bang("!SetVariable DockIcon"..i.." \""..sLI[(iPage-1)*3+i].."\"")
      SKIN:Bang("!SetVariable DockPath"..i.." \""..sLP[(iPage-1)*3+i].."\"")
      SKIN:Bang("!SetVariable SlotNum "..iPR)
      SKIN:Bang("!ShowMeter l"..i)
    end
  end
  if iPage-1==0 then
    SKIN:Bang("!SetVariable PP "..iPN)
  else
    SKIN:Bang("!SetVariable PP "..iPage-1)
  end
  SKIN:Bang("!SetVariable PN "..iPage%iPN+1)
end