command line in a Panel

I wonder whether there is any way to include a "igor command line" inside a new panel so that simple igor command or say arithmetic command like wave2=wave1+5 can be typed and can be executed like the way we do in the usual igor command line.

My main interest is for arithmetic expression as I would love to use the parsing that igor does for such expression and execute afterthat.

I am curious to know how igor accept the command line input and process it ..is there any ipf file associated with this process or it is done completely internally.
supra wrote:
I wonder whether there is any way to include a "igor command line" inside a new panel so that simple igor command or say arithmetic command like wave2=wave1+5 can be typed and can be executed like the way we do in the usual igor command line. ...


One way that I handled something like this is to preface the command with an "escape code". For example, within a text field in a panel, typing %wave2 = wave1 + 5" calls the command via the Execute operation ... the code expands to Execute "wave2 = wave1 + 5"

You can find an example in the LogBook package ... http://www.igorexchange.com/project/LogBook

The code required is rather complicated and long. I suggest to start with a simple panel and input field, learn to capture the input, and learn to parse it to run via Execute.

I am curious though, since the command line is always readily available, where you might be going with this idea in the long run.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
Thank you so much J. J. Weimer...indeed I looked once in the LogBook code and it seems pretty complex...I will look more carefully to see if I can understand… truth is I basically want to have a "wave2 = wave1 + 5" in the panel as I work with many graphs and sometime I need to use the command line back and forth and often for long wave name typing mistake happen.....so I like to have a textbox command line option is the panel and with a "button" for " listing wave name" ( e.g tracename to list) directly from Graph and thereby I don’t need to type the wave name also I can do arithmetic calculation. Can you pl give me some hint..

(a) How actually after typing %wave2 = wave1 + 5" in a textbox I execute ( by Button) the code.
(b) For a existing XY data ( wave0 and wave1..) if I want to do wave3=wave1+wave2 where wave3 column till don’t exist yet and rather will be created by the operation..how I do that ?..usually as wave3 does not exist ...Igor gives error (wave does not exist) if I try this from command line.
supra wrote:

(b) For a existing XY data ( wave0 and wave1..) if I want to do wave3=wave1+wave2 where wave3 column till don’t exist yet and rather will be created by the operation..how I do that ?..usually as wave3 does not exist ...Igor gives error (wave does not exist) if I try this from command line.


Just like the curve fitting and smoothing dialog boxes, you will want a Destination control. Populate the control with the current waves (option to overwrite an existing wave) and add "New Wave" to the list. Whether you use a listbox or popup menu is up to you.

When the user selects "New Wave" you have two choices how to proceed. You can automatically name the wave based on existing wave names (be careful not to use an existing name). Alternatively you can use a SetVariable to allow the user to enter the name of the new wave (again checking to make sure the new name does not match an existing wave).

For simplicity, create the wave by using Duplicate (to ensure the correct number of data points).
supra wrote:
Thank you so much J. J. Weimer...indeed I looked once in the LogBook code and it seems pretty complex ...
so I like to have a textbox command line option is the panel and with a "button" for " listing wave name" ( e.g tracename to list) directly from Graph and thereby I don’t need to type the wave name also I can do arithmetic calculation. Can you pl give me some hint ...


Perhaps then what you would want is to build something starting from this example experiment. It has a panel to do allow you to do simple math functions on traces in a graph. The result is returned directly to the trace selected. It makes use of shorthand notations "wave += X" ,"wave -= X", "wave *= X", or "wave /= X" to do the math operations.



--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville
WaveMathPanel.pxp (50.22 KB) WaveMathPict.png (106.71 KB)
Oahh !!!! thank you so much JJWeimer ....this is exactly what I was looking for ..Thanks to Proland also..
I will try to incorporate this in my code and will come back later to say how it works...Thank you so much to both of you.
supra wrote:
... this is exactly what I was looking for ...


FWIW, the File : Example Experiments : Analysis : Wave Arithmetic Panel Demo may also contain much of what you want.

--
J. J. Weimer
Chemistry / Chemical & Materials Engineering, UAHuntsville