Old 06-27-2015, 11:13 PM   #1
Punk Duck
Human being with feelings
 
Punk Duck's Avatar
 
Join Date: Apr 2015
Location: Melbourne
Posts: 138
Default NSIS for installation of JS plugin and presets?

Title says it..

I'm looking at NSIS to create an installer that does the following in a painless, simple for the user way.

1. Find the users resource folder path, presenting it as a an option in a dialog, to change it if required.

2. copy a JS effect folder with a subfolder containing gui images and other information files to the resource folder "Effects" folder.

3. Similarly, copy presets into the "presets" folder.

Anyone done this?
Is this the best way?
Thanks in advance!
PD.
Punk Duck is offline   Reply With Quote
Old 06-28-2015, 02:24 AM   #2
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,652
Default

I use NSIS for my JSFX pack. I guess I could post what I have. However, could use some improvement.

One problem is that the installer might overwrite existing scripts/data. ATM I warn the user if there already is a Tale subdir in the Effects dir, and then warn the user again if there already is a Tale subdir in the Data dir. I don't include presets yet, but if I did I guess I would have to warn the user once more. Also, with presets chances are much higher that the user has created his/her own...

Anyway, I would suggest you install my JSFX pack to see if this is what you are after, and if so, then let me know and I will post my NSIS script.
Tale is offline   Reply With Quote
Old 06-28-2015, 07:16 AM   #3
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,268
Default

I am going to investigate this too for my scripts. I am surprised NSIS is still in sourceforge !!?!?
heda is offline   Reply With Quote
Old 06-28-2015, 02:21 PM   #4
Punk Duck
Human being with feelings
 
Punk Duck's Avatar
 
Join Date: Apr 2015
Location: Melbourne
Posts: 138
Default

Quote:
Originally Posted by Tale View Post
I use NSIS for my JSFX pack. I guess I could post what I have. However, could use some improvement.

One problem is that the installer might overwrite existing scripts/data. ATM I warn the user if there already is a Tale subdir in the Effects dir, and then warn the user again if there already is a Tale subdir in the Data dir. I don't include presets yet, but if I did I guess I would have to warn the user once more. Also, with presets chances are much higher that the user has created his/her own...

Anyway, I would suggest you install my JSFX pack to see if this is what you are after, and if so, then let me know and I will post my NSIS script.
I've already downloaded the JSFX pack, well an early version anyway. I'm building a noise making synth and I needed some very basic midi to pitch control. So I'm using the midi handling library for that. It's been a big time saver so thanks!

I have looked at your install, yes that is almost exactly what I want! It would be awesome if you could post it.

Thanks again, Tale, I'm learning a lot from your site.

Last edited by Punk Duck; 06-28-2015 at 03:17 PM.
Punk Duck is offline   Reply With Quote
Old 06-30-2015, 09:23 AM   #5
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,652
Default

Quote:
Originally Posted by Punk Duck View Post
I have looked at your install, yes that is almost exactly what I want! It would be awesome if you could post it.
Kinda forgot this, oops! Maybe later tonight...
Tale is offline   Reply With Quote
Old 06-30-2015, 11:24 AM   #6
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,652
Default

Here you go:

Code:
; Tale's JSFX Pack
; Copyright (C) 2013-2015 Theo Niessink
; License: GPL - http://www.gnu.org/licenses/gpl.html

!include "MUI2.nsh"
!define MUI_ABORTWARNING


!define NAME "Tale's JSFX Pack"
!define VERSION "20150630"

Name "${NAME}"
OutFile "Tale_${VERSION}-install.exe"
SetCompressor /SOLID lzma

InstallDir "$APPDATA\REAPER\Effects\Tale"
Var DATADIR
ShowInstDetails hide

!insertmacro MUI_PAGE_LICENSE "License.rtf"

!define MUI_PAGE_HEADER_TEXT "Changelog"
!define MUI_PAGE_HEADER_SUBTEXT "Please review the changelog before installing ${NAME}."
!define MUI_LICENSEPAGE_TEXT_TOP "Press Page Down to see the rest of the changelog."
!define MUI_LICENSEPAGE_TEXT_BOTTOM "If you have reviewed the changelog, click Next to continue."
!define MUI_LICENSEPAGE_BUTTON "Next >"
!insertmacro MUI_PAGE_LICENSE "Changelog.rtf"

