Jump to content











Photo
- - - - -

[Fixed] Conditional Echo bug


  • Please log in to reply
9 replies to this topic

#1 homes32

homes32

    Gold Member

  • .script developer
  • 1035 posts
  • Location:Minnesota
  •  
    United States

Posted 05 March 2010 - 06:20 PM

It appears that Echo statements processed with a conditional statement are not being executed.

when the following code is executed the log shows the statment evaluating to true but the Echo command is never processed.
If,%version%,Smaller,80,Echo,"Winbuilder 080 or higher is required in order to configure advanced options, build will continue as normal but ShutdownPE.ini will not be created.",WARN

 If,Not,%testvar%,Equal,80,Echo,"Winbuilder 080 or higher is required in order to configure advanced options, build will continue as normal but ShutdownPE.ini will not be created.",WARN

I can only get the Echo to display by using a Begin, End which works fine, but it would be nice to exclude the extra commands for simplicity.
If,%version%,Smaller,80,Begin

 Echo,"Winbuilder 080 or higher is required in order to configure advanced options, build will continue as normal but ShutdownPE.ini will not be created.",WARN

 End


#2 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 05 March 2010 - 06:36 PM

I usually want to help our developers, even if they report "user failures" as "WinBuilder bugs":
Add a line

If,%version%,Smaller,80,Echo,"Winbuilder 080 or higher is required in order to configure advanced options, build will continue as normal but ShutdownPE.ini will not be created.",WARN
Echo,%TestVar%
If,Not,%testvar%,Equal,80,Echo,"Winbuilder 080 or higher is required in order to configure advanced options, build will continue as normal but ShutdownPE.ini will not be created.",WARN

in your code
and think about the result

Peter :whistling:

#3 homes32

homes32

    Gold Member

  • .script developer
  • 1035 posts
  • Location:Minnesota
  •  
    United States

Posted 05 March 2010 - 07:26 PM

I usually want to help our developers, even if they report "user failures" as "WinBuilder bugs":
Add a line

in your code
and think about the result

Peter :whistling:

I think I am misunderstood. to simplify consider the following:


using the following code I expect that if 78 is smaller than 80 winbuilder will output a Warning echo.
what actually happens is that winbuilder correctly deduces that 78 is smaller than 80 but than does not do the echo as instructed.
If,78,Smaller,80,Echo,"Winbuilder 080 or higher is required in order to configure advanced options, build will continue as normal but ShutdownPE.ini will not be created.",WARN
log not showing warning echo
Posted Image


using the following code the warning echo is processed and displayed correctly in the log. As commands other than echo are processed correctly using the same if statement that is why I assume that there is a bug with winbuilder not recognizing the Echo command used in the conditional statement.
If,78,Smaller,80,Begin

Echo,"Winbuilder 080 or higher is required in order to configure advanced options, build will continue as normal but ShutdownPE.ini will not be created.",WARN

End
-- OR --
If,78,Smaller,80,Run,%Scriptfile%,showwarn



[showwarn]

Echo,"Winbuilder 080 or higher is required in order to configure advanced options, build will continue as normal but ShutdownPE.ini will not be created.",WARN
log correctly displaying warning echo
Posted Image

#4 dera

dera

    Gold Member

  • .script developer
  • 1335 posts
  •  
    Hungary

Posted 05 March 2010 - 08:15 PM

remove the ,WARN from the end of your script line
i mean this works for me:
If,78,Smaller,80,Echo,"Winbuilder 080 or higher is required"


edit:
and do not use the comma inside the MessageText
i mean try #$c instead of ,
advanced options#$c build will continue

#5 homes32

homes32

    Gold Member

  • .script developer
  • 1035 posts
  • Location:Minnesota
  •  
    United States

Posted 05 March 2010 - 08:56 PM

and do not use the comma inside the MessageText
i mean try #$c instead of ,
advanced options#$c build will continue


