[Touch GSM ROM Development] Noonski:
Mort Cooking Made Easy Tutorial

In the OEM_LANG folder the initflashfiles.dat file gets the line

Directory("\Windows\Startup"):-File("ReplaceFileOperations.mscr","\Windows\RFO.mscr")

So the RFO file will run at start up.

Also the line

Directory("\Windows\Startup"):-File("Welcome.lnk","\Windows\Welcome.lnk")

Is Removed.

So at the first boot the RFO file will be run.

SetFileAttribute("\Windows\Startup\ReplaceFileOperations.mscr", "readonly", FALSE)
SetFileAttribute("\Windows\Startup\ReplaceFileOperations.mscr", "system", FALSE)
MkDir("\Windows\Start Menu\Programs\Accessoires")
WriteFile("\Windows\Start Menu\Programs\Accessoires\Reset Device.mscr", "RESET")
Delete( "\Windows\Startup\ReplaceFileOperations.mscr" )
Copy( "\Windows\SPC.mscr", "\Windows\Startup\SPC Mort Installer.mscr" )

Basicly this Script does not do a lot. Just remove read write atributes so it can be deleted safely at the end, then sets up the second script that runs at second boot.

But of course extra stuff can be added, but the main goal is setting up the second script and skipping the welcome wizard.

Why?

Well if all the commands from the second script go int the RFO and the device resets because of Autorun has finished your might be ****ed with a a half finished installation script.

So the device reboots and then the second script runs.

First part of the second script is also standard.

Run("\Windows\Welcome.exe")

UnzipAll( "\Windows\wnds.zip", "\Windows" )
UnzipAll( "\Windows\mydocs.zip", "\My Documents" )
UnzipAll( "\Windows\appd.zip", "\Application Data" )

SetFileAttribute("\Windows\Opstarten\SPC Mort Installer.mscr", "readonly", FALSE)
SetFileAttribute("\Windows\Opstarten\SPC Mort Installer.mscr", "system", FALSE)
CreateShortcut("\Windows\Startmenu\Office Mobile\Rekenmachine.lnk","\Windows\MobileCalculator.exe")

Delete( "\Windows\Opstarten\SPC Mort Installer.mscr" )

WNDS is for files that go into subfolder in Windows or in Windows folder itself that you don't want to have unchangeable File Atributes because they are ROM files.

My Docs for the Templates

And Application Data for well AppdTodate Stuff and if need be more.

It then sets itself up to be deleted again. But it will not delete itself before finishing all the commands that come after that.

Let's take a look at a very Basic File operation command that will be in the SPC.mscr

if (RegRead( "HKLM", "Software\Mortinstall\LNK", "SIM Contact Beheer.lnk" ) eq 1)
CreateShortcut("\Windows\Startmenu\Programma's\Contacten\SIM Contact Beheer.lnk","\Windows\SIM_MGR.exe")
Else
EndIf

if (RegRead( "HKLM", "Software\Mortinstall\LNK", "YouTube0413.lnk" ) eq 1)
CreateShortcut("\Windows\Startmenu\Programma's\MultiMedia\YouTube.lnk","\Windows\YouTube.exe")
Else
EndIf

So this basicly reacts to the registry line in the You Tube RGU file.

[HKEY_LOCAL_MACHINE\Software\Mortinstall\LNK]
"YouTube0409.lnk"=dword:1

So no seperate AutoShortcut.provxml file needed, No initflasfiles.txt needed and no premade shortcut files that go into the Windows folder doing nothing there but waste memory and Speed. And also no seperate option.xml file in the final setup (makes updating dsm file also a bit easier)

It does the same as Autoshortcut but Autoshortcut is not set to delete itself and keeps running at every reboot checking the registry then closing itself?? yeah stupid.

But here's a nice example of CommManager.

If the HTC CommManger is not installed the registry key won't be there so...

if (RegRead( "HKLM", "Software\Mortinstall\LNK", "CommManager.lnk" ) eq 1)
CreateShortcut("\Windows\Startmenu\Programma's\CommManager.lnk","\Windows\CommManager.exe")
CreateShortcut("\Windows\Appbuttons\CommManager.lnk","\Windows\sddialer.exe")
Else
WriteFile("\Windows\Startmenu\Programma's\CommManager.lnk", "99#""\Windows\wrlsmgr.exe""?shellres.192.dll,-13999")
WriteFile("\Windows\Appbuttons\CommManager.lnk", "99#""\Windows\wrlsmgr.exe""?shellres.192.dll,-13999")
EndIf

It will still make a shortcut but this time to the default WM Wirelesmanager.

And now for a more advanced installation.

if (RegRead( "HKLM", "Software\Mortinstall\LNK", "RT0409.lnk" ) eq 1)
UnzipAll( "\Windows\RTC.zip", "\Program Files" )
CreateShortcut("\Windows\Start Menu\Programs\GPS\Remote Tracker.lnk","\Program Files\RTConfig\RTConfig.exe")
CreateShortcut("\Windows\Start Menu\Programs\GPS\Remote Tracker Test.lnk","\Program Files\RTConfig\RTTest.exe")
CreateShortcut("\Windows\Startup\Phone Activation.lnk","\Program Files\RTConfig\SMSLauncher.exe")
Copy( "\Program Files\RTConfig\remotetracker.xml", "\Application Data\AppToDate\remotetracker.xml" )
Copy( "\Program Files\RTConfig\RemoteTracker.ico", "\Application Data\AppToDate\RemoteTracker.ico" )
Copy( "\Intern Geheugen\rt.dll", "\Program Files\RTConfig\rt.dll" )
Copy( "\Internal Storage\rt.dll", "\Program Files\RTConfig\rt.dll" )
Copy( "\Storage Card\Cabs\rt.dll", "\Program Files\RTConfig\rt.dll" )
Copy( "\Opslagkaart\Cabs\rt.dll", "\Program Files\RTConfig\rt.dll" )
Copy( "\Windows\rt.dll", "\Program Files\RTConfig\rt.dll" )
Delete( "\Program Files\RTConfig\remotetracker.xml" )
Delete( "\Program Files\RTConfig\RemoteTracker.ico" )
Else
EndIf

This time the extra advantage is higher compresion on the Zip file then a Cab file. No Small Cabb Back up because Autorun cab installation.

In this case without the use of UC on the user side it checks automaticly if the user configuration file exists in the correct folder and copies it to the device (or if it exists in Windows Precooked)

It then set's up the AppToDate Support and Cleans that little bit again.

So updates will not need to remove previous version it can simply overwrite without the hassle of Read write Bull.

Better then Windows folder install better then a cab install and it's not like the Commands are super High tek very easy to understand.

Yes the SPC script might grow but big files are not what slow Windows down.

This is the cleanest Cooking Method to Date (untill Files can actually be deleted from ROM). I've been testing loads of tricks for the last Half year and Ameet's also done some creat research on tricks and many other users have contributed into perfecting this method from the mortscript thread. Bengalih, Mort and a few more that i wil surely add. It can give so much control to everything that goes on, the above examples are just the basic stuff that i untill now have a grasp of at the moment.

I will attach the package for the above installation as an example.