Jump to content











Photo
- - - - -

Script for multiple projects?


Best Answer pscEx , 06 September 2014 - 06:41 AM

Here the quick and clean version:

[Process]
Retrieve,FILEVERSION,%SourceDir%\Setup.exe,%_version%
StrFormat,LEFT,%_Version%,3,%_Version%
If,%_Version%,EQUAL,5.1,Set,%SourceType%,XP
If,%_Version%,EQUAL,6.0,Set,%SourceType%,Vista
If,%_Version%,EQUAL,6.1,Set,%SourceType%,Win7
If,%_Version%,EQUAL,6.2,Set,%SourceType%,Win80
If,%_Version%,EQUAL,6.3,Set,%SourceType%,Win81
If,EXISTVAR,%SourceType%,Run,%ScriptFile%,Process_%SourceType%
Else,ECHO,"Type of source CD not known"

[Process_XP]
// Put XP code here

[Process_Vista]
// Put Vista code here

[Process_Win7]
// Put Win7 code here

[Process_Win80]
// Put Win80 code here

[Process_Win81]
// Put Win81 code here

@QuentinX5: As a small challenge to you:

Expand to distinguish x86 and x64 :cheers:

 

Peter

Go to the full post


  • Please log in to reply
5 replies to this topic

#1 QuentinX5

QuentinX5

    Member

  • Members
  • 39 posts
  •  
    United States

Posted 03 September 2014 - 06:50 PM

Hi there.

So I migrate between LiveXP and Win7PE, and one of the tools that I use adds a registry key to Windows. However, the registry for LiveXP and Win7PE is different, so I have to change the process every time I want to add said registry key. Is there a way inside the script to program a different [Process] function for both LiveXP and Win7PE, and even possibly branch out to doing so for other projects/versions of Windows depending on where it is needed?

Thanks in advance. :)



#2 pscEx

pscEx

    Platinum Member

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

Posted 04 September 2014 - 11:21 AM

The quick way:

[Process]
Run,%ScriptFile%,Process_%ProjectTitle%

[Process_LiveXP]
...
// XP code here

[Process_Win7PE]
...
// Win7 code here

Of course the [Process_????] must contain your real project title.

 

The disadvantage: The real project title may vary from installation to installation. When you copy the script to a different installation, you perhaps have to adapt the ????

 

Peter



#3 QuentinX5

QuentinX5

    Member

  • Members
  • 39 posts
  •  
    United States

Posted 04 September 2014 - 05:08 PM

The quick way:

[Process]
Run,%ScriptFile%,Process_%ProjectTitle%

[Process_LiveXP]
...
// XP code here

[Process_Win7PE]
...
// Win7 code here

Of course the [Process_????] must contain your real project title.

 

The disadvantage: The real project title may vary from installation to installation. When you copy the script to a different installation, you perhaps have to adapt the ????

 

Peter

 

Alright, you said that was the quick way. Myself being a programmer, I take it that that would be the "improper" way of doing it, so what would be the non-quick way of doing it? Would it be writing it to work depending on the OS type?



#4 pscEx

pscEx

    Platinum Member

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

Posted 04 September 2014 - 06:15 PM

Alright, you said that was the quick way. Myself being a programmer, I take it that that would be the "improper" way of doing it, so what would be the non-quick way of doing it? Would it be writing it to work depending on the OS type?

I avoided to say "quick and dirty way". The suggestion brings you an quick result to solve your issue with the known disavantages.

 

You are right, there are "universal" solutions possible, but I did not want actually to spend time to query for XP and Win7PE recognisation in all existing WinBuilder projects.

May be we can do it together.

 

BTW: I'm also a programmer, doing this job since the ice-age before Billy the Door ...

 

BTW2: For every new project, you can add a

[Process_????]

section, and finally may have "unlimited" process sections.

 

Peter


  • QuentinX5 likes this

#5 pscEx

pscEx

    Platinum Member

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

Posted 06 September 2014 - 06:41 AM   Best Answer

Here the quick and clean version:

[Process]
Retrieve,FILEVERSION,%SourceDir%\Setup.exe,%_version%
StrFormat,LEFT,%_Version%,3,%_Version%
If,%_Version%,EQUAL,5.1,Set,%SourceType%,XP
If,%_Version%,EQUAL,6.0,Set,%SourceType%,Vista
If,%_Version%,EQUAL,6.1,Set,%SourceType%,Win7
If,%_Version%,EQUAL,6.2,Set,%SourceType%,Win80
If,%_Version%,EQUAL,6.3,Set,%SourceType%,Win81
If,EXISTVAR,%SourceType%,Run,%ScriptFile%,Process_%SourceType%
Else,ECHO,"Type of source CD not known"

[Process_XP]
// Put XP code here

[Process_Vista]
// Put Vista code here

[Process_Win7]
// Put Win7 code here

[Process_Win80]
// Put Win80 code here

[Process_Win81]
// Put Win81 code here

@QuentinX5: As a small challenge to you:

Expand to distinguish x86 and x64 :cheers:

 

Peter


  • QuentinX5 likes this

#6 QuentinX5

QuentinX5

    Member

  • Members
  • 39 posts
  •  
    United States

Posted 06 September 2014 - 04:28 PM

Here the quick and clean version:

[Process]
Retrieve,FILEVERSION,%SourceDir%\Setup.exe,%_version%
StrFormat,LEFT,%_Version%,3,%_Version%
If,%_Version%,EQUAL,5.1,Set,%SourceType%,XP
If,%_Version%,EQUAL,6.0,Set,%SourceType%,Vista
If,%_Version%,EQUAL,6.1,Set,%SourceType%,Win7
If,%_Version%,EQUAL,6.2,Set,%SourceType%,Win80
If,%_Version%,EQUAL,6.3,Set,%SourceType%,Win81
If,EXISTVAR,%SourceType%,Run,%ScriptFile%,Process_%SourceType%
Else,ECHO,"Type of source CD not known"

[Process_XP]
// Put XP code here

[Process_Vista]
// Put Vista code here

[Process_Win7]
// Put Win7 code here

[Process_Win80]
// Put Win80 code here

[Process_Win81]
// Put Win81 code here

@QuentinX5: As a small challenge to you:

Expand to distinguish x86 and x64 :cheers:

 

Peter

 

Exactly what I was looking for. Thank you!
And also, thank you for the challenge. :D






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users