Topic: Converting script between PESE and XPE  (Read 1257 times)

Re: Converting script between PESE and XPE
« Reply #20 on: November 20, 2019, 04:40:05 PM »

James

  • Grand Chef
  • *****
  • Location: USA
  • Date Registered: Dec 2017
  • Posts: 2272
Yeah, I guess I could have worded certain statements differently...
Although I thought I was encouraging Sandy to share for the sake of others...

Re: Converting script between PESE and XPE
« Reply #21 on: November 20, 2019, 04:49:20 PM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Although I thought I was encouraging Sandy to share for the sake of others...

Good,

sandy, as you see all waiting you share your work, even James.  :thumbsup:

Better on a topic at Plugin section ( to avoid things ... )
http://theoven.org/index.php?board=9.0

:turtle:

Re: Converting script between PESE and XPE
« Reply #22 on: November 21, 2019, 02:07:23 AM »

RoyM

  • Jr. Chef
  • **
  • Date Registered: Aug 2017
  • Posts: 80


So here is se2xpe.script.
Tested with newest 10XPE
It is very basic, and just a proof of concept.
I wrote it as a %GTools%\.script, so that we may call it from individual scripts with a few lines of code,
 it can be expanded and improved later.

Usage of se2xpe.script:
Add Non-XPE.script to %BaseDir%\Projects\MyPlugins\..\..\Non-XPE.script
     (Do not change name of script, "just an example")

Edit Non-XPE.script to include these lines immediately under [process].
Echo,".....Calling se2xpe.script",WARN
Set,%XScriptfile%,%ScriptFile%,Permanent
IniRead,%XScriptfile%,Main,Project,%XProject%
Run,%GTools%\se2xpe.script,Process

Also Edit Non-XPE.script to include next line.  (under main of Non-XPE.script)
Project=Win10XPE

Make your build, simple scripts will build without problems.
As I said, this is just proof of concept.

Not working Stuff:
Call, Needs "," removed             // Change Call, manually edit Call (NO , ), Until a fix is found
RegAddBoot Unrecognized command.    //Comment out until a fix is found.
Add_Shortcut changed to AddShortcut // not working

Before I proceed further, I wanted to see if there were any advice for Not Working Stuff, Short of Hackin' on the API.
It's working quite well, but I'm hoping someone has a more elegant solution.

Regards.
RoyM

Code: [Select]
[main]
Title=se2xpe
Description=Allow other plugins not built for XPE
Selected=True
Level=5
Version=1
Mandatory=False
Author=RoyM
Download_Level=0
NoWarning=False
Project=Win10xpe

[INFO]
Add se2xpe.script to Tools folder.
Add Project=Win10XPE (under main of plugin to convert)
Add next lines (under process of plugin to convert)

Echo,".....Calling se2xpe.script",WARN
Set,%XScriptfile%,%ScriptFile%,Permanent
IniRead,%XScriptfile%,Main,Project,%XProject%
Run,%GTools%\se2xpe.script,Process

[NOTES]
Call, Needs , removed             // Change Call, manually edit Call (NO , ), Until a fix is found
RegAddBoot Unrecognized command.  //Comment out until a fix is found.  *** Set,%_ML_RegAddBootMethod%,NOT_IMPLEMENTED_WARN,Permanent *** NOT WORKING???
Add_Shortcut changed to AddShortcut // not working
See if I can get %scriptfile% of calling script from withing se2xpe
Add variable to (plugin to convert) so we can convert From --> To

[variables]
%ProgramTitle%=se2xpe
%ProgramEXE%=
%ProgramFolder%=se2xpe

[process]
Echo,".....Starting se2xpe.script",WARN
Echo,Called from %XScriptfile% For %XProject%
If,%XProject%,equal,Win10xpe,run,%GTools%\se2xpe.script,Win10xpe
Echo,".....Ending se2xpe.script",WARN