thanks. the following code is working. removing the comma seems to at least fix the issue, although I thought the comma shouldn't matter being the text was in quotes and it didn't seem to affect a regular old Echo statment on its own line.
If,78,Smaller,80,Echo,"Winbuilder 080 or higher is required in order to configure advanced options. build will continue as normal but ShutdownPE.ini will not be created.",WARN


#6 dera

dera

    Gold Member

  • .script developer
  • 1335 posts
  •  
    Hungary

Posted 05 March 2010 - 09:03 PM

correction:
,WARN
is ok at the end of the line
it does not cause problem

#7 Lancelot

Lancelot

    Frequent Member

  • .script developer
  • 5013 posts
  • Location:Turkiye/Izmir
  • Interests:*Mechanical stuff and Physics,
    *LiveXP, BartPE, SherpyaXPE,
    *Basketball and Looong Walking,
    *Buying outwear for my girlf (Reason: Girls are stupid about buying bad stuff to make themselves uglier :))
    *Girls (Lyric: Girl,...., You will be a womann, Soon)
    *Answering questions for "Meaning of life",
    *Helping people,

    Kung with LiveXP, Fu with Peter :)
  •  
    Turkey

Posted 05 March 2010 - 10:09 PM

yes homes32,

It is a well known winbuilder bug. A correct syntax ending with failure.......

It was declared many times in the past winbuilder supports commas between quotes. ;)

and like you wrote in your first example, I prefer using begin-end workaround since mostly development starts replying reports with "it is not a bug" :whistling:

:huh:

btw, even i use echo,txt,warn on scripts, It has never been either in wand or in syntax. But probably (%80) in future development will add something like
Echo,<txt>,Warning
instead of "Echo,<txt>,Warn" saying previous syntax was not declared/official/blabla. So I advice to keep an eye around :cheers:.

#8 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 08 March 2010 - 06:55 PM

http://winbuilder.ne...tax.html#syntax:

First some general rules and explanations:

1. Besides some special cases (e.g. parameters in ShellExecute) generally enclosing quotes are not needed.
2. Enclosing quotes MUST be used if the WinBuilder Script Line Parameters contain spaces.
If the spaces are replaced by the escape #$s, the enclosing quotes should be ommitted.
3. WinBuilder Script Line Parameters are separated by a comma.
If a comma is inside an argument, it must be 'escaped' by #$c.

In most cases user violation of that rules are accepted by WinBuilder and processed as assumed.
E.g. unnecessary enclosing quotes or a comma inside an item enclosed by quotes.

But sometimes that can bring unexpected results.

Try this:

If,%version%,Smaller,80,Echo,"Winbuilder 080 or higher is required in order to configure advanced options#$c build will continue as normal but ShutdownPE.ini will not be created.",WARN
If,Not,%testvar%,Equal,80,Echo,"Winbuilder 080 or higher is required in order to configure advanced options#$c build will continue as normal but ShutdownPE.ini will not be created.",WARN


Peter

#9 Lancelot

Lancelot

    Frequent Member

  • .script developer
  • 5013 posts
  • Location:Turkiye/Izmir
  • Interests:*Mechanical stuff and Physics,
    *LiveXP, BartPE, SherpyaXPE,
    *Basketball and Looong Walking,
    *Buying outwear for my girlf (Reason: Girls are stupid about buying bad stuff to make themselves uglier :))
    *Girls (Lyric: Girl,...., You will be a womann, Soon)
    *Answering questions for "Meaning of life",
    *Helping people,

    Kung with LiveXP, Fu with Peter :)
  •  
    Turkey

Posted 08 March 2010 - 09:33 PM

@Peter

you are the one who violates winbuilder rules. After You post this "later created" rule, a time passed and it was found it causes troubles.

After a loooong discussion you agreed to winbuilder tolerate quotes as it was before.

Now I see Mr. Alzehimer with you and you are again referring the "later created" :ranting2: bad and changed to back rule.


Congradulations, by not updating syntax page with devil plans you keep, you succeed having an untrustable and further unlogical winbuilder for everyone :ranting2:

#10 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 12 March 2010 - 08:46 AM

I misunderstood the background. It is an "If" issue, not an Echo issue.

Fixed.

Peter




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users