Closed Grefron closed 8 months ago
Currently not in this way. But you can easily replace a=? {x} with a=? {y} in the file by using regex.
This was my workaround at the moment. Just not very good with regexes (who is?) so always a little afraid the endresult may be corrupted. Therefore I thought a more directly supported way of doing this would be beneficial.
For anyone interested, I opted to generate the input files using Python, with the jinja2 template engine, which works nicely for me.
Still struggling a bit with getting the results from my calculations back. Some way of exporting key-value pairs of variables would be awesome.
Check out this idea about calling Calcpad from Python as a library: https://github.com/Proektsoftbg/Calcpad/issues/188#issuecomment-1719265127
We can create a simple wrapper around Calcpad that can pass input, set variables, get output, read variables, etc. I do not think that using a console app in command line mode is the most appropriate way to do these things.
We made significant improcement to Cli in command mode:
In the older versions, all input values are added subsequently and the end of the file, after a vertical tab ASCII Code 11. Almost all examples are still in this format: https://github.com/Proektsoftbg/Calcpad/blob/main/Examples/Mathematics/Cubic%20Equation.cpd
It works even if there are inline input values, like x = ? {2}
. So, this could be an easier way to pass different values to Cli in command mode, without searching throughout the whole file. Just search for a vertical tab '\v', take the entire text before it and add the input vaues after it. If there is no vertical tab, just add it with the values after it.
https://github.com/Proektsoftbg/Calcpad/blob/main/Setup/calcpad-setup-en-x64.exe
Hi,
Is there a way to pass in variables when calling cli.exe to export to a pdf or word file, when the input cpd file contains a question mark 'placeholder'?
Something like defining the values in a json or yaml file (of which the name is than passed into cli.exe through a command line argument) would be very helpful in automating the generation process.
Example pdn: a=? {10} m
example json to go along: {'a':4}
Thanks!