It is currently January 20th, 2019, 10:21 pm

Dynamically Creating Meters

Discuss the use of Lua in Script measures.
sdomi003
Posts: 2
Joined: December 21st, 2018, 6:30 am

Dynamically Creating Meters

sdomi003 » December 21st, 2018, 6:56 am

Posted this in the general help, but there may be a scripting solution to this.

Say I want to create a calendar to show my schedule for the week.
To make this, I will need many square shape meters along with the proper date measures.
Instead of making a meter for each square in my calendar, is there a way to have a general square meter that I can create duplicates of in a lua script?
More specifically, is there a way to create a lua script so that I can say "create a new square at this position and with these features"?
This will also allow me to dynamically add boxes in another skin idea that lets the user write in different tasks for the day.
Thanks!
User avatar
Brian
Developer
Posts: 1828
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: Dynamically Creating Meters

Brian » December 21st, 2018, 7:06 am

Generally speaking, this cannot be done with lua or Rainmeter itself. There is no way to dynamically create any Rainmeter objects (measures, meters, etc.) and have it immediately display the skin you want.

While it is possible to have a lua script write to a skin ini file and build a skin that can then be loaded after the lua part is finished...I would not recommend this way as it will just lead to overthinking the problem and spending lots of time getting it to work correctly without hideous endless loops, or constant refreshes.



What I would recommend is to determine the maximum number of meters that would be needed to display your calendar like you want it...then use use Show/HideMeter bangs to display the content you want. This way you can focus on getting your calendar done and looking the way you want to, instead of trying to figure out how to build a overly complex lua script that builds a skin on the fly.

-Brian
sdomi003
Posts: 2
Joined: December 21st, 2018, 6:30 am

Re: Dynamically Creating Meters

sdomi003 » December 22nd, 2018, 3:56 am

Brian wrote:
December 21st, 2018, 7:06 am
Generally speaking, this cannot be done with lua or Rainmeter itself. There is no way to dynamically create any Rainmeter objects (measures, meters, etc.) and have it immediately display the skin you want.

While it is possible to have a lua script write to a skin ini file and build a skin that can then be loaded after the lua part is finished...I would not recommend this way as it will just lead to overthinking the problem and spending lots of time getting it to work correctly without hideous endless loops, or constant refreshes.



What I would recommend is to determine the maximum number of meters that would be needed to display your calendar like you want it...then use use Show/HideMeter bangs to display the content you want. This way you can focus on getting your calendar done and looking the way you want to, instead of trying to figure out how to build a overly complex lua script that builds a skin on the fly.

-Brian
Thank you