Jump to content











Photo
- - - - -

[Solved] Winbuilder does not refresh the values from script.project


  • Please log in to reply
37 replies to this topic

#1 pecd.net

pecd.net

    Silver Member

  • .script developer
  • 947 posts
  •  
    Germany

Posted 06 October 2008 - 07:04 AM

Hi all,

As vistape can use different sourcetypes (WAIK downloaded from the web, Server2008 downloaded from the web and a local Vista DVD) I want to use a script that can download the needed files and then sets the source folder depending on the users selection.
(I know this is not the way WB normally does it, but i found it easier to have all possible options with explaination in a script, as the user is used to work with the script interfaces, rather than directing the user to the Source tab and ask him to select the right folder...)

This already works fine, but:

Winbuilder does not refresh the values from script.project ([Main] SourceDir="Z:\vista32de-sp1") during build, so i can not set a sourcedir depending on the user selection in a script that is executed during the build process.

When i found that, i thought about saving the user selection to the project file when setting it (with a save button), but WB also does not refresh the script.project values when starting the build.

They are only refreshed when i
  • close and restart WB
  • click refresh
  • select another script (not sure if this always works)

Can someone come up with any idea how to make wb use the sourcedir that i set in the very first script?

Or at least how to make sure WB uses the correct setting from script.project when a new build is started?

Or could one of the developers add something like "System,refreshproject" to make something like this work?


Thanks for all ideas...


#2 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 06 October 2008 - 08:16 AM

I dont use vistape project, but here is an idea (as far as i understand):

With LiveXP, thanks to galapo :cheers: , we have "Clean Temporary files" button with option "Also delete SourceDir info"
I uncheck "Also delete SourceDir info" option (it is checked default), i dont want to loose my source directory location(s) when i click "Clean Temporary files" button.


Before everybuild, i click "Clean Temporary files" button, which cleans temporary files and restarts winbuilder. As i use different sources from time to time (sp2eng, sp2tr, 2k3sp2eng, 2k3sp2tr, 2k3sp1eng) i can say this button works nice for me :confused1: Maybe if there not exists sth like that can be added to vistape project too?

http://img513.images...08/snap6dv8.png

#3 pecd.net

pecd.net

    Silver Member

  • .script developer
  • 947 posts
  •  
    Germany

Posted 06 October 2008 - 08:47 AM

thanks, i will take a look at this...

#4 pecd.net

pecd.net

    Silver Member

  • .script developer
  • 947 posts
  •  
    Germany

Posted 06 October 2008 - 09:44 AM

Lancelot (Thanks!) pointed me to LiveXP and there i found that the script uses

System,ReScanScripts

This works fine when i want to save my changes with a save button, but it can not be used while building as it restarts WB and so interrupts the buildprocess.

So to make it perfect i am still looking for a way to do the same while building...any ideas?

#5 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 06 October 2008 - 09:47 AM

What about: System,REBUILDVARS.

Regards,
Galapo.

#6 pecd.net

pecd.net

    Silver Member

  • .script developer
  • 947 posts
  •  
    Germany

Posted 06 October 2008 - 09:56 AM

From the release notes (as i understand them) this should not work...but i will try anyway...

#7 Nuno Brito

Nuno Brito

    Platinum Member

  • .script developer
  • 10545 posts
  • Location:boot.wim
  • Interests:I'm just a quiet simple person with a very quiet simple life living one day at a time..
  •  
    European Union

Posted 06 October 2008 - 12:45 PM

On wb074 you could overwrite this value by changing the variable value on the script.project file.

Peter has introduced a new variable handling system.

Have you already tried a regular SetVar and then use the same command mentioned by Galapo?

This is all very beta - no documentation produced as it might change in the final version.

:confused1:

#8 pecd.net

pecd.net

    Silver Member

  • .script developer
  • 947 posts
  •  
    Germany

Posted 06 October 2008 - 01:27 PM

Thanks Nuno, yes i know it is beta, but for now all that counts is that it works...i will probably do a release based on the beta as about 20 of my scripts will not work with the current stable:-)

I really hope most of the beta changes will stay in, as they are very helpful, some things would not have been possiblem without those changes:-)

I tried again what you suggested and it does not work...

#9 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 06 October 2008 - 08:33 PM

From the release notes (as i understand them) this should not work...but i will try anyway...


Works for me:

[Process]Message,"Var will be set to: 'testing...'",INFORMATIONIniWrite,%projectdir%\script.project,Variables,#$ptest#$p,testing...Set,%first%,%test%Message,"Var before REBUILDVARS: %first%",INFORMATIONSystem,REBUILDVARSSet,%second%,%test%Message,"Var before REBUILDVARS: %first%",INFORMATIONIniDelete,%projectdir%\script.project,Variables,#$ptest#$p

Regards,
Galapo.

#10 pecd.net

pecd.net

    Silver Member

  • .script developer
  • 947 posts
  •  
    Germany

Posted 07 October 2008 - 07:17 AM

Thanks Galapo !

After playing a bit with you example this (hopefully) fixed my problem...

IniWrite,%projectdir%\script.project,Variables,#$pSourceDir#$p,"Path to selected source"
System,REBUILDVARS

the changed contents of %SourceDir% is vaild for all scripts that run after this..

Now the user no longer has to save his selection, he can just change it in the interface and it will be set during the next build...

Thanks to all for the help!

#11 TheHive

TheHive

    Platinum Member

  • .script developer
  • 4167 posts

Posted 08 October 2008 - 02:31 AM

Sounds great and makes it easier to user.

#12 pscEx

pscEx

    Platinum Member

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

Posted 08 October 2008 - 05:25 PM

This is all very beta - no documentation produced as it might change in the final version.

Sorry Nuno, you are a bit wrong! :confused1:
If you have a look into the release notes:


Script Command Changes:



 - System,RefreshVars:

   Obsolete. The results of this command are now included in the new variables handling.

   If you still use the command, you will get an warning message.

   But this warning is just a message. The resulting project will work.

 - System,RebuildVars: New. In the current LiveXP scripts it seems to be not needed. It is necessary in this case:

	Set,%First%,first

	Set,%Result%,"Here is %first%"

	Echo,Value of #$pResult#$p is: %Result% >> Here is first

	Set,%First%,second 

	Echo,Value of #$pResult#$p is: %Result% >> Here is first

	System,RebuildVars

	Echo,Value of #$pResult#$p is: %Result% >> Here is second

And I think that release notes are very actual documentation, before somebody anywhen makes the official doc from the release notes

Peter

#13 pscEx

pscEx

    Platinum Member

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

Posted 08 October 2008 - 06:43 PM

Now the user no longer has to save his selection, he can just change it in the interface and it will be set during the next build...

Since a while I'm thinking to add additional arguments to the Set command

Set,%var%,xxx,GLOBAL
Set,%var%,xxx,PERMANENT
Set,%var%,xxx,INTERFACE

But I'm still not satisfied with my own solutions, or have some troubles to implement (INTERFACE)

They will come (within 3 Latin days) maybe in WB 078

Peter

#14 pecd.net

pecd.net

    Silver Member

  • .script developer
  • 947 posts
  •  
    Germany

Posted 08 October 2008 - 06:45 PM

good idea...for now my problem is solved, but your approach would be more elgant and easier to understand...

#15 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 09 October 2008 - 12:27 AM

Since a while I'm thinking to add additional arguments to the Set command

Set,%var%,xxx,GLOBAL
Set,%var%,xxx,PERMANENT
Set,%var%,xxx,INTERFACE

Hi Peter,

That sounds like a very good implementation.

Regards,
Galapo.

#16 pscEx

pscEx

    Platinum Member

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

Posted 09 October 2008 - 04:51 PM

After playing a bit with you example this (hopefully) fixed my problem...

IniWrite,%projectdir%\script.project,Variables,#$pSourceDir#$p,"Path to selected source"
System,REBUILDVARS

the changed contents of %SourceDir% is vaild for all scripts that run after this..

Sorry that I see that so late, but this code is a bit dangerous:

%SourceDir% is a path defined in WinBuilder's environment.
Your change makes it to a project defined variable. So:

