LanguageTool
- Author
- Message
-
Offline
- Posts: 4
- Joined: Mon Jan 18, 2016 9:33 pm
LanguageTool
Would it be possible to make a plugin that integrates akelpad with languagetool? I know most users are coders, but it'd be practical to have nonetheless. Langtool can work as a server, so it wouldn't be necesary to pack a 80mb big plugin, but just to make one that connects to the server.
-
Offline
- Posts: 1162
- Joined: Sun Oct 20, 2013 11:44 am
Elgog
Maybe plugin Log? Menu item (check path):
File must be saved.
When you click the line with error for example "1.) Line 4, column 10, Rule ID: WHITESPACE_RULE" AkelPad to rearrange the cursor to the position line 4, column 10.
If you want do not save the file, then you or someone need to write a script.
Maybe plugin Log? Menu item (check path):
Code: Select all
-"LanguageTool EN" Call("Log::Output", 1, `java -jar "C:\Temp\LanguageTool-3.2\languagetool-commandline.jar" -l en`, "", "^\d+.\) Line (\d+), column (\d+)", "/GOTOLINE=\1:\2", -1, -1, 8192)
When you click the line with error for example "1.) Line 4, column 10, Rule ID: WHITESPACE_RULE" AkelPad to rearrange the cursor to the position line 4, column 10.
If you want do not save the file, then you or someone need to write a script.
-
Offline
- Posts: 1162
- Joined: Sun Oct 20, 2013 11:44 am
Vile file encoding... It works without problems only with English:
Call("Log::Output", 1, "PROGRAM", "WORKDIR", "REPATTERN", "RETAGS", INPUTCODEPAGE, OUTPUTCODEPAGE, FLAGS, "ALIAS").
For other languages and for all we need to write a script.
?
It should work with OEM, ANSI, UTF-8.
Or UTF-8 only:
?
Call("Log::Output", 1, "PROGRAM", "WORKDIR", "REPATTERN", "RETAGS", INPUTCODEPAGE, OUTPUTCODEPAGE, FLAGS, "ALIAS").
For other languages and for all we need to write a script.
Code: Select all
var hMainWnd = AkelPad.GetMainWnd();
var nCodePage = AkelPad.GetEditCodePage(0);
AkelPad.Call("Log::Output", 1, `java -jar "C:\\Temp\\LanguageTool-3.2\\languagetool-commandline.jar" -l ru`, "", "^\\d+.\\) Line (\\d+), column (\\d+)", "/GOTOLINE=\\1:\\2", nCodePage, nCodePage, 8192)
It should work with OEM, ANSI, UTF-8.
Or UTF-8 only:
Code: Select all
var hMainWnd = AkelPad.GetMainWnd();
var WshShell = new ActiveXObject("WScript.Shell");
var pTextRange = AkelPad.GetTextRange(0, -1, 3);
var pTempFile;
pTempFile = WshShell.ExpandEnvironmentStrings("%Temp%") + "\\temp.txt";
AkelPad.WriteFile(pTempFile, pTextRange, -1, 65001, false);
AkelPad.Call("Log::Output", 1, "java -jar \"C:\\Temp\\LanguageTool-3.2\\languagetool-commandline.jar\" -l ru \"" + pTempFile + "\"", "", "^\\d+.\\) Line (\\d+), column (\\d+)", "/GOTOLINE=\\1:\\2", 65001, 65001, 8192)
-
Offline
- Posts: 53
- Joined: Wed Dec 09, 2015 6:33 pm
Skif_off Déjà vu: http://akelpad.sourceforge.net/forum/vi ... 5579#25579
-
Offline
- Posts: 4
- Joined: Mon Jan 18, 2016 9:33 pm
Since I don't want to create a new thread just for this: How do I give the selected text as part of a command?
I tried with
but there wasn't any output.
I tried with
Code: Select all
"WordNet"
{
"Overview" Call("Log::Output", 1, `f:\Program Files\WordNet\2.1\bin\wn.exe \s -over`)
}
-
Offline
- Posts: 1162
- Joined: Sun Oct 20, 2013 11:44 am
Elgog
For example:
And save:
as WordNet.js (use ANSI encoding) and move in \AkelFiles\Plugs\Scripts\.
P.S. Read comments.
For example:
Code: Select all
"WordNet"
{
"Overview" Call("Scripts::Main", 1, "WordNet.js")
}
Code: Select all
//WordNet.js
//
// If not installed WordNet: manually edit line 20
var hMainWnd = AkelPad.GetMainWnd();
var pSelText = AkelPad.GetSelText();
var wsh = new ActiveXObject("WScript.Shell");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var pWordNet;
// Search path WordNet in Registry
// x86 OS
if (KeyExists("HKEY_LOCAL_MACHINE\\SOFTWARE\\WordNet\\2.1\\") == 1)
pWordNet = wsh.RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\WordNet\\2.1\\WNHome") + "bin\\wn.exe";
// x64 OS
else if (KeyExists("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\WordNet\\2.1\\") == 1)
pWordNet = wsh.RegRead("HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\WordNet\\2.1\\WNHome") + "bin\\wn.exe";
// Or
else
pWordNet = "F:\\Program Files\\WordNet\\2.1\\bin\\wn.exe";
if (! fso.FileExists(pWordNet))
{
AkelPad.MessageBox(hMainWnd, "WordNet not found!\n\nCheck path \"pWordNet\".", WScript.ScriptName, 48 /*MB_ICONWARNING*/);
WScript.Quit();
}
// If selected text
if (pSelText.length > 1)
AkelPad.Call("Log::Output", 1, "\"" + pWordNet + "\" \"" + pSelText + "\" -over", pWordNet.replace("\\wn.exe", ""), "", "", -1, -1, 40 /*Append text to the end|Wrap lines*/);
function KeyExists(key)
{
var key2;
try
{
key2 = wsh.RegRead(key);
return 1;
}
catch (err)
{
return 0;
}
}
P.S. Read comments.
-
Offline
- Posts: 53
- Joined: Wed Dec 09, 2015 6:33 pm
Excuse me for some kind of offtopic maybe, but where should we add this:
?
Code: Select all
"WordNet"
{
"Overview" Call("Scripts::Main", 1, "WordNet.js")
}