NextPVR Forums
  • ______
  • Home
  • New Posts
  • Wiki
  • Members
  • Help
  • Search
  • Register
  • Login
  • Home
  • Wiki
  • Members
  • Help
  • Search
NextPVR Forums Public Developers v
« Previous 1 … 50 51 52 53 54 … 93 Next »
NSIS Driving Me Bonkers

 
  • 0 Vote(s) - 0 Average
NSIS Driving Me Bonkers
23skidoo
Offline

Member

Posts: 120
Threads: 9
Joined: Sep 2006
#1
2006-09-15, 10:28 PM
Below is my simple plugin install script. It deploys the files fine. But the durn uninstal.exe doesn't really do anything when it's run. It displays the expected wizard dialogs, but under "Details," it just lists, "Complete."

No files are removed. No drectories are removed. And of course the uninstaller isn't removed.

I'd be eternally grateful if someone could look at this. I'm sure I'll be smacking my head and exclaiming, "Doh!" :-)

Code:
; License page
!insertmacro MUI_PAGE_LICENSE "SleepTimer - README.txt" ;(This is your readme text or info to be displayed in this box)
; Directory page
;!insertmacro MUI_PAGE_DIRECTORY             ;(remove semi-colon at begining of this line to allow user to choose directory)
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
;!insertmacro MUI_PAGE_FINISH                   ;(remove semi-colon at begining of this line to show Finished page instead of files installed as last page.)
; Language files
!insertmacro MUI_LANGUAGE "English"
; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; MUI end ------
; The name of the installer
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
; The file to write
OutFile "SleepTimer_Setup.exe"
; The default installation directory
InstallDir "$PROGRAMFILES\devnz\gbpvr"
;Show file install details (hide|show|nevershow)
ShowInstDetails show
Section "MainSection" SEC01
  ReadRegStr $INSTDIR HKLM "software\devnz" "GBPVR InstallDir" ; Find GB-PVR
  DetailPrint "GBPVR is installed at: $INSTDIR"
  SetOverwrite ifnewer ; overwrite files only if newer.
  SetOutPath "$INSTDIR" ; Set output path to the installation directory.
  writeUninstaller "$INSTDIR\plugins\[COLOR=black]uninstall[/COLOR].exe"
  File "SleepTimer - README.txt" ; Your Readme file

  File "D:\dev\gbpvr\Sleep Timer\bin\Release\CommonGBPVRUtilities.dll" ; Any common library files
  File "D:\dev\gbpvr\Sleep Timer\bin\Release\GBPVRPublic.dll"
  File "D:\dev\gbpvr\Sleep Timer\bin\Release\GbpvrUiElements.dll"
  File "D:\dev\gbpvr\Sleep Timer\bin\Release\System.Data.SQLite.dll"

  SetOutPath "$INSTDIR\plugins" ; Set output path to the plugins directory.
  File "D:\dev\gbpvr\Sleep Timer\bin\Release\Sleep Timer.dll"
  SetOutPath "$INSTDIR\Skin\Blue\SleepTimer" ; Set output path to the skin directory.
  File "D:\dev\gbpvr\Sleep Timer\release\SleepTimer\Program Files\devnz\gbpvr\Skin\Blue\SleepTimer\skin.xml"

SectionEnd
Section "[COLOR=black]uninstall[/COLOR]"
  Delete "$INSTDIR\plugins\[COLOR=black]uninstall[/COLOR].exe" ; delete self (see explanation below why this works)
  Delete "$INSTDIR\plugins\Sleep Timer.dll"
  Delete "$INSTDIR\Skin\Blue\SleepTimer\skin.xml"
  ;RMDir "$INSTDIR\Skin\Blue\SleepTimer"
SectionEnd

Section -Post
SectionEnd
WinTV PVR-150 / ATI X1600 512 / 3GHz P4 / 2GB RAM
Fatman_do
Offline

Posting Freak

Posts: 3,482
Threads: 95
Joined: Nov 2005
#2
2006-09-15, 11:53 PM (This post was last modified: 2006-09-16, 12:09 AM by Fatman_do.)
Give this a try. Cut and paste all this from where you started. I should have included an uninstaller in my example on the wiki. I did remove two files from your installer that are not recommended, the files were:

"GBPVRPublic.dll"
"System.Data.SQLite.dll"

These could cause problems with users running older versions of GB-PVR.

Also within the blah blah blah below, I added the functions to create an install log.

Code:
; License page
!insertmacro MUI_PAGE_LICENSE "SleepTimer - README.txt" ;(This is your readme text or info to be displayed in this box)
; Directory page
;!insertmacro MUI_PAGE_DIRECTORY             ;(remove semi-colon at begining of this line to allow user to choose directory)
; Instfiles page
!insertmacro MUI_PAGE_INSTFILES
; Finish page
;!insertmacro MUI_PAGE_FINISH                   ;(remove semi-colon at begining of this line to show Finished page instead of files installed as last page.)
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES

; Language files
!insertmacro MUI_LANGUAGE "English"
; Reserve files
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; MUI end ------
; The name of the installer
Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
; The file to write
OutFile "SleepTimer_Setup.exe"
; The default installation directory
InstallDir "$PROGRAMFILES\devnz\gbpvr"
;Show file install details (hide|show|nevershow)
ShowInstDetails show
ShowUnInstDetails show

Section "MainSection" SEC01
  ReadRegStr $INSTDIR HKLM "software\devnz" "GBPVR InstallDir" ; Find GB-PVR
  DetailPrint "GBPVR is installed at: $INSTDIR"
  SetOverwrite ifnewer ; overwrite files only if newer.
  SetOutPath "$INSTDIR" ; Set output path to the installation directory.
  File "SleepTimer - README.txt" ; Your Readme file

  File "D:\dev\gbpvr\Sleep Timer\bin\Release\CommonGBPVRUtilities.dll" ; Any common library files
  File "D:\dev\gbpvr\Sleep Timer\bin\Release\GbpvrUiElements.dll"

  SetOutPath "$INSTDIR\plugins" ; Set output path to the plugins directory.
  File "D:\dev\gbpvr\Sleep Timer\bin\Release\Sleep Timer.dll"
  SetOutPath "$INSTDIR\Skin\Blue\SleepTimer" ; Set output path to the skin directory.
  File "D:\dev\gbpvr\Sleep Timer\release\SleepTimer\Program Files\devnz\gbpvr\Skin\Blue\SleepTimer\skin.xml"

SectionEnd


;This produces a nifty install log.
!define LVM_GETITEMCOUNT 0x1004
!define LVM_GETITEMTEXT 0x102D

Function DumpLog
  Exch $5
  Push $0
  Push $1
  Push $2
  Push $3
  Push $4
  Push $6

  FindWindow $0 "#32770" "" $HWNDPARENT
  GetDlgItem $0 $0 1016
  StrCmp $0 0 exit
  FileOpen $5 $5 "w"
  StrCmp $5 "" exit
    SendMessage $0 ${LVM_GETITEMCOUNT} 0 0 $6
    System::Alloc ${NSIS_MAX_STRLEN}
    Pop $3
    StrCpy $2 0
    System::Call "*(i, i, i, i, i, i, i, i, i) i \
      (0, 0, 0, 0, 0, r3, ${NSIS_MAX_STRLEN}) .r1"
    loop: StrCmp $2 $6 done
      System::Call "User32::SendMessageA(i, i, i, i) i \
        ($0, ${LVM_GETITEMTEXT}, $2, r1)"
      System::Call "*$3(&t${NSIS_MAX_STRLEN} .r4)"
      FileWrite $5 "$4$\r$\n"
      IntOp $2 $2 + 1
      Goto loop
    done:
      FileClose $5
      System::Free $1
      System::Free $3
  exit:
    Pop $6
    Pop $4
    Pop $3
    Pop $2
    Pop $1
    Pop $0
    Exch $5
FunctionEnd

Section -Post
  WriteUninstaller "$INSTDIR\uninst_SleepTimer.exe"
  StrCpy $0 "$INSTDIR\SleepTimer_install.log"
  Push $0
  Call DumpLog
SectionEnd

Function un.onUninstSuccess
  HideWindow
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) was successfully removed from your computer."
FunctionEnd

Function un.onInit
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure you want to completely remove $(^Name) and all of its components?" IDYES +2
  Abort
FunctionEnd

Section Uninstall
  Delete "$INSTDIR\plugins\Sleep Timer.dll"
  Delete "$INSTDIR\uninst_SleepTimer.exe"
  Delete "$INSTDIR\SleepTimer_install.log"
  RMDir /r "$INSTDIR\Skin\Blue\SleepTimer"
  SetAutoClose true
SectionEnd
Fatman_do
[SIZE="1"]
HTPC: AMD XP+2500, 512MB DDR (400) ~ Capture Device: Hauppage PVR-150
Storage: 30GB OS & Recording, 160GB Post Processing & Archive
Video Output: HD 32" TV via eVGA Geforce 6200le 256MB AGP DVI-HDMI cable out
Audio Output: Turtle Beach Riviera S/PDIF Optic Output (Digital pass thru only) to Home Theater Receiver[/SIZE]

[SIZE="2"]
Moderator | Tutorials | Community Skin | CommunitySkin-SVN[/SIZE]
23skidoo
Offline

Member

Posts: 120
Threads: 9
Joined: Sep 2006
#3
2006-09-16, 01:01 AM
@fatmando:

Holy cow. Thanks. So, are those two constants and that Dumplog() function just boilerplate code? Is it the same every time you need to generate an uninstall log?
WinTV PVR-150 / ATI X1600 512 / 3GHz P4 / 2GB RAM
Fatman_do
Offline

Posting Freak

Posts: 3,482
Threads: 95
Joined: Nov 2005
#4
2006-09-16, 03:16 AM
23skidoo Wrote:@fatmando:

Holy cow. Thanks. So, are those two constants and that Dumplog() function just boilerplate code? Is it the same every time you need to generate an uninstall log?

Yes, the dumplog function is what gerenates the install log. The log isn't used for uninstalling, just to give the user or developer an opportunity to see what is going on.

I will add the uninstall business to the sample I put up on the wiki.
Fatman_do
[SIZE="1"]
HTPC: AMD XP+2500, 512MB DDR (400) ~ Capture Device: Hauppage PVR-150
Storage: 30GB OS & Recording, 160GB Post Processing & Archive
Video Output: HD 32" TV via eVGA Geforce 6200le 256MB AGP DVI-HDMI cable out
Audio Output: Turtle Beach Riviera S/PDIF Optic Output (Digital pass thru only) to Home Theater Receiver[/SIZE]

[SIZE="2"]
Moderator | Tutorials | Community Skin | CommunitySkin-SVN[/SIZE]
Fatman_do
Offline

Posting Freak

Posts: 3,482
Threads: 95
Joined: Nov 2005
#5
2006-09-16, 11:26 AM (This post was last modified: 2006-09-16, 11:46 AM by Fatman_do.)
Now there is more if you wish to drop the uninstaller as a shortcut in the start menu.
Fatman_do
[SIZE="1"]
HTPC: AMD XP+2500, 512MB DDR (400) ~ Capture Device: Hauppage PVR-150
Storage: 30GB OS & Recording, 160GB Post Processing & Archive
Video Output: HD 32" TV via eVGA Geforce 6200le 256MB AGP DVI-HDMI cable out
Audio Output: Turtle Beach Riviera S/PDIF Optic Output (Digital pass thru only) to Home Theater Receiver[/SIZE]

[SIZE="2"]
Moderator | Tutorials | Community Skin | CommunitySkin-SVN[/SIZE]
23skidoo
Offline

Member

Posts: 120
Threads: 9
Joined: Sep 2006
#6
2006-09-16, 02:48 PM
Thanks again, Fatman. I'll delve more into the syntax of this NSIS parser/compiler thing. I'm an InstallShield wuss myself, but I've decided to give these free tools a go.

So far I'm pleasantly surprised at the quality of Sharp Develop 2. I miss having an object browser, and managing ASP.Net projects doesn't look like an option at this point, but it's got a decent editor and it does a bang-up job of debugging and compiling class libraries and desktop apps.

And on a semi-related note, are the GB-PVR API interfaces documented anywhere? I think I'll post a new topic with that question. I've searched and searched, but I don't see anything other than spotty sample code.
WinTV PVR-150 / ATI X1600 512 / 3GHz P4 / 2GB RAM
Fatman_do
Offline

Posting Freak

Posts: 3,482
Threads: 95
Joined: Nov 2005
#7
2006-09-16, 03:24 PM
I am not a code jockey so I don't know (just an ambitious skinner). It seems like there isn't much documentation from what I have read. This is "old", but may still have some relevent pointers.

MS also has "express" studios that are free.

I kind have been looking into maybe learning how to code with maybe C#, but don't think I have the time or patience. Last time I coded anything was my high school computer programming project 20 years ago in Cobol (A database program for tracking attendance, ect.). I got into drafting and then CAD and enjoyed it more and the programming intrest never stuck with me. Looking back on it, I wish I had kept it up.
Fatman_do
[SIZE="1"]
HTPC: AMD XP+2500, 512MB DDR (400) ~ Capture Device: Hauppage PVR-150
Storage: 30GB OS & Recording, 160GB Post Processing & Archive
Video Output: HD 32" TV via eVGA Geforce 6200le 256MB AGP DVI-HDMI cable out
Audio Output: Turtle Beach Riviera S/PDIF Optic Output (Digital pass thru only) to Home Theater Receiver[/SIZE]

[SIZE="2"]
Moderator | Tutorials | Community Skin | CommunitySkin-SVN[/SIZE]
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Possibly Related Threads…
Thread Author Replies Views Last Post
  NSIS installer script for a NPVR plugin? McBainUK 6 3,179 2011-12-10, 03:23 PM
Last Post: mvallevand

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D, modified by NextPVR - Powered by MyBB

Linear Mode
Threaded Mode