Jump to content











Photo

How to use autoruns.script


  • Please log in to reply
36 replies to this topic

#26 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 27 October 2006 - 04:49 PM

But if he resets an existing file by FileCreateBlank, this affects other scripts.
Peter

Yes, exactly, that's what I was talking for a while :P
Why would we need to have all that just because FileCreateBlank was unsafe?
I hope Nuno already fixed it, at list he promised :P
:P
Alexei

#27 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 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 27 October 2006 - 11:24 PM

..
Why would we need to have all that just because FileCreateBlank was unsafe?


Would this be FileCreateBlank's fault?

I think this still depends on the end-user.. :P


Someone could also code something like:
DirDelete,"%WindowsDir%"

This would still be considered unsafe unless an enourmous code filtering was imposed. Besides performance wouldn't this also break flexibility? :P

#28 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 28 October 2006 - 02:29 AM

Would this be FileCreateBlank's fault?

I think this still depends on the end-user.. :P
Someone could also code something like:

DirDelete,"%WindowsDir%"

This would still be considered unsafe unless an enourmous code filtering was imposed. Besides performance wouldn't this also break flexibility? :P

Can't agree :P
Cleaning file by FileCreateBlank is a "side effect" that can be easily overlooked by developer.
Explanation: Developer supposed (wrongly) that file doesn't exist.
DirDelete is obviously intentional :P
Basically, there are two styles of correct processing of "unexpected situations". I would call them "relaxed style" and "strict style".
relaxed style:
- FileCreateBlank does nothing if file exists.
- DirDelete does nothing if directory does not exist.
- DirCreate does nothing if directory exists.
strict style:
- FileCreateBlank raises error if file exists.
- DirDelete raises error if directory does not exist.
- DirCreate raises error if directory exists.
Deletion of file contents by FileCreateBlank has no analog in DirDelete.
However, if DirCreate erased everything of existing directory, it would be alike FileCreateBlank erasing file contents :P

I see the fault of FileCreateBlank is that "create"-type call (percepted as safe) deletes information, i.e. acts as "delete"-type call (potentially unsafe).
Should we consider potentially dangerous (spider) in something that looks safe (bed) to be a bug? :P

It's usually preferable to keep same style (relaxed/strict) throughout the system, or make it depend on "danger level" of the operation.
I would say, relaxed style may be preferable to WinBuilder because:
- We manipulate with the Target, so no real danger is something went wrong.
- Less writing, no need to duplicate names in IF and "call".

BTW, "slacker style": :P
- first TxtAddLine creates file (no FileCreateBlank ever needed).
- first FileCopy creates target directory.

And the last notes:
- Any "default" or "dangerous" action should be listed in the processing log.
- We can disallow "very dangerous" actions (such as DirDelete) outside the Target. In fact, I really dislike an idea of user-defined path to the Target.

And finally, Nuno may want to add optional "style" parameter to some script commands (with "relaxed" as default for create-like functions and "strict" for delete-like functions).

:P
Alexei

#29 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 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 28 October 2006 - 10:01 AM

Very good description Alexei! :P

#30 pscEx

pscEx

    Platinum Member

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

Posted 28 October 2006 - 11:36 AM

Can't agree :P
Cleaning file by FileCreateBlank is a "side effect" that can be easily overlooked by developer.
...
And finally, Nuno may want to add optional "style" parameter to some script commands (with "relaxed" as default for create-like functions and "strict" for delete-like functions).

:P
Alexei


:P

Peter

#31 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 30 October 2006 - 04:20 PM

:P
Peter

As we finally agreed with Peter :P
@Nuno,
Can we have FileCreateBlank not erasing data in the upcoming WinBuilder betta, please?
:P
Alexei

#32 Brito

Brito

    Platinum Member

  • .script developer
  • 10616 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 31 October 2006 - 12:43 AM

Will comply! :P

#33 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 31 October 2006 - 02:05 AM

Will comply! :P

Thanks :P
:P
Alexei

#34 Alexei

Alexei

    Silver Member

  • .script developer
  • 664 posts

Posted 01 November 2006 - 02:06 AM

:P Peter
Isn't it the time (052 betta 7 - FileCreateBlank) to return to TxtAddLine for Autoruns?
:P
Alexei

#35 h7se

h7se

    Frequent Member

  • Developer
  • 264 posts
  •  
    Palestine

Posted 28 January 2007 - 06:02 PM

Run,%AutoRunScript%,Add,%SystemDrive%\Programs\Rename\Rename.exe

is this in a correct format ?

should i use %SystemDrive% or %pedrive% so the script can convert the value correctlly on build time

#36 pscEx

pscEx

    Platinum Member

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

Posted 30 January 2007 - 09:12 AM

Run,%AutoRunScript%,Add,%SystemDrive%\Programs\Rename\Rename.exe

is this in a correct format ?

should i use %SystemDrive% or %pedrive% so the script can convert the value correctlly on build time


If you use %PEDrive% then a hardcoded drive letter (usually X:) will be written into autostart.cmd.
%SystemDrive% will be written as it is. During run of autostart.cmd it will be replaced by the actual drive letter, which usually is X: too, but different in case of FBWF.

A hint: You should use #$pSYstemDrive#$p
Reasaon: If (out of whatever reason) WinBuilder has a variable %SystemDrive% defined, then %SystemDrive% will be replaced by its contents, which is wrong.
The #$p is replaced by % when writing into autostart.cmd. That is the result you want.

Peter

#37 pscEx

pscEx

    Platinum Member

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

Posted 30 January 2007 - 09:14 AM

Run,%AutoRunScript%,Add,%SystemDrive%\Programs\Rename\Rename.exe

is this in a correct format ?

should i use %SystemDrive% or %pedrive% so the script can convert the value correctlly on build time


If you use %PEDrive% then a hardcoded drive letter (usually X:) will be written into autostart.cmd.
%SystemDrive% will be written as it is. During run of autostart.cmd it will be replaced by the actual drive letter, which usually is X: too, but different in case of FBWF.

A hint: You should use #$pSYstemDrive#$p
Reasaon: If (out of whatever reason) WinBuilder has a variable %SystemDrive% defined, then %SystemDrive% will be replaced by its contents, which is wrong.
The #$p is replaced by % when writing into autostart.cmd. That is the result you want.

Peter




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users