It is currently October 22nd, 2021, 9:54 pm

Notepad++: Snippets for Rainmeter

Plugins and Addons popular with the Community
User avatar
jsmorley
Developer
Posts: 22374
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Notepad++: Snippets for Rainmeter

Post by jsmorley »

Note that if you have already gone though this process to get RainLexer working properly, there is no need to go through all of this again. Simply use Plugin Admin in Notepad++, and install the "Snippets" plugin. You won't get any error, there is at least one "default" library included, I think an ASCII table or something. Then download the .zip file in the first post of this thread, unzip it, and using the functionality in Snippets in Notepad++, import one or both sets of Rainmeter snippets. Bob's your uncle...
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4436
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Notepad++: Snippets for Rainmeter

Post by eclectic-tech »

Thanks... I edited the post so users can skip your steps if they already have it upgraded. :great:
User avatar
Yincognito
Rainmeter Sage
Posts: 4070
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Notepad++: Snippets for Rainmeter

Post by Yincognito »

Just checked it out - amazing, especially great for IfConditions and IfMatch, as I always find it inconvenient to have to write those 4 options (I almost always use IfConditionMode=1 and IfMatchMode=1). :rosegift: I even added a - Add Measure Disable and - Add Meter Hidden to the Rainmeter Templates section, and works great! :thumbup:

What I would get rid of (and I will, for sure) is the amount of useless comments about the functions in a Calc measure. In my view, a link to the Rainmeter.net page regarding formulas would be more suitable (just like for the other measures), otherwise you spend more time deleting stuff you don't need than actually writing the needed line(s).

Just one question: you said somewhere that the changes made by the user will be "remembered" and won't be overwritten on updating. Care to elaborate a little bit?

Brilliant work! :great: :thumbup: :rosegift:
User avatar
balala
Rainmeter Sage
Posts: 13340
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Notepad++: Snippets for Rainmeter

Post by balala »

Yincognito wrote: September 24th, 2020, 1:27 pm (I almost always use IfConditionMode=1 and IfMatchMode=1)
Take care of this, It can give you a lot of headache, crashing many times the whole Rainmeter.
User avatar
jsmorley
Developer
Posts: 22374
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Notepad++: Snippets for Rainmeter

Post by jsmorley »

I don't think there is any particular danger with using IfConditionMode=1 or IfMatchMode=1, other than the fact that in the grand scheme of things, that can be pretty "expensive", since in many cases you are constantly firing whatever actions you define on them, on every single skin update, rather than just when the condition changes from true to false or false to true. It depends a bit on what the actions are doing of course, but it's never going to be efficient to constantly set "A" to "A" for example.

What I think balala is alluding to is that if you are not somewhat careful, and you for instance to have any kind of !Refresh included in the action(s), that can easily cause an endless loop that can in fact bring Rainmeter to its knees.

Those options have their uses, and can really be needed in some cases, but I'd be hesitant to just default to them...
User avatar
Yincognito
Rainmeter Sage
Posts: 4070
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Notepad++: Snippets for Rainmeter

Post by Yincognito »

balala wrote: September 24th, 2020, 1:33 pm Take care of this, It can give you a lot of headache, crashing many times the whole Rainmeter.
jsmorley wrote: September 24th, 2020, 1:36 pm I don't think there is any particular danger with using IfConditionMode=1 or IfMatchMode=1, other than the fact that in the grand scheme of things, that can be pretty "expensive", since in many cases you are constantly firing whatever actions you define on them, on every single skin update, rather than just when the condition changes from true to false or false to true. It depends a bit on what the actions are doing of course, but it's never going to be efficient to constantly set "A" to "A" for example.

What I think balala is alluding to is that if you are not somewhat careful, and you for instance to have any kind of !Refresh included in the action(s), that can easily cause an endless loop that can in fact bring Rainmeter to its knees.

Those options have their uses, and can really be needed in some cases, but I'd be hesitant to just default to them...
Yep, agreed, but then I also almost always set UpdateDivider=-1 on the measures where the conditions or match testing happens, in effect always updating them on demand. I guess in this case the danger is if not entirely canceled, at least alleviated, right?
User avatar
balala
Rainmeter Sage
Posts: 13340
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Notepad++: Snippets for Rainmeter

Post by balala »

Yincognito wrote: September 24th, 2020, 1:47 pm Yep, agreed, but then I also almost always set UpdateDivider=-1 on the measures where the conditions or match testing happens, in effect always updating them on demand. I guess in this case the danger is if not entirely canceled, at least alleviated, right?
Yeah, if the UpdateDivider is set to -1, then indeed, the danger is much smaller.
User avatar
balala
Rainmeter Sage
Posts: 13340
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Notepad++: Snippets for Rainmeter

Post by balala »

jsmorley wrote: September 24th, 2020, 1:36 pm What I think balala is alluding to is that if you are not somewhat careful, and you for instance to have any kind of !Refresh included in the action(s), that can easily cause an endless loop that can in fact bring Rainmeter to its knees.
Exactly. But not just a !Refresh can cause problems, a simple !Update (as well as an !UpdateMeasure *) also can, but there might be some other cases as well, which I now didn't take into account.
User avatar
Yincognito
Rainmeter Sage
Posts: 4070
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Notepad++: Snippets for Rainmeter

Post by Yincognito »

balala wrote: September 24th, 2020, 2:12 pm Exactly. But not just a !Refresh can cause problems, a simple !Update (as well as an !UpdateMeasure *) also can, but there might be some other cases as well, which I now didn't take into account.
True. I'm careful with that as well. That being said, I have the habbit of simulating a short FOR..NEXT loop in Rainmeter, in certain scenarios, and I actually used updating the said measure in an IfCondition (yeah, I know, I don't follow some recommendations, my bad, but then if you always follow recommendations you'll never get the chance to experiment and find new ways of doing things). Bottom line, as long as you're very careful with the logic of the code, endless loops - and I have some experience with those - won't happen. But yeah, by all means, the recommendation is a perfectly valid one. :thumbup:
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4436
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Notepad++: Snippets for Rainmeter

Post by eclectic-tech »

Yincognito wrote: September 24th, 2020, 1:27 pm ...
Just one question: you said somewhere that the changes made by the user will be "remembered" and won't be overwritten on updating. Care to elaborate a little bit?

Brilliant work! :great: :thumbup: :rosegift:
Hmm... I just read through this thread and did not find that "remembered" statement, but if it was said, it is NOT correct.

Updates will overwrite any changes you made.

I will be looking through the current snippets to update and add new features; I will look at adding the ones you mentioned and agree that the Calc measure snippet is far too verbose. I will remove everything except the documentation link. Thanks!