It is currently March 29th, 2024, 3:43 pm

[Suggestion] Enhancements to Include

Report bugs with the Rainmeter application and suggest features.
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Suggestion] Enhancements to Include

Post by jsmorley »

Yincognito wrote: April 29th, 2020, 2:03 pm Ok, I'll try to walk on middle ground here and just ask, both element and jsmorley: isn't any way that such things can be implemented as a plugin? If it is, then problem solved: element will write it, and any user who wants to use it will use it, no strings attached. If it has a large following, maybe include it in the list of "built-in" Rainmeter plugins. Everybody goes home happy. ;-)

So, out of curiosity: could this behavior be implemented in a plugin, or is this changing how Rainmeter handles things too much and a Rainmeter fork is absolutely needed? :???:
I doubt that a fundamental change to how code is written in Rainmeter is going to be a good fit for a plugin. The point of a plugin is that Rainmeter tells the plugin to go out and do something, and then the plugin returns some result to Rainmeter that you can use. I don't see a logical way that a plugin can be written to alter how Rainmeter itself works. There may be some "think outside the box" approach that is not obvious to me.

Having said that, 3rd-party plugins are entirely up to the author. We have no role in them, and anyone is welcome to write any plugin they want and distribute it.
User avatar
Yincognito
Rainmeter Sage
Posts: 7031
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [Suggestion] Enhancements to Include

Post by Yincognito »

jsmorley wrote: April 29th, 2020, 2:10 pm I doubt that a fundamental change to how code is written in Rainmeter is going to be a good fit for a plugin. The point of a plugin is that Rainmeter tells the plugin to go out and do something, and then the plugin returns some result to Rainmeter that you can use. I don't see a logical way that a plugin can be written to alter how Rainmeter itself works.

Having said that, 3rd-party plugins are entirely up to the author. We have no role in them, and anyone is welcome to write any plugin they want and distribute it.
Well, not to alter, but to somehow write a single time those repeating measures / meters in the skin file and then refresh / update it (or something along those lines) and afterwards continue as usual. On that "refresh", the respective measures / meters will have their normal Rainmeter format (but they will have been already "duplicated"). The plugin could return the number of measures / meters created as number and string, for example (or the number and the string of the error code, if any).

I'm just trying to help here with a different approach to a matter bound to produce different opinions on it.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
jsmorley
Developer
Posts: 22628
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: [Suggestion] Enhancements to Include

Post by jsmorley »

Yincognito wrote: April 29th, 2020, 2:32 pm Well, not to alter, but to somehow write a single time those repeating measures / meters in the skin file and then refresh / update it (or something along those lines) and afterwards continue as usual. On that "refresh", the respective measures / meters will have their normal Rainmeter format (but they will have been already "duplicated"). The plugin could return the number of measures / meters created as number and string, for example (or the number and the string of the error code, if any).

I'm just trying to help here with a different approach to a matter bound to produce different opinions on it.
I think this whole idea of a "template" approach is a better fit for some fully external, 3rd-party utility that takes a skin with template features coded into it, and outputs a new skin that is "resolved" to be a normal Rainmeter skin with normal behavior. I doubt that I would ever use such a thing, as I predict that the trouble to use it will be more than the problem it purports to solve, but to each his own. I'm all for someone who wants to write such a thing.
User avatar
Yincognito
Rainmeter Sage
Posts: 7031
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [Suggestion] Enhancements to Include

Post by Yincognito »

jsmorley wrote: April 29th, 2020, 2:39 pm I think this whole idea of a "template" approach is a better fit for some fully external, 3rd-party utility that takes a skin with template features coded into it, and outputs a new skin that is "resolved" to be a normal Rainmeter skin with normal behavior. I doubt that I would ever use such a thing, as I predict that the trouble to use it will be more than the problem it purports to solve, but to each his own. I'm all for someone who wants to write such a thing.
Actually, it may be even a better fit for a "visual designer skin" (i.e. that creates other skins, visually). I know, this has been tried before (and as far as I know, it failed) ... but it wasn't tried by me. I just lack a "motivation sparkle" here, LOL, besides the usual "it's impossible, it won't work, I won't use it" stuff that normally drives me to make such attempts. I've been thinking about this the other day, though.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
DanDaBear
Posts: 109
Joined: February 23rd, 2018, 3:12 am
Location: United States

