Replace the math expression with the calculated result

  • Example:

    • Before : 1+1,1-1,1*2,1/3
    • After : 2,0,2,0.3

    I tried using Textfx, but it only pops up a result window

    I tried the answer here. But it only calculates multiplication and division and the expression must be in " ".

    I need to calculate about 14000 lines like that

    Please help me to write a script that resembles the answer there but works with my case

  • There’s also a plugin for Notepad++ called MathPad, which can be installed via the Plugin Manager, with more info at it’s homepage. I don’t know whether it will meet your needs, but it’s something to look into.

    Here is me helping you write the script: study the VBScript and/or PowerShell script at the SuperUser question you linked. Tweak it, and see how those changes affect the results. Experiment until it no longer requires the quote marks. Continue experimenting until it does everything you want it to. If you have shown some effort, but still cannot get it to work, ask a question in an appropriate forum, where the topic is about the scripting language you are using (SuperUser/StackOverflow might be a good location).

    Some here would be able to use the PythonScript plugin to automate those calculations inside Notepad++. Others might suggest skipping the middle-man: if you have a file with 14000 instances, it might be simpler to run it through an offline script, which could be written in VBA, Python, Lua, Perl, or your favorite scripting language. But it might take a few hours to write something: and that brings me to my last point:

    But if by “help me to write a script” you mean, “write a script for me”, then you’ve come to the wrong place. It sounds like you’re asking for custom coding services, which will likely cost you something. Good luck in presenting the question, as framed (ie, without showing any effort of your own), in any coding forum and getting the exact script you want.

Log in to reply