[Win10xpe]
Set,%BuildClass%,3,Permanent
Set,%_ML_Shortcut_TYPE%,NO,Permanent
Set,%_ML_RF_TYPE%,NO,Permanent
Set,%_ML_RegAddBootMethod%,NOT_IMPLEMENTED_WARN,Permanent
Set,%PluginArch%,,Permanent
Set,%OSFamily%,NT6,Permanent
Set,%TargetWOW64%,x86,Permanent
// Set,%SourceArch%,x64
// Set - You cannot set WinBuilder system variables PERMANENT: [%Tools%=%BaseDir%\Projects\Tools]
// Set,%Tools%,%GTools%,Permanent
Set,%Tools%,%GTools%
// Set,%PluginArch%,,
Set,%OSFamily%,NT6
Set,%TargetWOW64%,x86
// Set,%SourceArch%,x64
// Set,%SourceArch%,%Architecture%,Permanent
Set,%SourceArch%,%Architecture%
Set,%TargetDir%,%GTarget%
Set,%Target_Sys%,%GTarget_Sys%
Set,%Target_Win%,%GTarget_Win%
Set,%ProjectTemp%,%GTemp%
// Set,%ProjectTemp%\TempExtractFolder,%GTemp%
Set,%target_win%,%GTarget_Win%
Set,%GlobalTemplates%,%ProgCache%
Set,%Add_Shortcut%,%AddShortcut%,Permanent









Re: Converting script between PESE and XPE
« Reply #23 on: November 21, 2019, 10:29:32 AM »

sharp

  • Jr. Chef
  • **
  • Date Registered: Jun 2019
  • Posts: 76
Thanks everybody for their replies. And I apologize to re-open the topic.
I used to work on PESE and nowadays try to examine XPE.
Regards.

Re: Converting script between PESE and XPE
« Reply #24 on: November 21, 2019, 11:31:02 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Hi RoyM

good head start, but better share on another topic

I recently noticed posts deleted from " Project World ยป Win10XPE HomePage" section without a reason (and I can not see any reason) and I try to figure out what is happening.
- one thing I noticed, posts deleted are after a period of time and probably not noticed by the majority.  Not forum policy at all.

To keep info and continue, consider opening another topic like at plugin section.


Some tips I noticed on your codes:

In ADDITION to your codes:

*
Set,%Tools%,%GTools%,Permanent
should be working fine, ignore what is written at the log ;)
+
also better use a separate tools eg. copy Tools of Win10PESE to a folder and use something like
Set,%Tools%,%BaseDir%\Projects\Tools\Win10PESE,Permanent
this will get rest work ;)

*
adding Macro Library temporarly will get Require_FileQ, Require,FileList , Call lines operational (I guess after tools) and avoid Add_Shortcut lines fail

eg. (not tested, but this will quickly help I guess)

Set,%ReadConfig%,%ProjectDir%\script.project
Set,%api%,%ProjectDir%\Macro_Library.script,Permanent
//-
IniRead,%ReadConfig%,Variables,#$pGSource#$p,%t%
Call,SourceDirSet,%t%
IniRead,%ReadConfig%,Variables,#$pGTarget#$p,%t%
Call,TargetDirSet,%t%
IniRead,%ReadConfig%,Variables,#$pArchitecture#$p,%t%
Set,%SourceArch%,%t%,Permanent
IniRead,%ReadConfig%,Variables,#$pOS#$p,%t%
IniWrite,%ProjectDir%\Script.Project,IniVariables,OS,%t%
IniRead,%ReadConfig%,Variables,#$pGISO#$p,%t%
IniWrite,%ProjectDir%\Script.Project,IniVariables,TargetFinalDir,%t%
Set,%TargetProfilesBaseDir%,%TargetDir%,Permanent
Set,%TargetProfilesUserDir%,%TargetProfilesBaseDir%\Users\Default,Permanent
IniRead,%ReadConfig%,Features,WoW64basic,%t%
If,%t%,Equal,True,Set,%TargetWOW64%,x86,Permanent
Else,Set,%TargetWOW64%,%SourceArch%,Permanent
IniRead,%ReadConfig%,Variables,#$pLanguage#$p,%t%
Set,%DistLang%,%t%,Permanent
IniRead,%ReadConfig%,Variables,#$pImage#$p,%WIMIndex%
IniWrite,%ProjectDir%\script.project,IniVariables,WIMIndex,%WIMIndex%
IniRead,%ReadConfig%,Variables,#$pFallBackLanguage#$p,%FallBackLanguageVar%
StrFormat,Right,%FallBackLanguageVar%,1,%t%
If,%t%,Equal,|,StrFormat,RTRIM,%FallBackLanguageVar%,1,%FallBackLanguageVar%
StrFormat,Left,%FallBackLanguageVar%,1,%t%
If,%t%,Equal,|,StrFormat,LTRIM,%FallBackLanguageVar%,1,%FallBackLanguageVar%
Call,MuiLangSet,%FallBackLanguageVar%