Re: [Suggestion] Enhancements to Include

Post by DanDaBear »

Well . . . :confused:

It didn't quite work with that other widget maker, probably more because of a strange UI and lack of help and tutorials.
(and a lack of updates) O.O
Never underestimate the power of stupid! :D
User avatar
Yincognito
Rainmeter Sage
Posts: 7031
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [Suggestion] Enhancements to Include

Post by Yincognito »

DanDaBear wrote: April 29th, 2020, 3:43 pm Well . . . :confused:

It didn't quite work with that other widget maker, probably more because of a strange UI and lack of help and tutorials.
(and a lack of updates) O.O
And that other "widget maker" was called...how? Cause I've seen various posts on this topic over the years, and I'm not sure which one you're referring to.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
DanDaBear
Posts: 109
Joined: February 23rd, 2018, 3:12 am
Location: United States

Re: [Suggestion] Enhancements to Include

Post by DanDaBear »

Xwidget.

It's still out there, even sold on Steam, but hasn't seen an update in a few years, although they have a bunch of different stuff recently created.

That's why I love Rainmeter.
It has a great community and is updated regularly!
Never underestimate the power of stupid! :D
User avatar
Yincognito
Rainmeter Sage
Posts: 7031
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [Suggestion] Enhancements to Include

Post by Yincognito »

DanDaBear wrote: April 29th, 2020, 6:20 pm Xwidget.

It's still out there, even sold on Steam, but hasn't seen an update in a few years, although they have a bunch of different stuff recently created.

That's why I love Rainmeter.
It has a great community and is updated regularly!
I see. Well, the application looks great, just like Rainmeter, but of course that visually designing the widgets is helpful. On the other hand, the code being in Javascript, is harder to understand for a non-programmer, compared to the INI format. Also, the fact that Rainmeter is free is a big bonus, along with the others you just mentioned. Despite the limitations of the INI format, my impression is that Rainmeter is more flexible.

But then, I was talking about attempts to "visualize" Rainmeter's skin building process, and not about other apps that visually create skins / widgets. I remember reading about such attempts here on the forum a couple of years ago, and those attempts encountered serious bottlenecks (probably due to a wrong approach, in my view) and became abandoned, or remained at the stage of a "great project" with no practical outcome (at least, not published here).
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5384
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: [Suggestion] Enhancements to Include

Post by eclectic-tech »

Yingonito referenced a post from a few years ago, that used a script measure with an option#/value# scheme to generate measures and meters. It was not very user-friendly because you had to convert each line of an 'ini' formatted measure or meter to an option#/value# format used in the script :uhuh:

I recently came across a script from alatsombath's Ocean visualizer, 'GenerateBands' which can create incremental sections from a template created in standard 'ini' measure/meter format.

I integrated the script into 2 repeating template generator skins:
'GenerateMeasures.ini' creates '#@#My#Template#Measures.inc' using a predefined template file or one you create.
'GenerateMeters.ini' creates '#@#My#Template#Meters.inc' using a predefined template file or one you create.

Those skins are setup and controlled by '@RepeatingVariables.inc' file. It contains the name of your template and the number of repeating measures/meters variables.

I created 2 example packages showing how you might use the repeating template generators in your own skins.

For audio visualizers which basically use 1 incremented measure and 1 related meter, it can create @include files with the number of repeating measures and meters, on the fly, for use in a visualizer. See 'RepeatingTemplateVisualizer' demo package.

For webparser skins, the demo can create title/link (2 indexes... but as many as needed can be added) measures and meters. It uses a few variables and a repeatable formula to automatically calculate the stringindex values. It can dynaically create any number of measures and meters on-the-fly. See 'RepeatingTemplateGoogleNews' package.

Here are the scripts. They are identical, except for the !Log entry. When used in a skin, I comment out opening the created file in an editor.
RepeatMeasureSection.lua

