I often write simple equations in my text.
I then copy and paste to & from the Windows calculator to get the results.
It seems to me something in-line, that follows standard calculation
priorities, would be more elegant and useful.
Perhaps somebody--who knows what there doing (not me) could use some of the following libraries for such an expression evaluator.
http://3d2f.com/pcgi/search.cgi?s=778&t=2&w=2
Is there an math expression evaluation addin for TP ?
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
I still think this would be really handy. Somebody-- ought to agree with me.
I could see an add-on app that would take whats selected in the clipboard, evaluate it and then return to clipboard the result (or the appropriate message.) Actually, I am surprised that such an app does not exist already.
I could see an add-on app that would take whats selected in the clipboard, evaluate it and then return to clipboard the result (or the appropriate message.) Actually, I am surprised that such an app does not exist already.
jsb257
-
- Posts: 2461
- Joined: Sun Mar 02, 2003 9:22 pm
You already have a program that almost does that.
CMD has a command-line calculator, albeit a feeble one. If at the command line you enter
set /a 6 * 7
you will see
42
and if you enter
set /a 6 * 7 | clip
you will see nothing, but the clipboard will contain
42
See, for example, http://blogs.msdn.com/b/adioltean/archi ... 74160.aspx .
You can create a tool in TextPad to run this command on your selection:
You can, of course, use any command-line program that provides a better calculator than CMD's. (I use a small perl script.)
A mechanism (requested many years ago) that passes the current (arbitrarily big) selection to a tool's standard input and replaces the selection with the tool's standard output would be so useful. It would allow user-supplied enhancements to TextPad to be easily created and easily shared.
Helios...?
CMD has a command-line calculator, albeit a feeble one. If at the command line you enter
set /a 6 * 7
you will see
42
and if you enter
set /a 6 * 7 | clip
you will see nothing, but the clipboard will contain
42
See, for example, http://blogs.msdn.com/b/adioltean/archi ... 74160.aspx .
You can create a tool in TextPad to run this command on your selection:
This tool passes the selection, not the contents of the clipboard, to CMD. And it will not insert its result into your document; unfortunately TextPad provides no way for a tool to do that. So after running the tool you have to paste the result yourself.Configure | Preferences | Tools | Add | DOS Command...
DOS Command
set /a $sel | clip
[X] Run minimized
[X] Closee DOS window on exit
You can, of course, use any command-line program that provides a better calculator than CMD's. (I use a small perl script.)
A mechanism (requested many years ago) that passes the current (arbitrarily big) selection to a tool's standard input and replaces the selection with the tool's standard output would be so useful. It would allow user-supplied enhancements to TextPad to be easily created and easily shared.
Helios...?
@jsb257
You could use TPClipboard and the command line calculator from sourceforge in order to get it to work how you described (copy calculation, use tool, paste answer) as well as have more functionality than "set /a" (e.g. sin, cos, exp, log...).
Download TPClipboard from:
Link No Longer Valid
Download the command line calculator from:
http://cmdlinecalc.sourceforge.net/
Extract them both and put both application files somewhere convenient.
On TextPad goto Configure > Preferences > Tools > Add > Program... Then navigate to where TPClipboard.exe is. It should now be listed. From there you can rename it (e.g.Calculator). After that click "Apply". Expand tools to the left (by clicking the +). Click on what you named the tool. Change parameters to the URL/address of the commandline calculator (e.g. C:\calc.exe). Untick "Capture Output". Tick "Run Minimized". Tick "Close DOS Window On Exit". Finally click "OK".
After that you should be able to copy a calculation, use the tool and then paste the answer.
You could use TPClipboard and the command line calculator from sourceforge in order to get it to work how you described (copy calculation, use tool, paste answer) as well as have more functionality than "set /a" (e.g. sin, cos, exp, log...).
Download TPClipboard from:
Link No Longer Valid
Download the command line calculator from:
http://cmdlinecalc.sourceforge.net/
Extract them both and put both application files somewhere convenient.
On TextPad goto Configure > Preferences > Tools > Add > Program... Then navigate to where TPClipboard.exe is. It should now be listed. From there you can rename it (e.g.Calculator). After that click "Apply". Expand tools to the left (by clicking the +). Click on what you named the tool. Change parameters to the URL/address of the commandline calculator (e.g. C:\calc.exe). Untick "Capture Output". Tick "Run Minimized". Tick "Close DOS Window On Exit". Finally click "OK".
After that you should be able to copy a calculation, use the tool and then paste the answer.