Jump to content











Photo

Application scripts


  • Please log in to reply
3 replies to this topic

#1 pscEx

pscEx

    Platinum Member

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

Posted 04 November 2006 - 11:27 AM

Let me use CDWriter.Script as sample. Parts of it's code is:
[variables]

%ProgramName%=CD Writer - Burn Cd and Dvd

%ProgramFolder%=sCDWriter

%ProgramExe%=x:\programs\%ProgramFolder%\scdwriter.exe

%ProjectInfo%=%ProjectDir%\ProjectInfo.ini



[process]

echo,"Making new directories.."

DirMake,"%targetdir%\Programs"

DirMake,"%targetdir%\Programs\%ProgramFolder%"

echo,"Extracting %ProgramName%.."

ExtractAllFiles,"%ScriptFile%","Internal-files","%targetdir%\Programs\%ProgramFolder%"

echo,"Adding item to xoblite menu.."

If,ExistFile,"%targetdir%\Programs\XobLite\menu.rc",TxTAddLine,"%targetdir%\Programs\XobLite\menu.rc","[exec] (%ProgramName%)	 {%ProgramExe%}","append","3"

echo,"Adding item to shortcut.inf menu.."

If,NotExistFile,"%TargetDir%\i386\system32\shortcut.inf",FileCreateBlank,"%TargetDir%\i386\system32\shortcut.inf"

TXTAddLine,"%TargetDir%\i386\system32\shortcut.inf","1,!PE\Programs\scdwriter\scdwriter.exe,!DE\Small CD-Writer","Append"

TXTAddLine,"%TargetDir%\i386\system32\shortcut.inf","1,!PE\Programs\scdwriter\scdwriter.exe,!SM\Small CD-Writer","Append"

Run,%BaseDir%\Archive\Build\ScriptLog.script,Process-log
As to be seen the target programs folder name is hardcoded.
That may conflict with other scripts using localized names.

Let's do this:

1st create a new variable %TargetProg% and fill it with the value of the localized program folder name.

[Variables]

...

%TargetProg%=

...

[Process]

IniRead,"%ProjectInfo%","Paths","Application_Data","%TargetProg%"

...

2nd replace the hardcoded '\programs' by '\%TargetProg%'

[process]

...

If,NotExistDir,"%targetdir%\Programs",DirMake,"%targetdir%\%TargetProg%"

DirMake,"%targetdir%\%TargetProg%\%ProgramFolder%"

...

ExtractAllFiles,"%ScriptFile%","Internal-files","%targetdir%\%TargetProg%\%ProgramFolder%"

...

If,ExistFile,"%targetdir%\%TargetProg%\XobLite\menu.rc",TxTAddLine,"%targetdir%\%TargetProg%\XobLite\menu.rc","[exec] (%ProgramName%)	 {%ProgramExe%}","append","3"

...

In this special case there is a 'addon' to the replacement: A predefined variable:
[variables]

...

%ProgramExe%=x:\programs\%ProgramFolder%\scdwriter.exe

...



[process]

...

If,ExistFile,"%targetdir%\%TargetProg%\XobLite\menu.rc",TxTAddLine,"%targetdir%\%TargetProg%\XobLite\menu.rc","[exec] (%ProgramName%)	 {[b]%ProgramExe%[/b]}","append","3"

...

Here we have to set the variable rather then to predefine (the x: better should be replaced by %SystemDrive%)
[variables]

...

%ProgramExe%=

...



[process]

...

Set,%ProgramExe%,"#$pSystemDrive#$p:\%TargetProg%\%ProgramFolder%\scdwriter.exe"

If,ExistFile,"%targetdir%\%TargetProg%\XobLite\menu.rc",TxTAddLine,"%targetdir%\%TargetProg%\XobLite\menu.rc","[exec] (%ProgramName%)	 {%ProgramExe%}","append","3"

...

3rd define shortcuts:

Add-Shortcut,"DE","%ProgramExe%"

Add-Shortcut,"SM","%ProgramExe%"

Peter

#2 pedrole15

pedrole15

    Silver Member

  • .script developer
  • 731 posts
  •  
    France

Posted 15 November 2006 - 08:23 PM

I want to add support for BuilModel in MakeScript
The example you give here use the old shortcut not BuildModel
So look at this script build by MakeScript if I'm right in translation ?

[Variables]

// %ProgramsDrive%=X:\Programs

// %ProgDir%=%TargetDir%\Programs

%ShC%=#$pSystemRoot#$p

%SpCar%=#$

%ProgramMenu%=Irfanview



[Set-Variables]

Iniread,"%ProjectInfo%","Paths","Program_Files",%Program_Files% 

Set,"%ProgramsDrive%","x:\%Program_Files%"

Set,"%ProgDir%","%TargetDir%\%Program_Files%"
Read folderName of Program Files from ProjectInfo
I'm not sure that this work , can't set 1 variable with 2 variables
[Set-CD-Variables]

Set,"%ProgDir%","%BaseDir%\CDPrograms\Programs"

Set,"%ProgramsDrive%","%CDDrive%\Programs"

Set,"%ShC%","!PS"
The option Run from CD will not work with BuilModel
So this section must be deleted
or if you find a way to make it work ?
[ShorcutDesktop]

//TXTAddLine,"%TargetDir%\i386\system32\shortcut.inf","1,%ShC%\Programs\IrfanView\i_view32.exe,!DE\Irfanview","Append"

Run,%BuildModelScript%,Add-Shortcut,"DE","%ShC%\%Program_Files%\IrfanView\i_view32.exe","%ProgramMenu%"



[ShorcutStart]

If,%pCheckBox6%,Equal,True,Run,%ScriptFile%,StartFolder

//TXTAddLine,"%TargetDir%\i386\system32\shortcut.inf","1,%ShC%\Programs\IrfanView\i_view32.exe,!SM\%ProgramMenu%","Append"

Run,%BuildModelScript%,Add-Shortcut,"SM","%ShC%\%Program_Files%\IrfanView\i_view32.exe","%ProgramMenu%"



[ShorcutQL]

//TXTAddLine,"%TargetDir%\i386\system32\shortcut.inf","1,%ShC%\Programs\IrfanView\i_view32.exe,!QL\Irfanview","Append"

Run,%BuildModelScript%,Add-Shortcut,"QL","%ShC%\%Program_Files%\IrfanView\i_view32.exe","%ProgramMenu%"



[ShorcutST]

//TXTAddLine,"%TargetDir%\i386\system32\shortcut.inf","1,%ShC%\Programs\IrfanView\i_view32.exe,!ST\Irfanview","Append"

Run,%BuildModelScript%,Add-Shortcut,"ST","%ShC%\%Program_Files%\IrfanView\i_view32.exe","%ProgramMenu%"
I hope it's right like this ? :P
[StartFolder]

Set,"%ProgramMenu%","%pTextBox2%\Irfanview"

TXTAddLine,"%TargetDir%\i386\system32\shortcut.inf","2,!SM\%pTextBox2%","Append"
This is for create a folder in the StartMenu .
I don't know how to make this with BuilModel ? :P

Pedro

#3 pscEx

pscEx

    Platinum Member

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

Posted 16 November 2006 - 08:07 AM

I want to add support for BuilModel in MakeScript
The example you give here use the old shortcut not BuildModel
So look at this script build by MakeScript if I'm right in translation ?


[Set-Variables]

Iniread,"%ProjectInfo%","Paths","Program_Files",%Program_Files% 

Set,"%ProgramsDrive%","x:\%Program_Files%"

Set,"%ProgDir%","%TargetDir%\%Program_Files%"
The way is correct.
But I strictly recommand not to use the hardcoded X:
Use instead of that #$pSystemDrive#$p which is decoded at run time.

Additionally:
This code is inside the makescript script.
You have to write the same functionality into the generated script.
That will also make the 'run from CD' option usable.

Run,%BuildModelScript%,Add-Shortcut,"ST","%ShC%\%Program_Files%\IrfanView\i_view32.exe","%ProgramMenu%"
That would bring %Programmenu% as visible title of the shortcut.
Should be
Run,%BuildModelScript%,Add-Shortcut,"ST","%ShC%\%Program_Files%\IrfanView\i_view32.exe","IrfanView"

[StartFolder]

Set,"%ProgramMenu%","%pTextBox2%\Irfanview"

TXTAddLine,"%TargetDir%\i386\system32\shortcut.inf","2,!SM\%pTextBox2%","Append"

This is for create a folder in the StartMenu .
I don't know how to make this with BuilModel ? :P

Iniread,"%ProjectInfo%","Paths","Startmenu_Programs",%Startmenu% 

DirMake,"%Startmenu%\IrfanView"

Peter

#4 sepa

sepa
  • Members
  • 6 posts

Posted 01 February 2007 - 11:42 AM

Iniread,"%ProjectInfo%","Paths","Startmenu_Programs",%Startmenu%
DirMake,"%Startmenu%\IrfanView"

wrong Dir for dirmake
in 067 need use
DirMake,"%TargetDir%\%Startmenu%\IrfanView"





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users