after you use plugins, revert back to original condition with something like (maybe via a 2nd plugin at the end of plugins) starting with:
Set,%api%,%ProjectDir%\Macro.script,Permanent
IniWrite,%ProjectDir%\script.project,Variables,#$papi#$p,#$pProjectDir#$p\Macro.script



NOT tested, I quickly write codes from my old last year notes, they will give you a better head start after testing.

*
Set,%Add_Shortcut%,%AddShortcut%,Permanent
this line is wrong, see tips on one of my previous post.

It is quite easy to create Add_Shortcut macro when you follow tips and spend some time on testing,
 I guess sharp already did require work to get Add_Shortcut operational (I also did Add_Shortcut operational last year but could not find last year Add_Shortcut plugin around)
  ,not too hard, but requires time to test things and time...  See tips on previous posts.

---
Better continue this subject on another topic, we are a bit away from the topic subject.

Re: Converting script between PESE and XPE
« Reply #25 on: November 21, 2019, 11:36:03 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350
Thanks everybody for their replies. And I apologize to re-open the topic.
I used to work on PESE and nowadays try to examine XPE.
Regards.

Hi sharp,

Edit: sorry I mixed you with sandy  :wink:

After sandy and RoyM share their work and improve, hopefully, such a thing will end conversion related things.



@Sandy

also see this post: http://theoven.org/index.php?topic=2834.msg35012#msg35012

maybe you can write a "1903 support" plugin to get Win10PESE start working. :wink:

Also I hope you share your api which I guess 200 lines of codes will cover some other macros.  :wink:

as written previously, better on another topic.
http://theoven.org/index.php?board=9.0

hopefully, such work will end this "conversion" posts from different people, like the current topic and many posts.  :thumbsup:
« Last Edit: November 21, 2019, 01:01:03 PM by Lancelot »

Re: Converting script between PESE and XPE
« Reply #26 on: November 22, 2019, 03:48:19 AM »

Malok

  • Chef
  • ***
  • Location: Canada
  • Date Registered: Aug 2016
  • Posts: 202
I  didn't see any new topic created...


Also Edit Non-XPE.script to include next line.  (under main of Non-XPE.script)
Project=Win10XPE

Make your build, simple scripts will build without problems.
As I said, this is just proof of concept.

Not working Stuff:
Call, Needs "," removed             // Change Call, manually edit Call (NO , ), Until a fix is found
RegAddBoot Unrecognized command.    //Comment out until a fix is found.
Add_Shortcut changed to AddShortcut // not working

Before I proceed further, I wanted to see if there were any advice for Not Working Stuff, Short of Hackin' on the API.
It's working quite well, but I'm hoping someone has a more elegant solution.

Regards.
RoyM

You Can write your plugin to a text file and use command like

Code: [Select]
TXTReplace,%PluginFile%,"Call,Download,%ProvideFiles%","Download,%ProvideFiles%"
TXTReplace,%PluginFile%,Call#$cEcho,EchoExtended
TXTReplace,%TextFile%,Call#$cStart#$c#$c,Start#$c#$c

This replaces all occurrence of Call,Download in the text file with Download
Same with Call,Echo -----> EchoExtended

This is not API related and cause big problems, I tried to make converter from the work of another member here and it works very good with standard plugins but as soon as it gets more advanced syntax or dirty tricks and hacks in the code it wreak the plugin for good.

If you want to take a look it might inspire you....

Code: [Select]
[Main]
Title=PESE to XPE
Type=XPEPlugin
Description=PESE to XPE plugins converter
Author=Oscar - Malok
Date=2019.11.19
Credits=Oscar
Contact=
Version=001
Level=10
Download_Level=0
Selected=None
Mandatory=False
NoWarning=False
History001=Oscar - initial SE plugin creation
History002==Malok - XPE Packed Plugin Created 2019.11.20

[Interface]
Image_SoftwarePESE=logo10.jpg,1,5,10,18,48,48
Image_TextLabel1=Code,1,1,75,25,60,18,10,Bold
Image_TextLabel2=Converter,1,1,75,47,60,18,11,Bold
pTextLabel1="Most plugins are converted 100%. For some plugin to work properly innounp.exe must exist in \Projects\Tools\Win10PESE\ folder. Most files container scripts do not need conversion. I have noticed that a very large file container script may corrupt after conversion.",1,1,10,200,400,70,9,Bold
Button_Launch_Program="Press To Convert Plugin",1,8,10,142,150,25,Launch_Program,Launch.bmp,False,_Launch_Program_,False,""
CheckScriptCode_FileBox=,1,13,10,106,400,20,file
CheckScriptCode_TextLabel1="Select Script File To Convert",1,1,11,88,230,18,8,Bold

[Variables]
%ProgramTitle%=XPE2PESE Code Converter
%TarMy%=%BaseDir%\Projects\MyPlugins\Apps\XPE Plugin Creator

[Process]
//
Echo,"%ScriptTitle% Utility Plugin - Nothing To Process..."
//--

