NSIS for Smartphone: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(11 intermediate revisions by 3 users not shown)
Line 1: Line 1:
You can compile a setup launcher which will install multiple CAB files to Smartphone using the Nullsoft Scriptable Install System (NSIS).
You can compile a setup launcher which will install multiple CAB files to [http://n.domaindlx.com/mssmartphone Windows Mobile-based Smartphone] using the Nullsoft Scriptable Install System (NSIS).<br>
http://img170.imageshack.us/img170/2365/snap15530si.gif
[[File:Snap1553.gif]]
<br>
<br>
<br>
<br>
<br>
<br>
Our objective is to make a desktop installer which will install several CAB files to a Smartphone by passing CAB files to the ActiveSync program.
Our objective is to make a desktop installer which will install several CAB files to a Smartphone by passing CAB files to the ActiveSync program.
http://img352.imageshack.us/img352/7351/launchers0mp.gif
[[File:Launchers.gif]]
<br>
<br>
<br>
<br>
Line 15: Line 15:
'''Requirements'''<br>
'''Requirements'''<br>
1. [http://prdownloads.sourceforge.net/nsis/nsis-2.09.exe?download NSIS version 2.09]<br>
1. [http://prdownloads.sourceforge.net/nsis/nsis-2.09.exe?download NSIS version 2.09]<br>
2. [http://www.gpcarreon.com/NSIS.for.SP.zip This ZIP File] - contains NSIS sample script, sample CAB, sample INI and other required files<br>
2. This ZIP File <attach>NSIS.for.SP.zip</attach> - contains NSIS sample script, sample CAB, sample INI and other required files<br>
3. [http://www.microsoft.com/downloads/details.aspx?FamilyID=d2645c21-8a85-45a2-8d13-653beb6cdddc&DisplayLang=en Microsoft Active Sync] program installed on your PC<br>
3. [http://www.microsoft.com/downloads/details.aspx?FamilyID=d2645c21-8a85-45a2-8d13-653beb6cdddc&DisplayLang=en Microsoft Active Sync] program installed on your PC<br>
   
   
Line 25: Line 25:
   
   
2. Download then unzip contents of the ZIP file. You should have the following files:<br>
2. Download then unzip contents of the ZIP file. You should have the following files:<br>
http://img170.imageshack.us/img170/6092/snap15473xs.gif
[[File:Snap1547.gif]]
   
   
   
   
3. Highlight ‘SCRIPT.nsi’ then right click mouse. Click on ‘Compile NSIS Script’.<br>
3. Highlight ‘SCRIPT.nsi’ then right click mouse. Click on ‘Compile NSIS Script’.<br>
http://img170.imageshack.us/img170/928/snap15486yh.gif
[[File:Snap1548.gif]]
   
   
   
   
4. Wait for the confirmation window.<br>
4. Wait for the confirmation window.<br>
http://img170.imageshack.us/img170/281/snap15498kg.gif
[[File:Snap1549.gif]]
   
   
   
   
5. Verify that your file was compiled.<br>
5. Verify that your file was compiled.<br>
http://img170.imageshack.us/img170/4946/snap15508qq.gif
[[File:Snap1550.gif]]
   
   
   
   
Line 43: Line 43:


The EULA screen.<br>
The EULA screen.<br>
http://img176.imageshack.us/img176/7585/snap15416qx.gif
[[File:Eulasp.gif]]
   
   
   
   
The Options screen. You can choose from Custom or Full Installation type.<br>
The Options screen. You can choose from Custom or Full Installation type.<br>
http://img170.imageshack.us/img170/2338/snap15528nc.gif
[[File:Snap1552.gif]]
   
   
   
   
The Installation Directory dialog. This is where your files will be dumped.<br>
The Installation Directory dialog. This is where your files will be dumped.<br>
http://img170.imageshack.us/img170/2268/snap15557ab.gif
[[File:Snap1555.gif]]
   
   
   
   
Finally, once the last CAB file is being installed on the phone, you will see this on your computer’s monitor.<br>
Finally, once the last CAB file is being installed on the phone, you will see this on your computer’s monitor.<br>
http://img170.imageshack.us/img170/8208/snap15549ve.gif
[[File:Snap1554.gif]]
   
   
   
   
Line 68: Line 68:
'''To add another CAB file (File 4, etc)'''<br>
'''To add another CAB file (File 4, etc)'''<br>
Code in green should be inserted between the 2 red lines. Before you recompile the script, ensure that you have the new files (4.CAB and 4.ini) inside the folder.<br>
Code in green should be inserted between the 2 red lines. Before you recompile the script, ensure that you have the new files (4.CAB and 4.ini) inside the folder.<br>
http://img86.imageshack.us/img86/65/snap15569fi.gif
[[File:Snap1556.gif]]


   
   
   
   
Try this '''sample setup launcher''' [http://www.gpcarreon.com/Multi.Cab.Install.exe CLICK ME]
Try this '''sample setup launcher''' <attach>Multi.Cab.Install.zip</attach>
<BR><BR>
<B>---ADDENDUM---</B>
 
Cleaner Method.
 
While the above method works just fine, I would like to point out that the same result can be achieved without having the 'Add / Remove Programs' dialog pop up three times, which can be confusing and unfriendly to stupi...errr...<I>Less Experienced</I> users - it can be done much more cleanly in one dialog. This is also a better solution when you are installing dependencies (i.e: If you need to have the .Net compact framework installed before your main app).
 
To do this, take the above installscript, and modify it thusly:
 
<highlight-nsis>
StrCpy $0 "$INSTDIR\1.ini"
;Call InstallCAB <-- Comment out this line
SectionEnd ;
 
Section "File 2"
SectionIn 1
SetOutPath "$INSTDIR"
 
File 2.ini
File 2.CAB
 
StrCpy $2 "$INSTDIR\2.ini" ;<-- $2 instead of $0
;Call InstallCAB <-- Comment out this line
SectionEnd ;
 
Section "File 3"
SectionIn 1
SetOutPath "$INSTDIR"
 
File 3.ini
File 3.CAB
 
StrCpy $3 "$INSTDIR\3.ini" ;<-- $3 instead of $0
Call InstallCAB
 
<SNIP!>
 
Function InstallCAB
  ExecWait '"$1" "$0" "$2" "$3"' ;<-- Extra parameters '$2' and '$3' Here
FunctionEnd
</highlight-nsis>
 
<B>What This Achieves:</B>
 
The PDA CAB Files are installed by calling CEAppMgr.exe with the cab files as command-line parameters. In the main article, this is accomplished by calling CEAppMgr three times to install Three Cab Files. With my changes, instead of calling ceappmgr three times:
 
CeAppMgr 1.cab<BR>
CeAppMgr 2.cab<BR>
CeAppMgr 3.cab<BR>
 
it calls it once:
 
CeAppMgr 1.cab 2.cab 3.cab
 
CEAppMgr can handle multiple cab files in one go, thus is installs all three CAB files through one dialog.
 
If you want to change the order in which they get installed, i.e if 2.cab required that 3.cab was already installed, just change the order. e.g:
 
<highlight-nsis>
Function InstallCAB
  ExecWait '"$1" "$0" "$3" "$2"'
FunctionEnd
</highlight-nsis>


Thanks to the Original poster of this tutorial, it helped me out greatly. I hope that my little addendum is of use to someone. apologies if it's messy / incomprehensible, but I'm typing this in a hurry.


[[Category:Examples]]
[[Category:PDA Examples]]

Latest revision as of 08:09, 15 May 2008

You can compile a setup launcher which will install multiple CAB files to Windows Mobile-based Smartphone using the Nullsoft Scriptable Install System (NSIS).
Snap1553.gif


Our objective is to make a desktop installer which will install several CAB files to a Smartphone by passing CAB files to the ActiveSync program. Launchers.gif


Very Important Notice
It will facilitate understanding of this article if you already have a background knowledge on how INI files are written and how CAB files for Smartphone are created.


Requirements
1. NSIS version 2.09
2. This ZIP File NSIS.for.SP.zip (4 KB) - contains NSIS sample script, sample CAB, sample INI and other required files
3. Microsoft Active Sync program installed on your PC


Instructions
1. Download then install NSIS version 2.09. Once installed, it will create necessary registry changes on your PC so that all *.NSI files will be associated with Nullsoft Scriptable Install System.


2. Download then unzip contents of the ZIP file. You should have the following files:
Snap1547.gif


3. Highlight ‘SCRIPT.nsi’ then right click mouse. Click on ‘Compile NSIS Script’.
Snap1548.gif


4. Wait for the confirmation window.
Snap1549.gif


5. Verify that your file was compiled.
Snap1550.gif


6. Test your file.

The EULA screen.
Eulasp.gif


The Options screen. You can choose from Custom or Full Installation type.
Snap1552.gif


The Installation Directory dialog. This is where your files will be dumped.
Snap1555.gif


Finally, once the last CAB file is being installed on the phone, you will see this on your computer’s monitor.
Snap1554.gif


Tips
- Open the NSI file then make necessary changes (change app name, change icon, change component names etc)
- Provide your own CAB and INI files, provide a custom icon.
- Change content of the sample eula
- Open the html file then change the contents.


To add another CAB file (File 4, etc)
Code in green should be inserted between the 2 red lines. Before you recompile the script, ensure that you have the new files (4.CAB and 4.ini) inside the folder.
Snap1556.gif


Try this sample setup launcher Multi.Cab.Install.zip (23 KB)

---ADDENDUM---

Cleaner Method.

While the above method works just fine, I would like to point out that the same result can be achieved without having the 'Add / Remove Programs' dialog pop up three times, which can be confusing and unfriendly to stupi...errr...Less Experienced users - it can be done much more cleanly in one dialog. This is also a better solution when you are installing dependencies (i.e: If you need to have the .Net compact framework installed before your main app).

To do this, take the above installscript, and modify it thusly:

StrCpy $0 "$INSTDIR\1.ini"
;Call InstallCAB <-- Comment out this line
SectionEnd ;
 
Section "File 2"
SectionIn 1
SetOutPath "$INSTDIR"
 
File 2.ini
File 2.CAB
 
StrCpy $2 "$INSTDIR\2.ini" ;<-- $2 instead of $0
;Call InstallCAB <-- Comment out this line
SectionEnd ;
 
Section "File 3"
SectionIn 1
SetOutPath "$INSTDIR"
 
File 3.ini
File 3.CAB
 
StrCpy $3 "$INSTDIR\3.ini" ;<-- $3 instead of $0
Call InstallCAB
 
<SNIP!>
 
Function InstallCAB
  ExecWait '"$1" "$0" "$2" "$3"' ;<-- Extra parameters '$2' and '$3' Here
FunctionEnd

What This Achieves:

The PDA CAB Files are installed by calling CEAppMgr.exe with the cab files as command-line parameters. In the main article, this is accomplished by calling CEAppMgr three times to install Three Cab Files. With my changes, instead of calling ceappmgr three times:

CeAppMgr 1.cab
CeAppMgr 2.cab
CeAppMgr 3.cab

it calls it once:

CeAppMgr 1.cab 2.cab 3.cab

CEAppMgr can handle multiple cab files in one go, thus is installs all three CAB files through one dialog.

If you want to change the order in which they get installed, i.e if 2.cab required that 3.cab was already installed, just change the order. e.g:

Function InstallCAB
  ExecWait '"$1" "$0" "$3" "$2"'
FunctionEnd

Thanks to the Original poster of this tutorial, it helped me out greatly. I hope that my little addendum is of use to someone. apologies if it's messy / incomprehensible, but I'm typing this in a hurry.