Old 1st June 2009, 05:43   #1
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
Exclamation Code won't compile! - Help please!

Hi

Just trying some code & unfortunately I can't get it to work.

I've tried deleting lines 9, 10, 11, 12 & 38-42. But it still won't compile.

I've tried within one set of Apostrophe's, and within 2;
CreateShortcut "$STARTMENU\maint\maint.lnk" "$ProgramFiles\maint\maint.exe"

Yet I still find myself unable to successfully compile the script.

Could someone please help me get the following (or similar) to compile?

code:
!include MUI2.nsh

Name `Maintenance`
OutFile `Maintenance Setup.exe`

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE license.txt
!insertmacro MUI_PAGE_INSTFILES
!define MUI_FINISHPAGE_RUN "$DESKTOP\Maintenance MMC.msc"
!define MUI_FINISHPAGE_RUN "$DESKTOP\Maintenance.exe"
!define MUI_FINISHPAGE_RUN_TEXT "Open this"
!define MUI_FINISHPAGE_RUN_TEXT "Open that!"

!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE English

Section

!macro ExtractMaintenance ToDir
SetOutPath `${ToDir}`
File "Maintenance Script.exe"
File "Maintenance MMC.msc"
File "Backup Directory.exe"
!macroend

!macro ExtractMaint ToDir
SetOutPath `${ToDir}`
File "Maint.exe"
!macroend

!insertmacro ExtractMaintenance "C:\Install\CD\Applications\Tools"

!insertmacro ExtractMaint "$PROGRAMFILES\maint"

CreateShortcut "$STARTMENU\maint\maint.lnk" "$ProgramFiles\maint\" "maint.exe"

CreateShortcut "$DESKTOP\Maintenance.lnk"
"E:\Forstall\Applications\Tools\" "Maintenance Script.exe"

CreateShortcut "$DESKTOP\Maintenance MMC.lnk"
"E:\Forstall\Applications\Tools\" "Maintenance MMC.msc"

SectionEnd



Thanks in advance,

Panarchy
Panarchy is offline   Reply With Quote
Old 1st June 2009, 09:25   #2
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
What is the error message you get?

It looks like you start the rest of your CreateShortcut parameters on a new line.
If you want to do that, you have to end the first line with a backslash:
code:
CreateShortcut "$STARTMENU\maint\maint.lnk"\
"$ProgramFiles\maint\" "maint.exe"

jpderuiter is offline   Reply With Quote
Old 1st June 2009, 21:29   #3
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
LOL, I don't believe it!

My script can now compile!



Now just need to work out the following;

- How to make more than one checkbox on the finish page
- & How to successfully create a start-menu shortcut

Please help me work out the aforementioned.

Thanks in advanced,

Panarchy
Panarchy is offline   Reply With Quote
Old 2nd June 2009, 06:14   #4
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
Hi

I have two features which I haven't been able to get to work.

1. Can't compile! (LOL)
2. Need multiple Checkboxes on the finish page (one for .exe one for .msc)

Here is my latest code;

code:
!include MUI2.nsh

Name `Maintain`
OutFile `Installer.exe`

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_LICENSE license.txt
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_PAGE_FINISH

!insertmacro MUI_LANGUAGE English

Section

!macro ExtractMaint ToDir
SetOutPath `${ToDir}`
File "Maint Scribe.exe"
File "MMC.msc"
!macroend