[Launch_Program]
Echo,"Processing %ScriptTitle%..."
If,Not,ExistDir,%TarMy%,DirMake,%TarMy%
If,Not,ExistFile,%CheckScriptCode_FileBox%,Message,"Selected FileBox Script - Not Found"
If,ExistFile,%TarMy%\%CheckScriptCode_FileBox%,FileDelete,%TarMy%\%CheckScriptCode_FileBox%
//
StrFormat,FILENAME,%CheckScriptCode_FileBox%,%CheckScriptCode_FileName%
StrFormat,Split,%CheckScriptCode_FileName%,.,1,%CheckScriptCode_FileName_NoExt%
//
FileCopy,%CheckScriptCode_FileBox%,%TarMy%
Set,%PluginFile%,%TarMy%\%CheckScriptCode_FileName%
//
Echo,"%ScriptTitle% -> %PluginFile%"
//
//--Main
IniWrite,%PluginFile%,Main,Type,Plugin
IniWrite,%PluginFile%,Main,HistoryNote1,oscar XPE plugin converted with PESE2XPE utility
//
//--Variables
TXTReplace,%PluginFile%,"TargetDir","GTarget"
TXTReplace,%PluginFile%,"Target_Win","GTarget_Win"
TXTReplace,%PluginFile%,"Target_Sys","GTarget_Sys"
TXTReplace,%PluginFile%,"GlobalTemplates","ProgCache"
TXTReplace,%PluginFile%,"SourceArch","Architecture"
TXTReplace,%PluginFile%,"TargetLocalSettingsAppdata","TargetAppdataLocal",
TXTReplace,%PluginFile%,"TargetAppdata","TargetAppdataRoaming"
TXTReplace,%PluginFile%,"TargetAUAppdata","TargetProgramData"
TXTReplace,%PluginFile%,#$pTools#$p,#$pGTools#$p
TXTReplace,%PluginFile%,"ProjectTemp","GTemp"
//--Interface
TXTReplace,%PluginFile%,#$cDownloadXXX,#$cDownload
TXTReplace,%PluginFile%,[DownloadXXX,[Download
TXTReplace,%PluginFile%,"Call,Download,%ProvideFiles%","Download,%ProvideFiles%"
TXTReplace,%PluginFile%,pBevel1,Shortcut_Bevel
TXTReplace,%PluginFile%,pCheckBox1,Desktop_CheckBox
TXTReplace,%PluginFile%,pCheckBox2,StartMenu_CheckBox
TXTReplace,%PluginFile%,pCheckBox3,TaskBpin_CheckBox
TXTReplace,%PluginFile%,Quicklaunch Shortcut,Pin To TaskBar
TXTReplace,%PluginFile%,Add QuickLaunch Menu Shortcut,Add Pin To Taskbar Shortcut
TXTReplace,%PluginFile%,pTextBox1,StartMenuFolder_TextBox
TXTReplace,%PluginFile%,ScrollBox_RunFromWhere,RunFromWhere_ScrollBox
TXTReplace,%PluginFile%,Run from Normal,Run From USB
TXTReplace,%PluginFile%,pWebLabel1,HomePage_WebLabel
TXTReplace,%PluginFile%,pWebLabel2,Plugin_WebLabel
//
//--Process
//TXTReplace,%PluginFile%,"If#$c#$pRunFromWhere_ScrollBox#$p#$cEqual#$c#$qRun From RAM#$q#$cRunFromRAM","StrFormat#$cREPLACE#$c#$pRunFromWhere_ScrollBox#$p#$c#$qRun from#$s#$q#$c#$q#$q#$c#$pHere#$p"
TXTReplace,%PluginFile%,#$cBegin#$xRunFrom#$cRAM#$xEnd,",RunFromRAM",
TXTReplace,%PluginFile%,"RunFrom,RAM",RunFromRAM
//
//AddVariables,%ProjectDir%\script.project,TargetBasePath:
TXTReplace,%PluginFile%,"Set,%TargetLocalSettingsAppdata%,#$pTargetDir#$p\Users\Default\AppData\Local#$xSet,%TargetAppdata%,#$pTargetDir#$p\Users\Default\AppData\Roaming#$xSet,%TargetAUAppdata%,#$pTargetDir#$p\ProgramData",AddVariables#$c#$pProjectDir#$p\script.project#$cTargetBasePath
//
TXTReplace,%PluginFile%,Add_Shortcut#$cQuickLaunch,AddPin#$cTaskBar
TXTReplace,%PluginFile%,Add_Shortcut,AddShortcut
TXTReplace,%PluginFile%,Add_Pin,AddPin
TXTReplace,%PluginFile%,Call#$cEcho,EchoExtended
TXTReplace,%PluginFile%,DirDelete,DirDeleteQ
TXTReplace,%PluginFile%,FileDelete,FileDeleteQ
TXTReplace,%PluginFile%,Call#$cStart#$c#$c,Start#$c#$c
TXTReplace,%PluginFile%,AutoStart#$c#$c,AutoCall#$cStart#$c#$c
//
//--Process Append
IniWriteTextLine,%PluginFile%,Process,"//--",Append
IniWriteTextLine,%PluginFile%,Process,"#$s",Append
//ExtractSectionFiles,%ScriptFile%,AddFiles
TXTReplace,%PluginFile%,Require#$cFileList,ExtractSectionFiles#$c#$pScriptFile#$p#$cAddFiles
//ExtractSectionFiles,%ScriptFile%,xxx
TXTReplace,%PluginFile%,Require,ExtractSectionFiles#$c#$pScriptFile#$p
//
//
//--Delete HiveLoadAll & Create Sections
TXTReplace,%PluginFile%,Registrix,Registryx
//TXTDelLine,%PluginFile%,Run#$c#$pScriptFile#$p#$cAdd_Registry
TXTReplace,"[LoadHive]#$x#$x",%PluginFile%,If#$cNot#$c#1#$cEqual#$cHiveLoaded#$cHiveLoadALL
TXTReplace,"[UnLoadHive]#$x#$x",%PluginFile%,If#$cNot#$c#1#$cEqual#$cHiveLoaded#$cHiveUnLoadALL
TXTReplace,%PluginFile%,Registryx,Registrix
//
//--Emulate HiveLoadAll HiveUnLoadAll
If,EXISTSECTION,%PluginFile%,LoadHive,Begin
//Delete in [Add_Registry]
TXTReplace,%PluginFile%,#$x//,#$xRegHiveLoad#$cTmp_Default#$c#$pRegDefault#$p
TXTReplace,%PluginFile%,#$x//,#$xRegHiveLoad#$cTmp_Software#$c#$pRegSoftware#$p
TXTReplace,%PluginFile%,#$x//,#$xRegHiveLoad#$cTmp_System#$c#$pRegSystem#$p
TXTReplace,%PluginFile%,#$x//,#$xRegHiveUnLoad#$cTmp_Default
TXTReplace,%PluginFile%,#$x//,#$xRegHiveUnLoad#$cTmp_Software
TXTReplace,%PluginFile%,#$x//,#$xRegHiveUnLoad#$cTmp_System
//--
IniWriteTextLine,%PluginFile%,Process,Run#$c#$pScriptFile#$p#$cLoadHive,Append
IniWriteTextLine,%PluginFile%,Process,Run#$c#$pScriptFile#$p#$cAdd_Registry,Append
IniWriteTextLine,%PluginFile%,Process,Run#$c#$pScriptFile#$p#$cUnLoadHive,Append
IniWriteTextLine,%PluginFile%,Process,"//--",Append
IniWriteTextLine,%PluginFile%,LoadHIve,"RegHiveLoad#$cTmp_Software#$c#$pRegSoftware#$p"
IniWriteTextLine,%PluginFile%,LoadHIve,"RegHiveLoad#$cTmp_System#$c#$pRegSystem#$p"
IniWriteTextLine,%PluginFile%,LoadHIve,"RegHiveLoad#$cTmp_Default#$c#$pRegDefault#$p"
IniWriteTextLine,%PluginFile%,UnLoadHIve,"RegHiveUnLoad#$cTmp_Software"
IniWriteTextLine,%PluginFile%,UnLoadHIve,"RegHiveUnLoad#$cTmp_Default"
IniWriteTextLine,%PluginFile%,UnLoadHIve,"RegHiveUnLoad#$cTmp_System"
End
//
TXTReplace,%PluginFile%,[Require_FileList],[AddFiles]
If,Not,EXISTSECTION,%PluginFile%,LoadHive,Begin
If,EXISTSECTION,%PluginFile%,Require_FileList,TXTReplace,%PluginFile%,Require#$cFileList#$xRun#$c#$pScriptFile#$p#$cAdd_Registry#$x,Require#$cFileList#$x
Else,If,EXISTSECTION,%PluginFile%,Add_Registry,IniWriteTextLine,%PluginFile%,Process,Run#$c#$pScriptFile#$p#$cAdd_Registry
End
If,Not,EXISTSECTION,%PluginFile%,Add_Registry,TXTReplace,%PluginFile%,///#$x,Run#$c#$pScriptFile#$p#$cAdd_Registry#$x
//
//--Refresh Plugins
//IniWrite,%ScriptFile%,Interface,CheckScriptCode_FileBox,#$c1#$c13#$c10#$c106#$c200#$c20#$cfile
//System,ReScanScripts
//
Message,"Your new plugin is in %TarMy%#$xRefresh Winbuilder to see it.",Information,20
//

I'm following this project for sure. I did not find any way to do that on the fly during build... At some point I thought to integrate completely the problematic commands and both could be used from any plugins... ex: Add_Shortcut and AddShortcut both with each their own syntax working...  feasible  but the darn Call, is forcing complete conversion for me at the moment.... and also sometimes I get generation of bogus sections because of god knows what. When trying to convert complex scripts and also the [AddFilesInfo] does not process properly and couple other intersting things...

But in the end, converted plugins are in not really XPE conform, even if they works.


Re: Converting script between PESE and XPE
« Reply #27 on: November 24, 2019, 10:00:45 AM »

Lancelot

  • Gena Baker
  • Grand Chef
  • *****
  • Date Registered: Sep 2010
  • Posts: 10350

 

Powered by EzPortal