It is currently September 29th, 2024, 3:37 pm

Skin Browsing Skin

General topics related to Rainmeter.
User avatar
exper1mental
Posts: 269
Joined: January 9th, 2013, 7:52 pm
Location: Clemson University

Skin Browsing Skin

Post by exper1mental »

A guy on deviantart proposed to me the idea of creating a skin for browsing and toggling Rainmeter skins. I'm trying to figure out if this is possible to do.

Using RainFile one could find an .ini file in an external window and then select it for opening in the rainmeter skin, however, I'm trying avoid the need for external windows (the whole point of this is to have a customizable skin browser so using external windows is self defeating).

I know one could create a list of skins with !ToggleConfig bangs but that isn't really a skin browser.

FileView would literally be perfect for this except for one stinkin' little problem. There's no way as far as I know to retrieve the path and name of a file from FileView usable in a !ToggleConfig bang nor would LeftMouseDoubleClickAction=!CommandMeasure "ChildMeasureName" "Open" work since that just opens the file in the default program, which is usually a text editor (not to mention if u set Rainmeter as the default program it tries to use the file as the settings.ini for Rainmeter)



The other thing I am trying to figure out is how to know what other skins are running. In %APPDATA%\Roaming\Rainmeter there's that Settings.ini that keeps track of what skins are active but I have no idea how to retrieve that information.



Summary of Questions
  • Is it possible to browse Rainmeter skins inside a Rainmeter skin such that when clicking on an .ini file it loads the skin in Rainmeter? How? (!Manage doesn't count b/c its a window not a customizable skin)
  • Is there a way to retrieve the information in Rainmeter's Settings.ini that tells which skins are active?

Thanks in advance!
Last edited by exper1mental on April 9th, 2014, 1:08 pm, edited 1 time in total.
Image
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5534
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Skin Browsing Skin

Post by eclectic-tech »

:confused: !Manage already shows a list of all skins, active skins, and layouts...

Curious to know how your idea would be different from what is currently available?

If a preview of the skins was availalbe, now that would be interesting...
User avatar
exper1mental
Posts: 269
Joined: January 9th, 2013, 7:52 pm
Location: Clemson University

Re: Skin Browsing Skin

Post by exper1mental »

eclectic-tech wrote::confused: !Manage already shows a list of all skins, active skins, and layouts...

Curious to know how your idea would be different from what is currently available?

If a preview of the skins was availalbe, now that would be interesting...
Yes I'm fully aware of that. The idea is that you could use a customizable skin to view currently running skins, load/unload skins, and/or layouts (which I had forgotten about 'till u mentioned them).


Preview of skin is an interesting idea, however, many skins would be hard to do that with because they are too big. There is no real way to make them fit without modifying the skin's code so the it can be resized. In addition, other skins define the skin W and H or set X and Y coordinates which would be challenging to find a workaround for.

And honestly, its layouts that I'd want a preview for. A skin I can enable/disable easily and quickly. A layout closes all previous skins and then loads its own. If I don't like a layout and didn't save my previous one I'm gonna be spendin' awhile going back and reloadin' my old skins. I think there is some way to close all current skins, load new ones and then reopen the previous ones when closing the new ones (I swear I saw this in several skins awhile ago but I can't remember how it was done).


Anyways, I'm thinking WebParser could be used for retrieving the info from the Rainmeter Settings.ini to know what skins are active. It could also be used to list skins that have be previously active. However, this still doesn't provide a way to view the skins folder such that when .ini files are clicked Rainmeter loads them.
Image
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5534
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Skin Browsing Skin

Post by eclectic-tech »

Okay... :headbang: ... I must have missed something ...
You just described !Manage, not how you would do it differently...

Anyways, Good luck on your quest (I'll just use !Manage)

:Watching:
..Watching..
...................
To see what
you can find!
User avatar
exper1mental
Posts: 269
Joined: January 9th, 2013, 7:52 pm
Location: Clemson University

Re: Skin Browsing Skin

Post by exper1mental »

eclectic-tech wrote:Okay... :headbang: ... I must have missed something ...
You just described !Manage, not how you would do it differently...

Anyways, Good luck on your quest (I'll just use !Manage)

:Watching:
..Watching..
...................
To see what
you can find!
!Manage opens the Rainmeter manager. The idea here is to create a customizable skin (unlike that popup window Rainmeter uses) that can list (some of) the same information. The ability to display active skins would be particularly handy for system info skins.

Anyways, I'm going to try to see if I can first figure out how to get WebParser to suit my needs. Is there a way to set it up such that it keeps looking for results until it finds no more entries? (I could just make a huge webparser RegExp that searches up to say 250 entries but then if you only had 200 skins listed in the Settings file there would be a crap-load of errors)


If I can figure that out, then I'm going to tackle bending FileView to my needs. If I can somehow access the filepath of entries it should be possible to .ini files into Rainmeter. The problem is that folders need to be openable since the list would be the Skins folder. Not sure how to set it up such that FileView can open folders yet if they are .ini files the skin takes over and loads them into Rainmeter.

If that doesn't work the next best thing I can think of is using the information in the Settings file to create a list based on active and previously active skins. The down side is that skins that have never been loaded into Rainmeter are not recorded in its Settings file, so they wouldn't be displayed.


Once those problems are solved I feel confident I will be able to put together a proof-of-concept skin (assuming I have the time).
Image
User avatar
killall-q
Posts: 307
Joined: August 14th, 2009, 8:04 am

Re: Skin Browsing Skin

Post by killall-q »

Here's some lua code that supposedly fills an array with the names of all active skins. I haven't actually tested it, but it's derived from related code that works.

Code: Select all

function Initialize()
   SkinArray = {}
end

function DetectActiveSkins()
   local RMini, i, SkinTemp = io.open(SKIN:GetVariable('SETTINGSPATH').."Rainmeter.ini", "r"), 1
   for line in RMini:lines() do
      if line:sub(1, 1) == "[" then
         SkinTemp = line:match("%[(.*)%]")
         for line in RMini:lines() do
            if line:sub(1, 1) == "[" then
               break
            elseif line:match("Active") then
               if tonumber(line:sub(8, 8)) > 0 then
                  SkinArray[i] = SkinTemp
                  i = i + 1
               end
               break
            end
         end
         break
      end
   end
   RMini:close()
end
Hope this is helpful.
User avatar
Mordasius
Posts: 1178
Joined: January 22nd, 2011, 4:23 pm
Location: GMT +8

Re: Skin Browsing Skin

Post by Mordasius »

I think you'll find that all those 'break's are breaking the function's functionality. I suggest trimming it down to:

Code: Select all

function Initialize()
   SkinArray = {}
end

function DetectActiveSkins()
   local RMini, num, SkinTemp = io.open(SKIN:GetVariable('SETTINGSPATH').."Rainmeter.ini", "r"), 1
    for line in RMini:lines() do
        if line:sub(1, 1) == "[" then 
		SkinTemp = line:match("%[(.*)%]")
	elseif line:match("Active") then
            if tonumber(line:sub(8, 8)) > 0 then
                SkinArray[num] = SkinTemp
                num = num + 1
            end
        end
   end
   RMini:close()
end
User avatar
exper1mental
Posts: 269
Joined: January 9th, 2013, 7:52 pm
Location: Clemson University

Re: Skin Browsing Skin

Post by exper1mental »

Currently I don't have the time to mess with this but if that lua code works it will be a huge step toward getting this idea into reality.

Anywho, I got finals and stuff to worry about right now :o
Image
User avatar
exper1mental
Posts: 269
Joined: January 9th, 2013, 7:52 pm
Location: Clemson University

Re: Skin Browsing Skin

Post by exper1mental »

killall-q wrote:Here's some lua code that supposedly fills an array with the names of all active skins. I haven't actually tested it, but it's derived from related code that works.

Code: Select all

function Initialize()
   SkinArray = {}
end

function DetectActiveSkins()
   local RMini, i, SkinTemp = io.open(SKIN:GetVariable('SETTINGSPATH').."Rainmeter.ini", "r"), 1
   for line in RMini:lines() do
      if line:sub(1, 1) == "[" then
         SkinTemp = line:match("%[(.*)%]")
         for line in RMini:lines() do
            if line:sub(1, 1) == "[" then
               break
            elseif line:match("Active") then
               if tonumber(line:sub(8, 8)) > 0 then
                  SkinArray[i] = SkinTemp
                  i = i + 1
               end
               break
            end
         end
         break
      end
   end
   RMini:close()
end
Hope this is helpful.
Where did you get this from? Neither lua script is working for me. (then again, I have only basic knowledge of lua scripts so it might just be my ignorance that's the problem :p )

It would be very helpful if I could see the working original your script is based off of so I can figure out what I'm doing wrong.


Anyways, here is what I did:

Code: Select all

[Rainmeter]
 Update=1000

[Variables]

;---Measures---
[ActiveSkins]
 Measure=Script
 ScriptFile=#@#ActiveSkins.lua
 DynamicVariables=1


;---Meters---
[ActiveSkinsList]
 Meter=String
 FontColor=255,255,255
 SolidColor=20,20,20,200
 FontFace=Segoe Ui Light
 FontSize=16
 MeasureName=ActiveSkins
 Text=%1
 AntiAlias=1
 DynamicVariables=1
ActiveSkins.lua of course being either one of the scripts you presented me.

The result is a 0 with a black semi-transparent background...
Image
User avatar
killall-q
Posts: 307
Joined: August 14th, 2009, 8:04 am

Re: Skin Browsing Skin

Post by killall-q »

It's based on this snippet I wrote a while ago. Mordasius's revision is good code. It's just that it doesn't do an awful lot on its own.

Well, since it would take a comparable amount of effort to explain how to write code around it, I just wrote the code. I hope this will teach you a lot about Lua. Feel free to embellish it.

• Shows a maximum of 50 skins.
• Left-click to toggle skins.
• Middle-click to open skin folders.

Image
You do not have the required permissions to view the files attached to this post.