Code: Select all

-- RepeatSection v1.2
-- LICENSE: Creative Commons Attribution-Non-Commercial-Share Alike 3.0
-- Author: alatsombath from 'Ocean', 'Generate Bands' skin

function Initialize()
  local index, section, gsub, readFile = 1, {}, string.gsub, io.input(SKIN:ReplaceVariables(SELF:GetOption("ReadFile"))):read("*all")
  local substitution, lowerLimit, upperLimit = SELF:GetOption("Substitution"), SELF:GetNumberOption("LowerLimit") + 1, SELF:GetNumberOption("UpperLimit") + 1
  
  for i = lowerLimit, upperLimit do
    section[index], index = gsub(readFile, substitution, i-1), index + 1
  end
  
  local file = io.open(SKIN:ReplaceVariables(SELF:GetOption("WriteFile")), "w")
  file:write(table.concat(section, "\n\n"))
  file:close()
 
  SKIN:Bang('!Log', 'Created #@#My#Template#Measures.inc.')

-- Add comment to the line below to prevent opening the file in an editor
  SKIN:Bang('#@#My#Template#Measures.inc.')
    
end
RepeatingMeterSection.lua

Code: Select all

-- RepeatSection v1.2
-- LICENSE: Creative Commons Attribution-Non-Commercial-Share Alike 3.0
-- Author: alatsombath from 'Ocean', 'Generate Bands' skin

function Initialize()
  local index, section, gsub, readFile = 1, {}, string.gsub, io.input(SKIN:ReplaceVariables(SELF:GetOption("ReadFile"))):read("*all")
  local substitution, lowerLimit, upperLimit = SELF:GetOption("Substitution"), SELF:GetNumberOption("LowerLimit") + 1, SELF:GetNumberOption("UpperLimit") + 1
 
  for i = lowerLimit, upperLimit do
    section[index], index = gsub(readFile, substitution, i-1), index + 1
  end
  
  local file = io.open(SKIN:ReplaceVariables(SELF:GetOption("WriteFile")), "w")
  file:write(table.concat(section, "\n\n"))
  file:close()

  SKIN:Bang('!Log', 'Created #@#My#Template#Meters.inc.')

-- Add comment to the line below to prevent opening the file in an editor
  SKIN:Bang('#@#My#Template#Meters.inc.')
  
end
More details, a modular 'TemplateGenerators' method, and working examples are here: COMMUNITY TIP
User avatar
Yincognito
Rainmeter Sage
Posts: 7031
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: [Suggestion] Enhancements to Include

Post by Yincognito »

eclectic-tech wrote: April 30th, 2020, 12:45 am Yingonito referenced a post from a few years ago, that used a script measure with an option#/value# scheme to generate measures and meters. It was not very user-friendly because you had to convert each line of an 'ini' formatted measure or meter to an option#/value# format used in the script :uhuh:

I recently came across a script from alatsombath's Ocean visualizer, 'GenerateBands' which can create incremental sections from a template created in standard 'ini' measure/meter format.
Yeah, I knew about alatsombath's method too - his code is among the hardest to debug for this very reason, apart from the extreme abbreviations he uses to "shortcut" to bangs, measures and meters, LOL. I worked recently with one of his skins here.

That being said, these scripting methods, while doing what it has been requested, are relatively difficult to grasp for regular users. The interesting thing is that even power users / developer types like element weren't interested in them and prefer to push the feature into Rainmeter itself, which is a bit strange, given that the methods do accomplish what it was needed for them to accomplish. But then, besides the ability to do the job, simplicity is also a criteria for folks choosing one method over another...

Anyway, the more alternatives to do this thing, the better, so :thumbup: to all "contributors", including yourself. Personally, I find that this is the easiest approach on it, particularly the "one set" (actually, there can be "multiple sets" as well) approach of reusing measures with the help of dynamic variables. Unfortunately this can't be applied to meters, since each one of them has to exist individually, and be different from the rest, but then, this is only about creating / writing a skin, and that is generally a one time process, and copy pasting stuff isn't that hard, after all.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth