You can view the plugin info here...
Proof of Concept: Dynamic Menus/Meters
Edits:
11-29 Attached Brian's List skin (no cmd window using VBS/BATCH)... THANKS BRIAN!
11-30 Attached a second example skin; DynamicMenu using NirCmd... THANKS FRAGRANT.MONKEY!
12-5 DynamicMenu3.rmskin (Updated 12-5-2012) ...
Sort option expanded AND unique setting for each menu:
- Sortorder:
N By name (alphabetic)
S By size (smallest first)
E By extension (alphabetic)
D By date/time (oldest first)
G Group directories first
- Prefix to reverse order
I looked through the forum posts for anything on dynamic menus and could only find discussion and wishes.
So I am posting a possible way to obtain "dynamic menus" in Rainmeter.
Apologies if I missed something.
Would you like to be able to create a Rainmeter menu of executable items
that can be updated without having to change any code?
FEATURES
- - Turn Any Directory List(s) Into Rainmeter Menus or Launchers
- Gives "Windows Explorer Enabled" Drag'n Drop capability!!
- Able to change the menu contents in Windows Explorer, and have skin update itself with a single bang
- Unlimited number of "folder menus" with up to 99 links in each (but who needs unlimited links??)
- WebParsed text files created in the @Resources folder create indexes for ANY meter
- SIDE NOTE: Need help hiding the DOS command window... Anyone know an easy fix?
Using DOS commands and the WebParser Plugin, it is possible to create lists of any folder, parse it,
and generate string indexes to use in meters. You can add or delete files in the folder using Explorer,
and with one bang, update the Rainmeter view. I use similar code in the I-Radio station list, which led to this idea.
Using the DIR DOS command (with some parameters), we can read the directory of a folder and
create/overwrite the information from a folder into a text file that can be WebParsed.
The contents can be up to 99 (WebParser limit) Windows executable files.
Once we have the list text file, we can parse it into string indexes for any meters.
CREATING LISTS
There are 2 ways to create and parse lists:
1. One large folder (99 max items ~ Look at my I-Radio skin to see code differences) or
2. An unlimited number of folders with items in each (still 99 max items, but unlimited folders).
This example skin uses scheme 2; a number of files in each folders and rotates menu "pages" by changing
the folder location (changes the #ListNumber# variable).
For this example, I limited the number of items to 8 in each "menu".
And created 8 list folders; so 64 links are available in 1 small skin.
Example bang to create 1 list:
LeftMouseDoubleClickAction=[%COMSPEC% /c DIR /b /o:n "#RootConfigPath#@Resources\List_0\*.*"
>"#RootConfigPath#@Resources\Lists\zzzDir0List.txt"]
I am reading the directory of a folder I created previously in the @Resources\ folder named "List_0";
there are 7 items in that folder. This can be repeated as many times as needed (8 in my example)
to create the directory and lists used by the WebParser (you need to change the "List_0" portion
to the next folder name "List_1", "List_2" etc. in the additional bangs (see the code below).
Still with me???
Breaking down the bang portions (What we are doing):
- Run a DOS cmd.exe window: %COMSPEC%
Tell it to close when finished: /c
Setting options to read the specified directory: DIR /b /o:n
... note: /b = basic list ~ no headers/footers ... /o:n = order list by name
Directory to read: "#RootConfigPath#@Resources\List_0\*.*"
Sending the output of the DIR command: >
... note: > = overwrite the file ... >> = append to the file (not used in this scenario)
File to create: "#RootConfigPath#@Resources\Lists\zzzDir0List.txt"
keeps the menu folder "clean"; remember everything in the "List_#" folders will be parsed and show in the skin.
Now we have a simple text file listing each of the items on individual lines.
The text file (zzzDir0List.txt) in folder "Lists" looks like this:
- Calculator.lnk
CCleaner.lnk
My Computer.lnk
My Desktop.lnk
My Documents.lnk
My Recent Documents.lnk
Skins.lnk
PARSING THE LISTS
All we need to do now, is use the WebParser to read the "Lists" folder text files and create indexes.
The RegExp is looking for everything on 1 line as an index, we can use the RegExp '\n' (new line)
and '\r' (carriage return) to create a look-ahead to handle any number of items (up to 99)
and save it as a variable named GET. The look-ahead prevents formula failure if the number of items change.
The look-ahead variable would be: Get=(?(?=\n)\n(.*)\r.*)
And the RegExp: RegExp=(?siU)(.*)\r.*#GET##GET##GET##GET##GET##GET##Get#
#Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get#
#Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get#
#Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get#
#Get##Get##Get##Get##Get##Get##Get#
That's (almost) All Folk!
A couple of final notes before letting you "burst my bubble"!
SO HOW DOES THIS GIVE YOU DRAG 'N DROP?
I created a middle-mouse action on each indexed meter that opens the current list's folder
in Windows Explorer. Now you can add/delete items in that folder using the power of Windows Explorer.
UPDATING
Middle-click the "Page UP" arrow to update the lists.
This will open/close "several" UGLY command windows and update all of the directory lists.
** I NEED HELP HIDING THIS ACTION **
I tried Brian's VBS Wscript suggestion, but must have missed something, because it didn't work for me...
YOU NEED TO EDIT THE "LIST_#" FOLDERS IN THIS SKIN AND UPDATE TO HAVE ALL OF THE LINKS WORK.
Whatever you put in the folders will show in the skin; I use a substitute to remove the
common extensions (.exe, .com, .bat, .lnk, .url) so the item Titles look cleaner.
You could expand this, but in some cases, I want to know the extension...
TESTED ON WIN XP SP3
ON NEWER WINDOWS VERSIONS YOU MAY NEED TO MAKE CHANGES(?).
Enough talk! Here is the code for the included variable.inc file and the main Lists.ini
You will need to download the attached a sample List_1.0.rmskin to actually "see" the formatted menu,
but formatting is always up to you!.
Go ahead and try to "break" something.
Are we having fun yet?
Eclectic-Tech http:eclectic-tech.deviantart.com
Some code to look at:
File: @Resources\Options\Variables.inc
Code: Select all
[Variables]
ListNumber=5
SubExt=".exe":"",".com":"",".bat":"",".lnk":"",".url":""
;=======================================================================================
;---PANEL SETTINGS
;=======================================================================================
TextColor=255,255,255
TextAlpha=255
BorderColor=0,0,0
BorderAlpha=245
LineClr=0,0,0
LineAlpha=255
PositionBarWidth=4
PositionBarColor=255,255,255
PositionBarAlpha=128
;=======================================================================================
; -- SIDEBAR OPTIONS
;=======================================================================================
SBBorder=10
SBPanelWidth=200
;=======================================================================================
; -- FONTS AND TEXT COLOR OPTIONS
;=======================================================================================
FontName=Trebuchet MS
FontHeight=8
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
Group=ChangelingSidebar | EnigmaSidebar
MouseOverAction=[!ShowMeter Highlight]
MouseLeaveAction=[!HideMeter Highlight]
;!!!NOTE: You Must have Rainmeter 2.5.0 beta r1696 (Nov 18 2012) installed for scroll to work
; Update available at: http://rainmeter.net/cms/
; [ Variables ] ===========================================
[Variables]
@include=#@#Options\Variables.inc
TotalPages=[mList_1TotalPages]
Get=(?(?=\n)\n(.*)\r.*)
; [ Measures ] =============================================
[mLists]
Measure=Plugin
Plugin=Plugin\WebParser.dll
UpDateDivider=-1
URL="File://#@#Lists\zzzDir#ListNumber#List.txt"
RegExp=(?siU)(.*)\r.*#GET##GET##GET##GET##GET##GET##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get##Get#
StringIndex=1
[mListItem1]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=1
[mListItem2]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=2
[mListItem3]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=3
[mListItem4]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=4
[mListItem5]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=5
[mListItem6]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=6
[mListItem7]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=7
[mListItem8]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=8
[mListItem1Title]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=1
Substitute=#SubExt#
[mListItem2Title]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=2
Substitute=#SubExt#
[mListItem3Title]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=3
Substitute=#SubExt#
[mListItem4Title]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=4
Substitute=#SubExt#
[mListItem5Title]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=5
Substitute=#SubExt#
[mListItem6Title]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=6
Substitute=#SubExt#
[mListItem7Title]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=7
Substitute=#SubExt#
[mListItem8Title]
Measure=Plugin
Plugin=Plugin\WebParser.dll
URL=[mLists]
StringIndex=8
Substitute=#SubExt#
[mListFileCount]
Measure=Plugin
Plugin=Plugin\FolderInfo
Folder=#@#Lists
InfoType=FileCount
[mListNumber]
Measure=Calc
Formula=Trunc(mListFileCount)
IfAboveValue=0
IfAboveAction=[!SetVariable TotalPages ([mListFileCount]-1)]
DynamicVariables=1
[mPageUp]
Measure=Calc
Formula=(#ListNumber#-1<0)? #TotalPages#:(#ListNumber#-1)
DynamicVariables=1
[mPageDn]
Measure=Calc
Formula=(#ListNumber#+1>#TotalPages#)? 0:(#ListNumber#+1)
DynamicVariables=1
[mPagePositionPercent]
Measure=Calc
Formula=((#ListNumber#/#TotalPages#)*100)
MaxValue=100
DynamicVariables=1
; [ Styles ] =====================================
[Style1]
X=(#SBBorder#+2)
Y=15r
W=165
H=15
ClipString=1
StringAlign=LEFT
StringStyle=NORMAL
StringEffect=NONE
FontFace=#FontName#
FontSize=#Fontheight#
FontColor=#TextColor#,#TextAlpha#
FontEffectColor=#BorderColor#,#BorderAlpha#
SolidColor=0,0,0,1
[Style2]
X=(#SBBorder#+2)
Y=15r
W=165
H=15
ClipString=1
StringAlign=LEFT
StringStyle=BOLDITALIC
StringEffect=NONE
FontFace=#FontName#
FontSize=#Fontheight#
FontColor=#TextColor#,#TextAlpha#
FontEffectColor=#BorderColor#,#BorderAlpha#
SolidColor=0,0,0,64
[StyleBar]
FontSize=8
FontFace=#FontName#
FontColor=#BorderColor#,99
AntiAlias=1
ClipString=1
[StyleBarHi]
FontSize=8
FontFace=#FontName#
FontColor=#BorderColor#,255
AntiAlias=1
ClipString=1
; [ Meters ] =====================================
[Highlight]
Meter=Image
X=#SBBorder#
Y=0
W=(#SBPanelWidth#-#SBBorder#*2)
H=126
AntiAlias=1
SolidColor=0,0,0,32
Hidden=1
[BodyBack-Top]
Meter=Image
X=0
Y=0
W=#SBPanelWidth#
H=126
MouseScrollUpAction=[Play #@#Sounds\page-flip-2.wav][!WriteKeyValue Variables ListNumber [mPageUp] "#@#Options\Variables.inc"][!Refresh]
MouseScrollDownAction=[Play #@#Sounds\page-flip-2.wav][!WriteKeyValue Variables ListNumber [mPageDn] "#@#Options\Variables.inc"][!Refresh]
AntiAlias=0
DynamicVariables=1
Hidden=0
[DividerLine0]
Meter=Image
SolidColor=#LineClr#,#LineAlpha#
X=#SBBorder#
Y=0
W=(#SBPanelWidth#-#SBBorder#*2)
H=1
DynamicVariables=1
Group=Nav
[PageUp]
Meter=IMAGE
X=(#SBPanelWidth#-#SBBorder#*2)
Y=r
W=10
H=10
ImageName=#@#\Images\up
LeftMouseUpAction=[Play #@#Sounds\page-flip-2.wav][!WriteKeyValue Variables ListNumber [mPageUp] "#@#Options\Variables.inc"][!Refresh]
MiddleMouseUpAction=[Play #@#Sounds\2setsof4.wav][%COMSPEC% /c DIR /b /o:n "#RootConfigPath#@Resources\List_0\*.*">"#RootConfigPath#@Resources\Lists\zzzDir0List.txt"][%COMSPEC% /c DIR /b /o:n "#RootConfigPath#@Resources\List_1\*.*">"#RootConfigPath#@Resources\Lists\zzzDir1List.txt"][%COMSPEC% /c DIR /b /o:n "#RootConfigPath#@Resources\List_2\*.*">"#RootConfigPath#@Resources\Lists\zzzDir2List.txt"][%COMSPEC% /c DIR /b /o:n "#RootConfigPath#@Resources\List_3\*.*">"#RootConfigPath#@Resources\Lists\zzzDir3List.txt"][%COMSPEC% /c DIR /b /o:n "#RootConfigPath#@Resources\List_4\*.*">"#RootConfigPath#@Resources\Lists\zzzDir4List.txt"][%COMSPEC% /c DIR /b /o:n "#RootConfigPath#@Resources\List_5\*.*">"#RootConfigPath#@Resources\Lists\zzzDir5List.txt"][%COMSPEC% /c DIR /b /o:n "#RootConfigPath#@Resources\List_6\*.*">"#RootConfigPath#@Resources\Lists\zzzDir6List.txt"][%COMSPEC% /c DIR /b /o:n "#RootConfigPath#@Resources\List_7\*.*">"#RootConfigPath#@Resources\Lists\zzzDir7List.txt"][!Refresh]
ToolTipText=Middle-click to Update
DynamicVariables=1
Group=Nav
[PagePosition]
Meter=BAR
MeasureName=mPagePositionPercent
X=((#SBPanelWidth#-#SBBorder#*2+3)+(2-#PositionBarWidth#/2))
Y=-1R
W=#PositionBarWidth#
H=110
BarOrientation=VERTICAL
BarColor=#PositionBarColor#,#PositionBarAlpha#
Flip=1
DynamicVariables=1
Group=Nav
[PageDown]
Meter=IMAGE
X=(#SBPanelWidth#-#SBBorder#*2)
Y=116
W=10
H=10
ImageName=#@#Images\down
LeftMouseUpAction=[Play #@#Sounds\page-flip-2.wav][!WriteKeyValue Variables ListNumber [mPageDn] "#@#Options\Variables.inc"][!Refresh]
DynamicVariables=1
Group=Nav
[FileName1]
Meter=STRING
MeterStyle=Style1
MeasureName=mListItem1Title
Y=3
LeftMouseUpAction=["#@#List_#ListNumber#\[mListItem1]"][!SetOptionGroup Nav MeterStyle Style1][!SetOption FileName1 MeterStyle Style2][!Redraw]
MiddleMouseUpAction=["%windir%\explorer.exe" /e,#@#List_#ListNumber#]
DynamicVariables=1
Group=Nav
[FileName2]
Meter=STRING
MeterStyle=Style1
MeasureName=mListItem2Title
LeftMouseUpAction=["#@#List_#ListNumber#\[mListItem2]"][!SetOptionGroup Nav MeterStyle Style1][!SetOption FileName2 MeterStyle Style2][!Redraw]
MiddleMouseUpAction=["%windir%\explorer.exe" /e,#@#List_#ListNumber#]
DynamicVariables=1
Group=Nav
[FileName3]
Meter=STRING
MeterStyle=Style1
MeasureName=mListItem3Title
LeftMouseUpAction=["#@#List_#ListNumber#\[mListItem3]"][!SetOptionGroup Nav MeterStyle Style1][!SetOption FileName3 MeterStyle Style2][!Redraw]
MiddleMouseUpAction=["%windir%\explorer.exe" /e,#@#List_#ListNumber#]
DynamicVariables=1
Group=Nav
[FileName4]
Meter=STRING
MeterStyle=Style1
MeasureName=mListItem4Title
LeftMouseUpAction=["#@#List_#ListNumber#\[mListItem4]"][!SetOptionGroup Nav MeterStyle Style1][!SetOption FileName4 MeterStyle Style2][!Redraw]
MiddleMouseUpAction=["%windir%\explorer.exe" /e,#@#List_#ListNumber#]
DynamicVariables=1
Group=Nav
[FileName5]
Meter=STRING
MeterStyle=Style1
MeasureName=mListItem5Title
LeftMouseUpAction=["#@#List_#ListNumber#\[mListItem5]"][!SetOptionGroup Nav MeterStyle Style1][!SetOption FileName5 MeterStyle Style2][!Redraw]
MiddleMouseUpAction=["%windir%\explorer.exe" /e,#@#List_#ListNumber#]
DynamicVariables=1
Group=Nav
[FileName6]
Meter=STRING
MeterStyle=Style1
MeasureName=mListItem6Title
LeftMouseUpAction=["#@#List_#ListNumber#\[mListItem6]"][!SetOptionGroup Nav MeterStyle Style1][!SetOption FileName6 MeterStyle Style2][!Redraw]
MiddleMouseUpAction=["%windir%\explorer.exe" /e,#@#List_#ListNumber#]
DynamicVariables=1
Group=Nav
[FileName7]
Meter=STRING
MeterStyle=Style1
MeasureName=mListItem7Title
LeftMouseUpAction=["#@#List_#ListNumber#\[mListItem7]"][!SetOptionGroup Nav MeterStyle Style1][!SetOption FileName7 MeterStyle Style2][!Redraw]
MiddleMouseUpAction=["%windir%\explorer.exe" /e,#@#List_#ListNumber#]
DynamicVariables=1
Group=Nav
[FileName8]
Meter=STRING
MeterStyle=Style1
MeasureName=mListItem8Title
LeftMouseUpAction=["#@#List_#ListNumber#\[mListItem8]"][!SetOptionGroup Nav MeterStyle Style1][!SetOption FileName8 MeterStyle Style2][!Redraw]
MiddleMouseUpAction=["%windir%\explorer.exe" /e,#@#List_#ListNumber#]
DynamicVariables=1
Group=Nav
[DividerLine1]
Meter=Image
SolidColor=#LineClr#,#LineAlpha#
X=#SBBorder#
Y=125
W=(#SBPanelWidth#-#SBBorder#*2)
H=1
DynamicVariables=1
[MetaData]
Author=Eclectic-Tech (http://eclectic-tech.deviantart.com)
Version=0.1
License=Creative Commons Attribution-Noncommercial-Share Alike 3.0
Description=Lists v1.0 (Proof of Concept)
(Sample RMSKINs)
Lists.rmskin
DynamicMenu3.rmskin (Updated 12-5-2012) ...
Sort option expanded AND unique setting for each menu!