The entry remains in script.project. And on the next build the defined %sourcedir% variable will be overwritten by the entry in script.project, and will be valid from the very first begin, not only (as you explained above) after declaration.

Are you sure that this is what you want?

Peter

#17 pecd.net

pecd.net

    Silver Member

  • .script developer
  • 947 posts
  •  
    Germany

Posted 09 October 2008 - 05:56 PM

Hmm, as i understand it, it is waht i want...the selected %sourcedir% is set in the first script in my project and is projectwide.

It stays set until i select something else in my "select source script". Again when reselcting a path it will be set projectwide on the next build.

In this project the normal "Source tab" is not used at all...all source managment is done in the script and the selected source should stay until a new one is selected...

If i wanted it to be removed after the build i could delete the varible from the project at the end of the build with ONBUILDEXIT:-))

Or is there anything i missed here?

#18 pscEx

pscEx

    Platinum Member

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

Posted 09 October 2008 - 06:04 PM

If i wanted it to be removed after the build i could delete the varible from the project at the end of the build with ONBUILDEXIT:-))

I did not write this just to test of your intelligency!
You won! :confused1:

Peter :cheers:

BTW: The post has been seriously meant. If an unexperienced user uses your suggestion, he/she may get a lot of troubles.

#19 pecd.net

pecd.net

    Silver Member

  • .script developer
  • 947 posts
  •  
    Germany

Posted 09 October 2008 - 06:24 PM

Peter, i really thank you...i could have easily made a mistake...you are always welcome!

#20 pscEx

pscEx

    Platinum Member

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

Posted 09 October 2008 - 06:41 PM

In this project the normal "Source tab" is not used at all...all source managment is done in the script and the selected source should stay until a new one is selected...

Not, that i'm bored and waiting for new tasks!

But:

In your constellation, an initial source CD seems to be obsolete.
But if you do not have one, WinBuilder complains.

Would it be an usable option to have a choice for 'source needed' YES / NO?

Peter

#21 pecd.net

pecd.net

    Silver Member

  • .script developer
  • 947 posts
  •  
    Germany

Posted 09 October 2008 - 07:44 PM

well, i set the initial source to %basedir% as it always exists (and so i do not get an error). During the first run the source is set by my selectsource script...

the only thing i would like is an option to hide the sourcetab to not confuse the user...and maybe even the other tabs (something like a switch between basic and advanced mode)

#22 pscEx

pscEx

    Platinum Member

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

Posted 09 October 2008 - 07:54 PM

well, i set the initial source to %basedir% as it always exists (and so i do not get an error). During the first run the source is set by my selectsource script...

the only thing i would like is an option to hide the sourcetab to not confuse the user...and maybe even the other tabs (something like a switch between basic and advanced mode)

Let me repeat your 'request'
  • Define an option to
  • preset %SourceDir% with %BaseDir%
  • hide the source tab
Correct? If yes, wait for beta 5 k

There will be an entry 'script.project:Main.??=False / True'
?? could be 'CT' but I think that would not be reasonable.
I suggest 'AutoSource'

Peter :confused1:

BTW explain 'and maybe even the other tabs'

#23 pecd.net

pecd.net

    Silver Member

  • .script developer
  • 947 posts
  •  
    Germany

Posted 10 October 2008 - 05:14 AM

'and maybe even the other tabs'

i was thinking that maybe the newbie does not need the buttons script and codebox, too.

I would hide them and only show them when the users switches to advanced mode...but then there stil is the log button, and only the log button looks strange...so for now we better leave it as it is...just without the source button.-)

#24 Galapo

Galapo

    Platinum Member

  • .script developer
  • 3841 posts
  •  
    Australia

Posted 10 October 2008 - 05:21 AM

I remember a while ago just after 074 was released that I also suggested having 'basic' and 'advanced' interface modes. I still think it's a good idea and I'm glad someone else is suggesting it.

Regards,
Galapo.

#25 pecd.net

pecd.net

    Silver Member

  • .script developer
  • 947 posts
  •  
    Germany

Posted 10 October 2008 - 07:15 AM

Well i still think it is useful, but maybe to get there we should reorganzie the buttons and maybe this is too much for now, psc has still a lot of work to do...

What do you think peter?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users