Archive: Desktop Icon with NSIS Zip2Exe


Desktop Icon with NSIS Zip2Exe
Please excuse my stupidity, but I can't seem to figure out how to create an Installer using the NSIS Zip2Exe option.

I last used NSIS Verion 2.07 and don't recall that it was a problem, since I creted four 'Setup' files for four different free downloads from my web site.

I downloaded and installed the latest version of NSIS and expected to do that for my latest free download package by just selecting the Zip2Exe option and filling in the blanks.

I got a 'Installer' that works fine except for the placing an Icon shortcut on the deskstop.

In my previous ones (using 2.07) that is an option for the user to check.

I'm sure I've forgotten something (it's been over a year since I created those first four) and I'm 68, not a programmer and have a poor memory.

Can some one help me out with this situation?

Thanks,


zip2exe's purpose is not building installers, it's only converting zip files into semi-installers. SFX builder, if you wish. It doesn't create shortcuts. It's meant to extract the files in the zip and nothing more.

If you had shortcuts, you must have used a real script and compiled that with makensis or makensisw. If you can't find the .nsi script, write a new one according to the documentation and the examples in the Examples folder.


Thanks for taking the time to reply.

I must have used a script someone (a programmer) sent to me since I do not know how to write one. It would have been a 'cut & paste' operation, which I don't recall. I've already mentioned my memory.

Prior to posting my 'problem' I tried looking at the files in the Examples folder (and previous posts) and didn't see anything that I recognized as one that would work, but then I really didn't know what one would look like even if I found it. :)

Unlike Confucious, I remember more of what I've heard and seen and not very much of what I've done.

Rock on,


You could try using one of the script wizards available. They'll create a script for you in no time using GUI alone.


Thanks but that didn't work (for a number of reasons).

Anyway, I 'found' a script that I could modify and use.

It worked fine except for the section where one indicates the 'put icon on desktop' <Section: "Desktop Shortcut">, which of course is the reason for this exercise. :)

I have tried four or five different file names for the shortcut (pif) file and I always get this error message.

Error in script "C:\Program Files\SCBSteganography\SteganoScriptFile.nsi" on line 46 -- aborting creation process

Of course line 46 is -- File: "Steganography.pif"

The "Steganography.pif" file is the Windows created shortcut for the program. It's in the folder with all the other files and it works as a shortcut.

Suggestions?


The error itself is stated right above the line stating the error line. According to your post, the problem is that colon after File.

But you shouldn't use File anyway for that. Use CreateShortcut.


The good news - I changed it to

================================================
; Optional section (can be disabled by the user)
Section "Desktop Shortcut"

SetOutPath $DESKTOP

CreateShortcut "Shortcut to Steganography.exe" "Steganography.exe"
===================================================

and it compiled without an error.

Bad news - it doesn't put the Icon on the desktop when it performs the install (set-up). It puts the shortcut file (Shortcut to Steganography.exe) into the directory with all the other files.

The good news - that shortcut works when you click on it from inside the directory (using Explore).

I think I'm getting close. :)


Use:

CreateShortcut "$DESKTOP\Shortcut to Steganography.lnk" "Steganography.exe"

Hate to be a pain, but I pasted that line into my script file, compiled it (sucessfully) and it not only does not put a shortcut on the desktop, now it is not even creating a shortcut.

It does create a Setup, that when executed offers two options, the second of which is Desktop Shortcut, with a block on the left that is checked. That was the case with my previous script.

Any other suggestions?

Here is my entire script -

=======================================================
; The name of the installer
Name "SecretCodeBreaker"

; The file to write
OutFile "Setup.exe"

; The default installation directory
InstallDir C:\SCBSteganography

;--------------------------------

; Pages

Page components
Page directory
Page instfiles

;--------------------------------

; The stuff to install
Section "SecretCodeBreaker Files (required)"

SectionIn RO

; Set output path to the installation directory.
SetOutPath $INSTDIR

; Put file there
File "Steganography.exe"
File "Instructions.txt"
File "Theory_of_Operation.txt"
File "Example.txt"
File "Example.bmp"
File "Exampleb.bmp"
File "Bitmap1.bmp"
File "SecretCodeBreaker.bmp"
File "Steganography.ico"
File "readme.txt"

SectionEnd

; Optional section (can be disabled by the user)
Section "Desktop Shortcut"

SetOutPath $DESKTOP

CreateShortcut "$DESKTOP\Shortcut to Steganography.lnk" "Steganography.exe"

SectionEnd
======================================================


If exe file exists

SetOutPath "$DESKTOP"
CreateShortcut "$DESKTOP\Shortcut to Steganography.lnk" "$INSTDIR\Steganography.exe"

Thank you very, very much for fixing my script so that it works!

Works perfectly.

If you are interested, as a token of my appreciation, I'll send you a URL that will give you a copy of the my first book in the Secret Code Breaker series (96 page PDF, plus a small zip of the program files).