PDA

View Full Version : Handle Text File does not parse constants



NewsArchive
07-20-2011, 06:38 AM
Hi Friedrich,

this does not work:

Text File: Insert Line "0" to "%RESULTFILE%" -- $DISCLAIMER$

Markus

NewsArchive
07-20-2011, 06:38 AM
Hi Markus,

> this does not work:
>
> Text File: Insert Line "0" to "%RESULTFILE%" -- $DISCLAIMER$

Hmm, so you would like to add '$DISCLAIMER$' to the ASCII file and this does
not work?

Please note that the "Handle Text File Operation" function does not "see"
the value of a constant. Only the "If" statements and "Set Variable"
functions replace constants by its value.

Friedrich

NewsArchive
07-20-2011, 06:38 AM
Hi Friedrich,

> Please note that the "Handle Text File Operation" function does not "see"
> the value of a constant. Only the "If" statements and "Set Variable"
> functions replace constants by its value.

Why are constants restricted in this way?

Markus

NewsArchive
07-20-2011, 06:39 AM
Hi Markus,

>
> Why are constants restricted in this way?
>

It was a compiler design decision back in 2001/2002. We added the
"#const..." compiler directive to handle the "Common Definitions.sbi"
include script items. The compiler only resolves #const items in "If"
Statements and "Set Variable(Ex)". It ignores it in all the other
functions.

Friedrich

NewsArchive
07-20-2011, 06:39 AM
Are there similar restrictions for compiler variables?

Markus Zander

NewsArchive
07-20-2011, 06:39 AM
>
> Are there similar restrictions for compiler variables?
>

The following compiler variable example should create the 'test1234.txt'
file and add the value '1234'.

#set compiler variable [DISCLAIMER] = "1234"
Set Variable %RESULTFILE% to "c:\sbtest\test1234.txt"
Text File: Create File "%RESULTFILE%"
Text File: Insert Line "" to "%RESULTFILE%" -- [DISCLAIMER]

Friedrich

NewsArchive
07-20-2011, 06:40 AM
Just tested the following:

#const $DISCLAIMER$ = "1234"
Set Variable %RESULTFILE% to "c:\sbtest\test1234.txt"
Text File: Create File "%RESULTFILE%"
Text File: Insert Line "" to "%RESULTFILE%" -- $DISCLAIMER$

It created the 'test1234.txt' file and added the string '$DISCLAIMER$'. So
it works as expected.

Friedrich

NewsArchive
07-20-2011, 06:40 AM
Hi Friedrich,

it works as you expect, but not as I need :-)

Markus

NewsArchive
07-20-2011, 06:40 AM
>
> it works as you expect, but not as I need :-)
>

<g> :-)

Friedrich