It is currently October 1st, 2020, 3:32 am

Notepad++: Snippets for Rainmeter

Plugins and Addons popular with the Community
User avatar
eclectic-tech
Rainmeter Sage
Posts: 4128
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Notepad++: Snippets for Rainmeter

Post by eclectic-tech »

NOTE: This is a copy of instructions posted by JSMorley as it relates to installing Snippets by Frank Fesevur after upgrading to version 7.6 of Notepad++

Note that some folks may run into issues with this upgrade. Here are some tips on how to get things working clean and smooth...

First, if you are installing Notepad++ for the first time, ignore this post.
Second, if you already upgraded and have Rainlexer working, use NPP to install Snippets from "Plugins", "Plugin Admin".

If you have been running Notepad++ for some time, one of the things that can (and almost certainly will) happen is that there will be a lot of unneeded, and even harmful, "debris" hanging around from earlier versions. Over the years they have moved where things are stored and what files are used for "settings", and the old stuff is often left behind. This can cause massive problems going forward!

So here is the current layout of where things are with Notepad++ as of version 7.6

The application, 64bit or 32bit depending on what you installed:
C:\Program Files\Notepad++
C:\Program Files (x86)\Notepad++

Settings for the application. Changes you make to styles and such:
C:\Users\YourName\AppData\Roaming\Notepad++
This can also be accessed in Explorer with %APPDATA%\Notepad++

The files in this folder that contain the settings you might want to keep and protect, so you don't have to start over are:

config.xml
contextMenu.xml
functionList.xml
langs.xml
session.xml
shortcuts.xml
stylers.xml
plugins\config\NppSnippets.sqlite

Before you start doing anything, make a backup copy of just these settings files. We are going to want to put them back at the end.

.dll executable files for plugins:

C:\Users\YourName\AppData\Local\Notepad++\plugins
This can also be accessed in Explorer with %LOCALAPPDATA%\Notepad++\plugins

If it even exists, there is no need to back up anything in this folder. This is a new folder location as of Notepad++ 7.6.

Ok, now we want to completely uninstall Notepad++. After doing so ensure that the following folders don't exist:
C:\Program Files\Notepad++
C:\Program Files (x86)\Notepad++
C:\Users\YourName\AppData\Roaming\Notepad++
C:\Users\YourName\AppData\Local\Notepad++

Then install the latest (7.6 as of this writing) version of Notepad++ from https://notepad-plus-plus.org/

32bit or 64bit is up to you, although be aware that while Snippets supports either, many other older 3rd-party plugins you might be using may not work, and require an upgrade (if one exists) if you change from using 32bit Notepad++ to 64bit Notepad++.

Then install Snippets from Snippets.
His instructions need updating, so to install manually,
copy NppSnippets.dll to C:\Users\YourName\AppData\Local\Notepad++\plugins\NppSnippets folder (you may need to create this folder),
and copy NppSnippets.sqlite to C:\Users\YourName\AppData\Roaming\Notepad++\plugins\config folder and (re)start Notepad++.

OR you can use NPP and from the "Plugins" menu, select "Plugin Admin"; look for "Snippets" plugin in the list, it is by Author: Frank Fesevur and version 1.4. If you use the "Plugin Admin" method, the plugin may generate an error message "Cannot find database" and close; don't panic, follow the next step to copy NPPSnippets.sqlite back to their original locations.

Then copy the settings files you backed up above, back to their original locations in C:\Users\YourName\AppData\Roaming\Notepad++

Start Notepad++ and edit a skin to be sure Snippets is working and that any changes you made to the style or colors in that, or in Notepad++ in general, are still what you want. They should be.
User avatar
jsmorley
Developer
Posts: 21398
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: 4128
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
Posts: 2643
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: 11458
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: 21398
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
Posts: 2643
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: 11458
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: 11458
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
Posts: 2643
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: