npp-plugins / pork2sausage Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v2.0
License: GNU General Public License v2.0
Pork to Sausage is a plugin for Notepad++ that allows you to transform selected text from one format to another. For example, you can convert clear text to zip text encoded in base64, or decode an encoded URL to a clear URL. Some transformations are easy to implement in C or C++, while others can be done more easily in Java or .NET using their rich libraries. The idea behind Pork to Sausage is to create a plugin that can pass any selected text to a command-line program as input and replace the selected text with the output of the program. To use the plugin, you need to write a transformer in your favorite language. The transformer should take input from a file or stdin and generate output to a file or stdout. To configure your transformer, you can edit the pork2sausage.ini file. The plugin supports up to 20 commands that can be customized to suit your needs. Enjoy your sausage ;) Don Ho [email protected]
See my issue at this url:
https://community.notepad-plus-plus.org/topic/24566/notepad-says-it-cannot-find-the/3?_=1687965416263
I previously posted a question and got some help, “https://community.notepad-plus-plus.org/topic/24060/how-to-add-or-install-pork2sausage-to-notepad”, that I was not able to figure out how to use that help to fix the Pork2Sausage installation problem.
So, I uninstalled and reinstalled Notepad++.
Now, when I open Notepad++, I get a message telling me that “C:\Users\marc\AppData\Roaming\Notepad++\plugins\Config\pork2Sausage.ini” is not present.
I did a search for files I thought are significant and found the following files:
C:\Program Files\Notepad++\plugins\pork2sausage\pork2sausage.dll
C:\Program Files\Notepad++\plugins\pork2sausage\Config\pork2Sausage.ini
So, the pork2Sausage.ini file and the pork2sausage.dll are both present on my PC.
The page “https://npp-user-manual.org/docs/plugins/#install-plugin-manually” does not explain how to fix a plugin installation that did not get done right, which I think is what happened in my case.
Marc
### SOLUTION:
Peter Jones' gave me a solution (at the same URL) and I'm sharing his solution here so that you folks fix this problem so that other people don't have to struggle.
Here's peter's solution
PeterJones Jun 12, 2023, 8:23 PM
@Marc-Hankin ,
I ran some experiments. It had nothing to do with version, nor with whether it was local-config or AppData config, like I was originally thinking when I asked for the Debug Info.
Apparently, that plugin does not automatically install its config file when it gets installed, and instead just stores it in a subdirectory of the plugin’s installation directory.
You will want to exit the Notepad++ application; then copy C:\Program Files\Notepad++\plugins\pork2sausage\Config\pork2Sausage.ini to C:\Users\marc\AppData\Roaming\Notepad++\plugins\Config\pork2Sausage.ini; then restart Notepad++ – the error message should stop at this point, and Plugins > Pork to Sausage will now list some example converters, as well as a command to edit the User Commands. (Please note: unless you have an ancient version of java where Don had them, and have a working directory already created under Don’s personal user name, the default pork2sausage.ini commands will not work for you.)
Other readers of this topic: since your username is likely not marc, you should copy the source ini to %AppData%\Notepad++\plugins\Config\pork2Sausage.ini, which uses the Windows OS Envioronment Variable %AppData% 🛈 to find the right hiearchy based on the active username and settings.
pork2sausage/Config/pork2Sausage.ini
Line 1 in a14648b
Pork to sausage
with Pork to Sausage
[consistency].pass a
with passes
giving passes selected test
[grammar].an
between program as
and input argument
[grammar].by the result of
with with the output from
[grammar].pork2sausage/Config/pork2Sausage.ini
Line 3 in a14648b
the full path of the program to launch
with The full path and name of the program to launch.
[clarity].pork2sausage/Config/pork2Sausage.ini
Line 4 in a14648b
the whole command to call the program
with The full command line required to invoke the program.
[clarity].pork2sausage/Config/pork2Sausage.ini
Line 5 in a14648b
the path of working directory
with The full path of the working directory.
[clarity, grammar].pork2sausage/Config/pork2Sausage.ini
Line 6 in a14648b
The full path name
with The full path and name
[clarity].Pork to sausage
with Pork to Sausage
[consistency].pork2sausage/Config/pork2Sausage.ini
Line 7 in a14648b
the full path name
with The full path and name
[clarity].Pork to sausage
with Pork to Sausage
[consistency].replace selected text by
with replace the selected text with
[grammar].content of indicated
with contents of the defined
[grammar].supposed to be
[clarity].Pork to sausage
with Pork to Sausage
[consistency].stdout of program
with stdout of the program
[grammar].pork2sausage/Config/pork2Sausage.ini
Line 12 in a14648b
$(TIMSTAMP
) with $(TIMESTAMP)
[error].the Timestamp
with The timestamp
[grammar].Pork to sausage
with Pork to Sausage
[consistency].on the bigining
with at the beginning
[grammar, spelling] or at the start
[clarity].varible used
with variable is used
[spelling, grammar].Pork to sausage
with Pork to Sausage
[consistency].unicity of
with uniqueness of the
[clarity, grammar].pork2sausage/Config/pork2Sausage.ini
Line 14 in a14648b
you program
with your program
[spelling].It is not possible to use environment variables or relative paths for the keys progPath and workDir in the configuration file. This is a problem especially when one wants to use a portable version of Notepad++. Moreover, to be able to use environment variables could be helpful when it comes to creating configurations that can be used for 32 bit and 64 bit versions of Notepad++.
Both issues can be solved easily by doing appropriate Win32 API calls. As the base path for relative paths used in the configuration file the plugins config dir could be used. This would be a reasonable solution and there already exists the NPPM_GETPLUGINSCONFIGDIR message in the Notepad++ plugin API to retrieve this path.
I have installed version 2.1 of this plugin in Notepad++ version 7.5.4 (64-bit).
When I check using Plugin Manager version 1.4.11, listed under the Installed tab there is a row with the following details:
and when I highlight the row or tick its check-box, this is displayed in the message box below:
Unknown plugin - please let us know about this plugin on the forums
Stability:
If I then switch to the Available tab in Plugin Manager, the plugin is also listed here, as follows:
and highlighting the row or checking its box gives this in the message area:
Transforms selected text to through a transformer (a console program which takes inputs then generates output). Up to 20 transformers can be defined
Author: Don Ho
Source: https://github.com/npp-plugins/pork2sausage
Latest update: 16 Sep 2016 Remove the dependecy issue
I'm not sure whether this is a Plugin Manager issue, but the difference in the names of the plugin between the two tabs in Plugin Manager is worth noting.
Also, note the typo in the message that displays on the Available tab in Plugin Manager:
Transforms selected text to through ...
should be simply Transforms selected text through ...
.
There are inconsistencies in the names used in reference to this plugin, as follows:
pork2sausage
Pork to Sausage
Pork2Sausage
Pork to Sausage
Pork to Sausage
Pork2Sausage
in the Available tabPork to Sausage
in the Installed tabCan these references (and any others I have missed) all be reconciled to a single consistent name? I suggest using Pork to Sausage
for all references that are visible to the end-user, as this provides the most clarity.
When progOutput is set and replaceSelection=false, it would be useful to add a variable to load the output file.
It would be useful e. g. when one is using Notepad++ to build simple commands and don't actually want the selection to be overwritten, but still want to immediately view the output. More specifically, it would have been great when I used RegEx in Notepad++ to turn the output from some data fetched via REST API into a curl command for a new fetch.
I installed Pork2sausage plug-in and decided to check how it goes along with Python. So, I created the following pork2sausage.ini file:
[Python]
progPath=C:\Users\Sergey\AppData\Local\Programs\Python\Python39\python.exe
progCmd=python $(SELECTION)
workDir=C:\Users\Sergey\AppData\Local\Programs\Python\Python39\
Should I select 3+2 and give command to make the sausage, I have got error message with text in Chinese, depicted at the screen-shot.
I would appreciate some one telling me what is wrong with my ini-file (really, I have no clue about it, everything seems to be correct) and what this message means.
@donho You may want to consider replacing the Chinese text with its English equivalent. And the last, but not the least, thank you very much for great text editor.
Since N++ 7.6 TextFX isn't supported even in 32-bit and I would really like to be able to use the insert timestamps feature (like standard Notepad). It works...but requires me to create a selection first, which slows progress quite a bit.
Would you please enable Pork2Sausage to work without an active selection?
I could see using this for other system-state or diagnostic information as well where the "pork" is coming from outside Notepad++.
Empty
When I select multiple lines, only the first line goes to the command in Windows. Tested this with two round-trip commands. Windows command prompt requires a special escape of multi-line commands. Wat do?
java
with Java
[proper case].Pork2Sausage
with Pork to Sausage
[consistency].un Notepad++ plugin
with a Notepad++ plugin
[English].zip
with zips
[grammar].unzip
with unzips
[grammar].put
with writes
[grammar].A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.