!define MUI_COMPONENTSPAGE_NODESC
!insertmacro MUI_PAGE_COMPONENTS

!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Effects Folder"
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE InstallDirLeave
!insertmacro MUI_PAGE_DIRECTORY

!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Data Folder"
!define MUI_DIRECTORYPAGE_VARIABLE $DATADIR
!define MUI_DIRECTORYPAGE_TEXT_TOP "Setup will install ${NAME} data in the following folder. To install in a different folder, click Browse and select another folder. Click Next to continue."
!define MUI_PAGE_CUSTOMFUNCTION_PRE DataDirPre
!define MUI_PAGE_CUSTOMFUNCTION_LEAVE DataDirLeave
!insertmacro MUI_PAGE_DIRECTORY

!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"

SectionGroup /e "Plug-Ins"
  Section "ab_mono (A/B two mono channels)"
    SetOutPath $INSTDIR
    File ..\Tale\ab_mono
  SectionEnd

  Section "colored_noise (colored noise generator)"
    SetOutPath $INSTDIR
    File ..\Tale\colored_noise
  SectionEnd

  Section "drum_synth (simple drum synth)"
    SetOutPath $INSTDIR
    File ..\Tale\drum_synth
  SectionEnd

  Section "midi_sustain (MIDI sustain emulator)"
    SetOutPath $INSTDIR
    File ..\Tale\midi_sustain
  SectionEnd

  Section "mono_synth (simple mono/poly synth)"
    SetOutPath $INSTDIR
    File ..\Tale\mono_synth
  SectionEnd

  Section "poly_mono_midi_router (dynamic router)"
    SetOutPath $INSTDIR
    File ..\Tale\poly_mono_midi_router
  SectionEnd

  Section "random_midi_notes (note generator)"
    SetOutPath $INSTDIR
    File ..\Tale\random_midi_notes
  SectionEnd

  Section "rc_filter (multimode RC filter)"
    SetOutPath $INSTDIR
    File ..\Tale\rc_filter
  SectionEnd

  Section "tube_amp (preamp simulation)"
    SetOutPath $INSTDIR
    File ..\Tale\rc_filter
  SectionEnd

  SectionGroup "wavetable_synth (paraphonic synth)"
    Section "wavetable_synth"
      SetOutPath $INSTDIR
      File ..\Tale\wavetable_synth
    SectionEnd
    Section "Wavetables (*.flac)" WAVETABLE_SECTION
      SetOutPath $DATADIR\wavetables
      File ..\wavetables\*.flac
    SectionEnd
    Section /o "Wavetable generator (C++ source)"
      SetOutPath $DATADIR\wavetables\Source
      File ..\wavetables\Source\*.*
    SectionEnd
  SectionGroupEnd
SectionGroupEnd

