Jump to content











Photo
- - - - -

Variables


  • Please log in to reply
No replies to this topic

#1 pscEx

pscEx

    Platinum Member

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

Posted 13 May 2008 - 07:08 PM

In version 075 the build time of a WinBuilder project decreased to about a third of the 074 time.
That is mainly caused by a new variables organization.

Let me try to make it visible for different group of users:
  • The 'Consumer' using existing scripts:
    For you nothing is changing. But maybe you are intersted in 'theory' at the bottom
  • The .Script developer:
    Propably you have to change some of your scripts
There are two different situations to use variables:
  • Setting the value of a variable, e.g.
    • Set,%var%,value
    • IniRead,"Filename","Section","Key","%Variable%"
  • Changing the value of an existing variable, e.g.
    • StrFormat,Inc,%var%,1
These conditions must be treated different:
  • It does not matter whether the variable is defined under [Variables] or not.
    However, it is good for documentation to define all variables here which will be set later
  • This variable must be defined and initialised, either by

  • An entry under [Variables]
  • A previous explicitly set value
If this is not provided, an error will occur.

Some Theory
(Symbolic, very compressed explanation)
Now the variables are organized in something like a 'level order'
  • Global variables coming from WinBuilder.ini
  • Project variables coming from script.project
  • Local variables coming from the acdtual script.
The variables are read as necessary. So inside a script it is not necessary to re-read the WinBuilder.ini variables.

Additionally every variable level has two instances:
  • Original
    This contains how the variable is defined, maybe with other variables referenced:
    %target_win%=%TargetDir%\I386
  • Evaluated
    This contains the completely resolved value:
    %target_win%=C:\Dokumente und Einstellungen\Peter\Desktop\WB Archiv\Beta8\Target\I386
Whenever in a script a variable is referenced, the evaluated instance is used.

That makes the use of 'System,RefreshVars' obsolete.
In most cases this command has been used to resolve the 'Original' instance.

Starting with WinBuilder 075 beta 1, the 'System,RefreshVars' command brings a warning message, and the .Script developer should remove the statement from his script.

But there may be one situation, which in the past also has been solved by 'System,RefreshVars':

Imagine that you have a variable %start% with initial value FIRST
And you have a variable %result% defined as %start%_and_something
%result% is evaluated to FIRST_and_something

Now you change: Set,%start%,FINISH
%result% is still evaluated to FIRST_and_something

To resolve this, you execute the command
System,RebuildVars

Now %result% is evaluated to FINISH_and_something

I hope that some understanding remains! :lol:

Peter

BTW: If a forum's user which is a better teacher like me, can translate this into understandable English:

Please PM me the suggestion and I'll replace




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users