EVAL TEXT: Difference between revisions
From Macros Wiki
Jump to navigationJump to search
No edit summary |
No edit summary |
||
| (2 intermediate revisions by 2 users not shown) | |||
| Line 2: | Line 2: | ||
{{Command|syntax=EVAL_TEXT <string variable> | {{Command|syntax=EVAL_TEXT <string variable> | ||
|description=Evaluate any variables stored in a text variable and save the resulting text back to the variable. | |description=:Evaluate any variables stored in a text variable and save the resulting text back to the variable. | ||
:You need to use this command if you are building up a string variable using the same variable with different values. | :You need to use this command if you are building up a string variable using the same variable with different values. | ||
:Any variables used inside the contents of a string variable are only converted from numbers to text when the string variable | |||
:is used to write to a file, passed to another macro or displayed on a dialog. | |||
|param1=<string variable>|param1_desc={{string variable}} | |param1=<string variable>|param1_desc={{string variable}} | ||
| Line 9: | Line 11: | ||
===Example=== | ===Example=== | ||
:i = | :i = 123 | ||
:a$ = "i = %i" | :a$ = "i = %i" | ||
:i = | :i = 246 | ||
:a$ = a$ + " and now i = %i" | :a$ = a$ + " and now i = %i" | ||
:Message a$ | :Message a$ | ||
<br> | |||
:This will display the text "i = 246 and now i = 246" | |||
:<br> | :<br> | ||
:i = | <br> | ||
:i = 123 | |||
:a$ = "i = %i" | :a$ = "i = %i" | ||
:EVAL_TEXT a$ | :EVAL_TEXT a$ | ||
:i = | :i = 246 | ||
:a$ = a$ + " and now i = %i" | :a$ = a$ + " and now i = %i" | ||
:Message a$ | :Message a$ | ||
:this will display the text "i = 123 and now i = 246" | |||
:<br> | :<br> | ||
:For an example macro see [[Process_Data]] | :For an example macro see [[Process_Data]] | ||
[[Category:Miscellaneous]] | [[Category:Miscellaneous]] | ||
Latest revision as of 23:49, 12 January 2011
Command
- EVAL_TEXT <string variable>
- Evaluate any variables stored in a text variable and save the resulting text back to the variable.
- You need to use this command if you are building up a string variable using the same variable with different values.
- Any variables used inside the contents of a string variable are only converted from numbers to text when the string variable
- is used to write to a file, passed to another macro or displayed on a dialog.
Parameters
- <string variable>
- a string variable, for example a$
Example
- i = 123
- a$ = "i = %i"
- i = 246
- a$ = a$ + " and now i = %i"
- Message a$
- This will display the text "i = 246 and now i = 246"
- i = 123
- a$ = "i = %i"
- EVAL_TEXT a$
- i = 246
- a$ = a$ + " and now i = %i"
- Message a$
- this will display the text "i = 123 and now i = 246"
- For an example macro see Process_Data