SectionGroup /e "Libraries"
  Section "adsr.jsfx-inc (ADSR envelope)"
    SetOutPath $INSTDIR
    File ..\Tale\adsr.jsfx-inc
  SectionEnd

  Section "array.jsfx-inc (simple 2D array interface)"
    SetOutPath $INSTDIR
    File ..\Tale\array.jsfx-inc
  SectionEnd

  Section "lfo.jsfx-inc (non-bandlimited oscillator)"
    SetOutPath $INSTDIR
    File ..\Tale\lfo.jsfx-inc
  SectionEnd

  Section "malloc.jsfx-inc (memory management)"
    SetOutPath $INSTDIR
    File ..\Tale\malloc.jsfx-inc
  SectionEnd

  Section "midi_queue.jsfx-inc (sample accurate MIDI)"
    SetOutPath $INSTDIR
    File ..\Tale\midi_queue.jsfx-inc
  SectionEnd

  Section "noise_generator.jsfx-inc (pseudorandom)"
    SetOutPath $INSTDIR
    File ..\Tale\noise_generator.jsfx-inc
  SectionEnd

  Section "oversampler.jsfx-inc (2x oversampler)"
    SetOutPath $INSTDIR
    File ..\Tale\oversampler.jsfx-inc
  SectionEnd

  Section "poly_blep.jsfx-inc (bandlimited oscillator)"
    SetOutPath $INSTDIR
    File ..\Tale\poly_blep.jsfx-inc
  SectionEnd

  Section "rbj_filter.jsfx-inc (2nd order RBJ filter)"
    SetOutPath $INSTDIR
    File ..\Tale\rbj_filter.jsfx-inc
  SectionEnd

  Section "rc_filter.jsfx-inc (1st order RC filter)"
    SetOutPath $INSTDIR
    File ..\Tale\rc_filter.jsfx-inc
  SectionEnd

  Section "sine_oscillator.jsfx-inc (efficient sine wave)"
    SetOutPath $INSTDIR
    File ..\Tale\sine_oscillator.jsfx-inc
  SectionEnd

  Section "zdf_filter.jsfx-inc (2nd order ZDF filter)"
    SetOutPath $INSTDIR
    File ..\Tale\zdf_filter.jsfx-inc
  SectionEnd
SectionGroupEnd

Function .onInit
  StrCpy $DATADIR "$APPDATA\REAPER\Data\Tale"
FunctionEnd

Function DataDirPre
  ${Unless} ${SectionIsSelected} ${WAVETABLE_SECTION}
    Abort
  ${EndUnless}
FunctionEnd

Function DataDirLeave
  IfFileExists "$DATADIR\*.*" 0 +3
  MessageBox MB_YESNO|MB_ICONEXCLAMATION \
    "The destination folder already exists. Setup will add ${NAME} data to the folder, possibly overwriting existing files.$\r$\n$\r$\n\
    Are you sure you want to install ${NAME} data in this folder?" /SD IDYES IDYES +2
  Abort
FunctionEnd

Function InstallDirLeave
  IfFileExists "$INSTDIR\*.*" 0 +3
  MessageBox MB_YESNO|MB_ICONEXCLAMATION \
    "The destination folder already exists. Setup will add ${NAME} to the folder, possibly overwriting existing files.$\r$\n$\r$\n\
    Are you sure you want to install ${NAME} in this folder?" /SD IDYES IDYES +2
  Abort
FunctionEnd
I removed some naughty bits (call Perl script to convert Changelog.txt to RTF, and import Git tag/commit hash into $VERSION), but otherwise this is what I currently use.
Tale is offline   Reply With Quote
Old 06-30-2015, 01:08 PM   #7
Punk Duck
Human being with feelings
 
Punk Duck's Avatar
 
Join Date: Apr 2015
Location: Melbourne
Posts: 138
Default

So does this prompt the user for 2 paths? I can only see one here.
Many thanks!
Punk Duck is offline   Reply With Quote
Old 06-30-2015, 01:34 PM   #8
Tale
Human being with feelings
 
Tale's Avatar
 
Join Date: Jul 2008
Location: The Netherlands
Posts: 3,652
Default

Yeah, there are 2:

Code:
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Effects Folder"
...
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Data Folder"
Tale is offline   Reply With Quote
Old 06-30-2015, 07:51 PM   #9
Punk Duck
Human being with feelings
 
Punk Duck's Avatar
 
Join Date: Apr 2015
Location: Melbourne
Posts: 138
Default

Quote:
Originally Posted by Tale View Post
Yeah, there are 2:

Code:
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Effects Folder"
...
!define MUI_DIRECTORYPAGE_TEXT_DESTINATION "Data Folder"
Ah-ha! Couldn't scroll to see that on my phone, now on PC I can see it, duh!!

I now have it working, and with a bit more tweaking and Googling, I also have modified the header subtexts on the pages and added my own logo on the header and as an icon.

So fantastic, thanks for sharing your work. It's hard trying to figure out stuff like this from nothing, but having what you did as a starting point is very helpful.

Thanks again, looking forward to getting my stuff out there with a proper installer!
Punk Duck is offline   Reply With Quote
Reply

Thread Tools
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


All times are GMT -7. The time now is 08:28 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.