Find, Replace, and Count
-
You only need python script plugin, it contains the python library.
Create a new script by using
plugin->pythonscript->new script
give it a meaningful name and save it.
Put the following content into it.from Npp import editor add_this = 1000000 - 60 def add_60(m): global add_this add_this += 60 return add_this editor.replace('FZ', add_60)
Save it. Done.
Execute it viaplugin->pythonscript->scripts->NAME_YOU_CHOSE
-
If you need it more often you can assign a keyboard shortcut
or create a toolbar icon by using the configuration menu from pythonscript plugin menu and shortcut mapper. -
@Ekopalypse Yes, I would be using a lot, and I follow the steps and I don’t see how to choose the name I saved it as
OK, I found how to add short cuts, but can’t find my saved name under your steps
-
@Ekopalypse all I see is Sample and Startup
-
did you click on User Scripts?
and before you can assign a shortcut or see the icon in the toolbar, you have to restart npp, because npp reads/retrieves this information only at startup.
-
@Ekopalypse Yes
-
Yes? It works now or still not seeing it?
-
@Ekopalypse sorry, don’t see it, and yes I click on user
-
Can you post your debug info which is available from the
?
menu? -
@Ekopalypse Notepad++ v7.9.1 (64-bit)
Build time : Nov 2 2020 - 01:07:46
Path : C:\Program Files\Notepad++\notepad++.exe
Admin mode : OFF
Local Conf mode : OFF
OS Name : Windows 10 Pro (64-bit)
OS Version : 2004
OS Build : 19041.746
Current ANSI codepage : 1252
Plugins : ComparePlugin.dll MarkdownViewerPlusPlus.dll mimeTools.dll NppConverter.dll NppExport.dll NppMarkdownPanel.dll NppToolBucket.dll PythonScript.dll _CustomizeToolbar.dll -
@Javier-Rivas said in Find, Replace, and Count:
Local Conf mode : OFF
means that the scripts will be saved in
%APPDATA%\notepad++\plugins\config\pythonscript\scripts
You can copy and past this into an explorer and it should get you there. Do you see your script there?
-
Could it be that you named your script without the .py extension?
-
@Ekopalypse Yes, I got it now, I have to add the .py to it did not know that
Thank you very much I have my shortcut and it worked perfectlyI thought just name it and save
-
@Javier-Rivas said in Find, Replace, and Count:
I thought just name it and save
I was sloppy there, sorry.
-
@Ekopalypse Hey so is there a way to edit what was saved in notepad++, because as weeks go by I would have to edit the script and add a new timestamp to it, the 100000 represents a timestamp so it was just an example, everything else works great
-
Yes of course, press CTRL and click the script.
Works as long as you do NOT assign a CTRL+KEY shortcut. -
By the way, is the timestamp calculable?
-
@Ekopalypse Yes, it is calculable, what I do is I go to the website and get a timestamp and I add 60 sec to each stamp, I have 10 timestamps all 1 minute apart
-
I ASSUME that this can also be automated.
If you are interested and the site is public, we can try it.
But, sorry, no more today - it’s already 01:00 AM here.
Good night everyone. -
@Ekopalypse said in Find, Replace, and Count:
Could it be that you named your script without the .py extension?
@Javier-Rivas said:
Yes, I got it now, I have to add the .py to it did not know that
I’m confused here, because if you don’t (and you shouldn’t) add any extension to the name in the SaveAs box, PythonScript itself will add the
.py
extension to it.
Well, I mean you can type it if you want to, but why waste the time it takes to do that?