Request New Plugin
-
Can some one provide a plugin like calculator…
for example …
1+2+3=6
pressing Enter key and give me the answer… -
You can use PythonScript for that. The console is loved by people for its strong mathematics features.
-
@Daniel-Fuchs said in Request New Plugin:
PythonScript
As Im waiting this feathure as in pluging type or integrated into the next version…
-
@Asif-Mute said in Request New Plugin:
As Im waiting this feathure as in pluging type or integrated into the next version…
You are under the mistaken impression that a post in this forum will magically assign someone to work on it, and that any request made will be immediately fulfilled in the next release.
Plugins are contributed by anyone who wants to write a plugin; even if this forum were the official feature request system for Notepad++ (which this forum isn’t), the Notepad++ core developers aren’t the ones who develop plugins for Notepad++.
Besides, as @Daniel-Fuchs said, there is already a plugin that will do that. If you have PythonScript plugin installed, you can show the PythonScript console, type in
1+2+3
and it will print6
. You can easily copy/paste from or into the PythonScript console.So instead of waiting for something that’s not going to happen, why not just install the plugin that will already do what you described?
-
@Asif-Mute said in Request New Plugin:
Can some one provide a plugin like calculator…
I wrote a calculator in javascript for the time (The jN plugin is used.) (I am a Freelancer, I need to calculate the working time.) Adds and subtracts formulas like:
“15, 2.20, 20, 25”
“20.30 - 1.30”
where the comma is converted to “+”
The code is below. Use as a template./* —Складывает минуты в форме: 15, 2.20, 20, 25 = 3.20 где 3,20 - 3 часа, 20 минут 35, 50, 40, 55, 45, 40 */ function stringToMinuts(psStr) { var parseRes = 0; tmS = psStr.split("."); if (tmS.length == 1) { parseRes = parseInt(tmS[0]); if(parseRes < 5) { parseRes *= 60; } } else { parseRes = parseInt(tmS[0])*60 + parseInt(tmS[1]); } if(parseRes == isNaN) { parseRes = 0; } return parseRes; } function minutesToHH_MM(psMin) { var vRetVal = 0; var resultH = (psMin / 60); vRetVal = (""+resultH).split(".")[0]; resultH = (psMin % 60); if(resultH<10) { resultH = '0'+resultH; } else { resultH = resultH + "000"; resultH = resultH.substring(0,2); } vRetVal = vRetVal + "."+resultH; return vRetVal; } function rep(psParam) { var vRetVal = stringToMinuts(psParam); return vRetVal; } //(c)trdmval@gmail.com 2017-12-28 11:23:09 function timeAddition() { //debugger; vText = "Time addition(2.45+20 = 3.05)\tCtrl+Shift+D"; //2.45+20,3.05 = 6.10 var selTextOrig,selText = "15, 2.20, 20, 25";// Editor.currentView.selection; if(IntellPlus.debugMode()) { debugger; } selTextOrig = Editor.currentView.selection; selText = selTextOrig; selText = selText.replace("+",","); while(selText.indexOf("+")!= -1) { selText = selText.replace("+",","); // break; continue; } var arr = new Array; var result = 0; // https://regex101.com/ // 1.10, 35, 5, 1.30 // 20.30 - 1.30 var vRe0 = /(\s*|,|\+|\-)([0-9\.]+)(\s*|,|\+|\-)/g; // // var vRe1 = /\s*([0-9\.]+)\s*\-\s*([0-9\.]+)\s*/; //.exec(selText) {...} Object var selText2 = selText; var vRe0_rez = selText2; vRe0_rez = vRe0_rez.replace(/(,)/g,'+'); vRe0_rez = vRe0_rez.replace(vRe0,rep); vRe0_rez = trimSimple(vRe0_rez); try { result = eval(vRe0_rez); } catch(e) { message(e.message+' в: \''+ vRe0_rez+'\' (неправильное выражение для eval)'); result = 0; } //message(vRe0_rez + ' = ' + result); if(result == 0) { arr = selText.split(","); var tmS = ""; var i = 0; var parseRes = 0; var itemN = 0; for (i = 0; i<arr.length; i++ ) { itemN = arr[i]; itemN = itemN.replace(/\s+/,''); if(itemN == "") { continue; } parseRes = stringToMinuts(arr[i]); result += 0 + parseRes; } } if (result <= 0 || result == NaN) { alert("Нужно выделить числа, типа: 15, 2.45, 20, 25") return ''; } tmS = minutesToHH_MM(result); IntellPlus.init(); // если выделение - это последний фрагмент в строке, то в принципе можно добавить к строке " = "+tmS var vCurLineTxt = IntellPlus.currentLineSrc; vCurLineTxt = trimRight(vCurLineTxt); var selTextOrig2 = trimRight(selTextOrig); if(strEndWithThis(vCurLineTxt, selTextOrig)) { Editor.currentView.selection = selTextOrig + " = "+tmS; } EditorMessage(selText+" = " + tmS); result = parseFloat(tmS); } jN.scriptsMenu = (!jN.scriptsMenu) ? {} : jN.scriptsMenu; scriptsMenu = jN.scriptsMenu; // глобальная переменная с меню скриптами. var myTimeAdditionItem = { text: "Time addition(2.45+20 = 3.05)\tCtrl+Shift+D", ctrl: true, shift: true, alt: false, key: 0x44, // "I" cmd: timeAddition }; scriptsMenu.addSeparator(); addHotKey(myTimeAdditionItem); scriptsMenu.addItem(myTimeAdditionItem); function typeSymbol( psSymb ) { Editor.currentView.selection = psSymb; } function addHotSym(psFu, psKey) { var rv = { ctrl: false, shift: false, alt: true, key: psKey, // "I" cmd: psFu }; addHotKey(rv); // Различные клавиши <> } // Ввоод символов в русской раскладке схема Alt+' >> ' ; Alt+$ >> $. Можно не переключать раскладку. function typeSymbol_1() { typeSymbol( '<' );} addHotSym(typeSymbol_1,0xBC); function typeSymbol_3() { typeSymbol( '\'' );} addHotSym(typeSymbol_3,0xDE); function typeSymbol_2() { typeSymbol( '>' );} addHotSym(typeSymbol_2,0xBE); function typeSymbol_4() { typeSymbol( '~' );} addHotSym(typeSymbol_4,0xC0); function typeSymbol_5() { typeSymbol( '$' );} addHotSym(typeSymbol_5,0x34);//$ function typeSymbol_6() { typeSymbol( '#' );} addHotSym(typeSymbol_6,0x33); //######### function typeSymbol_7() { typeSymbol( '|' );} addHotSym(typeSymbol_7,0xDC); // function typeSymbol_8() { typeSymbol( '[' );} addHotSym(typeSymbol_8,0xDB); // function typeSymbol_9() { typeSymbol( ']' );} addHotSym(typeSymbol_9,0xDD); // function typeSymbol_10() { typeSymbol( '\'' );} addHotSym(typeSymbol_10,0xDE); //
-
- The code only works for the selected piece of text.
-
Simplified version.
Place this text in the ‘Notepad ++ \ plugins \ jN \ jN \ includes’ directory and this functionality will work for you on the selected text by pressing the ‘Ctrl + Shift + C’ hotkey.// trdm 2020-11-20 11:44:27 // вычисляет выделение в N++ как выражение с пом WSH javascript 'eval' // file: C:\_ProgramF\Notepad++\plugins\jN\jN\includes\trdmUtil.js // repo: https://github.com/trdm/jn-npp-scripts function evalSelection() { var selTextOrig = Editor.currentView.selection; if(selTextOrig.length == 0) { return; } var vRezult = 0; try { vRezult = eval(selTextOrig); } catch(e) { vRezult = ''; } if(!vRezult) { return; } else if(vRezult == NaN) { return; } Editor.currentView.selection = selTextOrig + " = "+vRezult; } var myEvalSelectionItem = { text: "Eval selection \tCtrl+Shift+C", ctrl: true, shift: true, alt: false, key: 0x43, cmd: evalSelection }; if (!jN.scriptsMenu){ var scriptsMenu = Editor.addMenu("jN.scripts"); jN.scriptsMenu = scriptsMenu; } scriptsMenu = jN.scriptsMenu; addHotKey(myEvalSelectionItem); scriptsMenu.addItem(myEvalSelectionItem);
Demonstration: