You are here: PSPad forum > English discussion forum > Looking for more information on file type plugins
Posted by: Professor Bernd | Date: 2021-05-28 13:15 | IP: IP Logged
Hello.
I'm trying to get familiar with the PSPad plugins in the folder "<PSPad>\Plugins\FileType\". I found some basic information in the "ReadMe.txt" and in the PSPad help file.
Has anyone already dealt with plugins, or knows where to find more detailed information?
Posted by: pspad | Date: 2021-05-28 14:29 | IP: IP Logged
Filetype plugins are used as interfacve between file and PSPad.
Plugin name = file extension
Plugin can be anything executable - EXE, CMD...
When file extension you want to open is equal any file type plugin PSPad call plugin to open file, plugin creates temporary file and PSPad open it. Save process is the same - file is saved from PSPad, send to plugin and plugin saves it.
For test, try to open any PDF from PSpad (for PDF there is no way how to file save into PDF). Plugin get text from PDF (if possible) and Open it in PSPad.
I use it for PDB files - (palm dabase) what is used for ebooks. Content is sored in records and compressed.
There can be plugin for anything, e.g. take DBF file, convert it into CSV and open in PSpad.
Posted by: Professor Bernd | Date: 2021-05-28 15:43 | IP: IP Logged
Thanks for taking the time to explain! I have already tested PDF files. Thanks for the tip.
What are there 2 plugin files for 1 file type for?
"<PSPad>\Plugins\Some.exe" <= I call it "higher plugin" to avoid misunderstanding.
"<PSPad>\Plugins\FileType\au3.bat" <= I call it "deeper plugin".
pspad:When file extension you want to open is equal any file type plugin PSPad call plugin to open file, plugin creates temporary file and PSPad open it. Save process is the same - file is saved from PSPad, send to plugin and plugin saves it.
So far I have not been able to get the deeper plugin to save a file. I used the defaults from the PSPad help, e.g..
if %1 == -L "%~d0%~p0..\some.exe" %2 %3
if %1 == -S "%~d0%~p0..\some.exe" %2 %3
And I have made many more attempts. I guess that ALL the functionalities have to be built in first by the user? But this is just a guess, maybe I did something wrong.
Is it possible to call a "some.exe" in any path with the deeper plugin, or does it have to be in the "<PSPad>\Plugins\" folder?
Posted by: pspad | Date: 2021-05-28 15:52 | IP: IP Logged
Imagine, I have file with U3 extension and I have some command line tool, placed in c:\anywhere\tool.exe
If I want to use this EXE, all what is necessary is place CMD called U3.cmd into .\plugin\FileType folder.
This plugin will contains 2 lines - one for load, second for save
if %1 == -L "c:\anywhere\tool.exe" %2 %3 some_other_parameters for tool.exe
if %1 == -S "c:\anywhere\tool.exe" %2 %3 some_other_parameters for tool.exe
Important is that PSPad sends 3 parameters: -L/-S for load/save and 2 for file names (original file/temporary file)
In the CMD file you can call your tool.exe with any other parameters what tool.exe needs, cause you need to tell your tool what to do with file you send it as parameter.
You can use one EXE for load and another for SAVE. In your CMD you can do anything.
When LOAD, PSPad sends original file and target file, tool.exe opens original file, make "something" and save it as target file what is opened by PSPad
When SAVE, PSpad sends working file and target file name, tool.exe opens working file, does "anything" and save it as target file
Edited 1 time(s). Last edit at 2021-05-28 15:57 by pspad.
Posted by: Professor Bernd | Date: 2021-05-28 16:33 | IP: IP Logged
I think I understood some things. What is still not clear to me, does PSPad generate the temp files or just the path information? Does the creation of the files have to be programmed in the plugin first?
For example I tested the following:
if %1 == -L "%~d0%~p0..\ParamTesting.exe" %2 %3
if %1 == -S "%~d0%~p0..\ParamTesting.exe" %2 %3
The ParamTesting.exe does nothing except display the overgen parameters. For example, when I load the file "Hello world.au3", the ParamTesting.exe shows me:
D:\D\PSPad4AutoIt3\test files\Hello world.au3
C:\Users\User1\AppData\Local\Temp\V76126848
Now I write a few characters and save Ctrl+S, then the ParamTesting.exe shows me:
C:\Users\User1\AppData\Local\Temp\R78610522
D:\D\PSPad4AutoIt3\test files\Hello world.au3
When saving, a different temp file is shown.
I can't find any of the temp files in the temp folder. Am I doing something wrong? What is the right way to do it?
Please don't put too much effort into the answers, it's NOT important. I'm sure I'll figure it out myself somehow. But if you have the time, I appreciate any information.
Edited 1 time(s). Last edit at 2021-05-28 16:39 by Professor Bernd.
Posted by: pspad | Date: 2021-05-28 16:47 | IP: IP Logged
when loading file, pspad sends real file location and temporary file location what awaits be created by plugin
when saving file, pspad sends temporary file location and target file and awaits that plugin opens temporary file, do it's job and saves file into target file
let's imagine I have file: c:\temp\file.xxx
when loading, pspad calls plugin with: "c:\temp\file.xxx" and "c:\temp\747213932.xxx"
plugin should open "c:\temp\file.xxx" decode or anything and save it as "c:\temp\747213932.xxx" and PSpad opens "c:\temp\747213932.xxx" and deletes temp file.
It's similar when saving. PSPad saves file as temp, plugin opens it, saves file as target and when finishes, PSPad deletes temp file.
Posted by: pspad | Date: 2021-05-28 16:55 | IP: IP Logged
Open any file and in PSpad save it as (F12) and change extension to .PDB
Then look on PDB file.
You can open it in PSpad and you will get your content back.
So you can create simple crypting/decrypting utility
Posted by: pspad | Date: 2021-05-28 17:08 | IP: IP Logged
And another ussage.
when saving, your bat can simply copy temp to target and compile it or zip it or anything else
if %1 == -S (
copy %2 %3
compile %3
)
it means it will compile result each time you save it.
so simple CMD plugin what does "nothing is:
if %1 == -L copy %2 %3
if %1 == -S copy %2 %3
Posted by: Professor Bernd | Date: 2021-05-28 17:39 | IP: IP Logged
This is a lot of information and I can test a lot. It may take a while, I may not get to it until next week.
Maybe this information could be included in the PSPad help, or maybe a user can provide a simple example with source code? In any case, thanks for the valuable information!
Posted by: pspad | Date: 2021-05-28 18:09 | IP: IP Logged
I will add more information into readme file
Editor PSPad - freeware editor, © 2001 - 2024 Jan Fiala, Hosted by Webhosting TOJEONO.CZ, design by WebDesign PAY & SOFT, code Petr Dvořák, Privacy policy and GDPR