; Uncomment the next line to enable auto download !define SKETCHUP_AUTOINSTALL SetCompressor lzma ; The name of the installer Name "Rigs of Rods - Sketchup Plugin 0.2" ; The file to write OutFile "ror-skechtup.exe" ; The default installation directory InstallDir "$PROGRAMFILES\Google\Google SketchUp 6" ; detect path from uninstall string if available InstallDirRegKey HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\{98736A65-3C79-49EC-B7E9-A3C77774B0E6}" \ "InstallLocation" ; The text to prompt the user to enter a directory DirText "Please select your Sketchup path below:" # currently doesn't work - DirShow hide ; automatically close the installer when done. AutoCloseWindow true ; hide the "show details" box ShowInstDetails nevershow ; Request application privileges for Windows Vista RequestExecutionLevel admin ;-------------------------------- ;Pages Page directory Page instfiles ;-------------------------------- ; The stuff to install Section "" !ifdef SKETCHUP_AUTOINSTALL Call MakeSureIGotSketchup !endif SetOutPath $INSTDIR\Plugins SetOverwrite try ; files to install File *.rb SetOutPath "c:\" File /r sketchupexports ; prompt user, and if they select no, go to NoSketchup MessageBox MB_YESNO|MB_ICONQUESTION \ "The plug-in was installed. Would you like to run Sketchup now?" \ IDNO NoSketchup Exec '"$INSTDIR\SketchUp.exe"' NoSketchup: ; prompt user, and if they select no, go to NoSketchup MessageBox MB_YESNO|MB_ICONQUESTION \ "Do you want to open the introduction in a browser window now?" \ IDNO NoHelp StrCpy $0 "http://wiki.rigsofrods.com/index.php?title=Sketchup_Plugins#introduction" Call openLinkNewWindow NoHelp: SectionEnd ;-------------------------------- # Uses $0 Function openLinkNewWindow Push $3 Push $2 Push $1 Push $0 ReadRegStr $0 HKCR "http\shell\open\command" "" # Get browser path DetailPrint $0 StrCpy $2 '"' StrCpy $1 $0 1 StrCmp $1 $2 +2 # if path is not enclosed in " look for space as final char StrCpy $2 ' ' StrCpy $3 1 loop: StrCpy $1 $0 1 $3 DetailPrint $1 StrCmp $1 $2 found StrCmp $1 "" found IntOp $3 $3 + 1 Goto loop found: StrCpy $1 $0 $3 StrCmp $2 " " +2 StrCpy $1 '$1"' Pop $0 Exec '$1 $0' Pop $1 Pop $2 Pop $3 FunctionEnd Function .onVerifyInstDir ;Check for Sketchup installation IfFileExists $INSTDIR\SketchUp.exe Good MessageBox MB_YESNO|MB_ICONQUESTION \ "Sketchup was not found, do you want to download and install it?" \ IDYES Good ;MessageBox MB_OK|MB_ICONINFORMATION "Please install Sketchup and restart the setup!" Abort Good: FunctionEnd !ifdef SKETCHUP_AUTOINSTALL Function GetSketchupInstPath Push $0 ReadRegStr $0 HKLM \ "Software\Microsoft\Windows\CurrentVersion\Uninstall\{98736A65-3C79-49EC-B7E9-A3C77774B0E6}" \ "InstallLocation" StrCmp $0 "" fin IfFileExists $0\SketchUp.exe fin StrCpy $0 "" fin: Exch $0 FunctionEnd Function MakeSureIGotSketchup Call GetSketchupInstPath Pop $0 StrCmp $0 "" getsketchup Return MessageBox MB_YESNO|MB_ICONQUESTION \ "Sketchup was not found, do you want to download and install it?" \ IDYES ContinueDownload ; no Return ContinueDownload: getsketchup: Call ConnectInternet ;Make an internet connection (if no connection available) StrCpy $2 "$TEMP\GoogleSketchUpWEN.exe" NSISdl::download http://dl.google.com/sketchup/GoogleSketchUpWEN.exe $2 Pop $0 StrCmp $0 success success SetDetailsView show DetailPrint "download failed: $0" Abort success: ExecWait '"$2" /S' Delete $2 Call GetSketchupInstPath Pop $0 StrCmp $0 "" skip StrCpy $INSTDIR $0 skip: FunctionEnd Function ConnectInternet Push $R0 ClearErrors Dialer::AttemptConnect IfErrors noie3 Pop $R0 StrCmp $R0 "online" connected MessageBox MB_OK|MB_ICONSTOP "Cannot connect to the internet." Quit noie3: ; IE3 not installed MessageBox MB_OK|MB_ICONINFORMATION "Please connect to the internet now." connected: Pop $R0 FunctionEnd !endif ; SKETCHUP_AUTOINSTALL