!macro ExtractSome ToDir
SetOutPath `${ToDir}
File "Some.exe"
!macroend

!insertmacro ExtractMaint "F:\Install\Applications"
!insertmacro ExtractSome "$PROGRAMFILES\SOME"

CreateShortcut "$STARTMENU\SOME"\
"Some.lnk" "$PROGRAMFILES\SOME\some.exe"

CreateShortcut "$DESKTOP\Maint.lnk"\
"F:\Install\Applications\" "Maint Scribe.exe"

CreateShortcut "$DESKTOP\MMC.lnk"\
"F:\Install\Applications\MMC.msc"

SectionEnd



Please help me with getting this to work!

Thanks in advance,

Panarchy

BTW: When commenting out the following, the code compiles;
!insertmacro ExtractSome "$PROGRAMFILES\SOME"
Panarchy is offline   Reply With Quote
Old 2nd June 2009, 11:18   #5
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Your CreateShortCut is incorrect. The first parameter must be the full path to the shortcut to be created. The second parameter is the file/path to execute. Check the manual on the correct usage.

To add an additional check box on the finish page requires defining a custom show function (!define MUI_PAGE_CUSTOMFUNCTION_SHOW ...) and in it a ${NSD_CreateCheckBox} line.

Stu
Afrow UK is offline   Reply With Quote
Old 2nd June 2009, 21:22   #6
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
Thanks for both of your answers.

Could you please also find out why my program doesn't compile?

And help me get the program to compile?

Thanks in advance,

Panarchy

Hint: Line 28
Panarchy is offline   Reply With Quote
Old 2nd June 2009, 22:37   #7
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
The output of the NSIS compiler can be very helpfull.
Please have a look at it.

And if you can't figure out what's wrong, please give us the error reported by the NSIS compiler, so it's easier to see what's wrong.

The NSIS output for your script is:
code:
!insertmacro: ExtractSome
Error: unterminated string parsing line at macro:ExtractSome:1
Error in macro ExtractSome on macroline 1
Error in script "test.nsi" on line 28 -- aborting creation process


When you look closely at this first line of the ExtractSome macro, you might notice that you forgot a single quote after ${ToDir}.
Hence a failed compile.
jpderuiter is offline   Reply With Quote
Old 3rd June 2009, 02:59   #8
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
Hahahahaha, thanks. Fixed.

Perfect
Panarchy is offline   Reply With Quote
Old 3rd June 2009, 04:15   #9
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
Thanks... well everything works now, except the shortcut creation within the start menu.

The file [some.exe] is successfully extracted within %programfiles%, however the shortcut is NOT created within the Start Menu.

Some help here please.

Thanks in advance,

Panarchy
Panarchy is offline   Reply With Quote
Old 3rd June 2009, 06:15   #10
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
Quote:
Originally posted by Afrow UK
Your CreateShortCut is incorrect. The first parameter must be the full path to the shortcut to be created. The second parameter is the file/path to execute. Check the manual on the correct usage.

Stu
jpderuiter is offline   Reply With Quote
Old 3rd June 2009, 06:19   #11
jpderuiter
Major Dude
 
Join Date: Feb 2007
Posts: 672
You can't split a string on several lines with a backslash I mentioned before.
So it should be:
code:
CreateShortcut "$STARTMENU\SOME\Some.lnk"\
"$PROGRAMFILES\SOME\some.exe"

jpderuiter is offline   Reply With Quote
Old 3rd June 2009, 06:27   #12
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
Worked it out myself;


CreateShortcut "$SMPROGRAMS\Some.lnk"\
"$PROGRAMFILES\SOME\Some.exe"
Panarchy is offline   Reply With Quote
Old 3rd June 2009, 16:20   #13
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You can split strings over multiple lines:

code:
MessageBox MB_OK "part 1\
part 2\
part 3"



Your code differs in that you have used quotes thus creating 2 parameters.

Stu
Afrow UK is offline   Reply With Quote
Old 3rd June 2009, 22:12   #14
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
Okay... I think I understand.

Thanks
Panarchy is offline   Reply With Quote
Old 4th June 2009, 01:05   #15
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
How do I make an MMC (*.msc) load at completion of installer?

Currently;
code:
!define MUI_FINISHPAGE_RUN "F:\Install\Applications\MMC.msc"


Which works for *,exe, just not *.msc

Please tell me how I can load the MMC with the checkbox on the Finish page.

Thanks in advance,

Panarchy
Panarchy is offline   Reply With Quote
Old 4th June 2009, 04:14   #16
Comperio
Major Dude
 
Comperio's Avatar
 
Join Date: Jan 2005
Location: Oregon Coast
Posts: 737
MSC files themselves are not executable files like EXEs...


You'll need to call the actual EXE (MMC.EXE) with parameters. This will probably help get you started: http://technet.microsoft.com/en-us/l.../cc757725.aspx

To run it on the finish page you have two options. You can to supply the EXE name with MUI_FINISHPAGE_RUN and also use MUI_FINISHPAGE_RUN_PARAMETERS to pass in the parameters. Or you could create your own function using things like Exec, ExecWait, etc. and use MUI_FINISHPAGE_RUN_FUNCTION to call the function. (All info about these parameters are in the MUI help docs.)
Comperio is offline   Reply With Quote
Old 4th June 2009, 10:47   #17
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
I would recommend using ExecShell in a custom run function.

Stu
Afrow UK is offline   Reply With Quote
Old 4th June 2009, 23:03   #18
Panarchy
Member
 
Join Date: Nov 2008
Posts: 72
Thanks Comperio, had to rename the file so it didn't have a space though... however, it now works

Thanks Afrow: I'll do research into that function
Panarchy is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump