You are here

@Somebody good with NSIS

7 posts / 0 new
Last post
digitxp
digitxp's picture
Offline
Last seen: 11 years 2 weeks ago
Joined: 2007-11-03 18:33
@Somebody good with NSIS

I was minding my own business, compiling UP ME with a nenw feature, but the compiler was reporting this error:

include: "E:\PortableApps\NSISPortable\App\NSIS\Include\Registry.nsh"
!define: "registry::Open" already defined!
!include: error in script: "E:\PortableApps\NSISPortable\App\NSIS\Include\Registry.nsh" on line 1
Error in script "C:\Documents and Settings\all\Desktop\Casey\Development\UP ME\Other\UP ME.nsi" on line 82 -- aborting creation process

I was thinking, "What the heck!? This never happened once before!"
I tried redownloading registry.nsh, but the exact same report came...
I doubt if the line: !define registry::Open `!insertmacro registry::Open` could have anything wrong with it. Anyone know how to fix this?????
*Edit:* Here's the code:

;Copyright (C) 2008 Digitxp (Casey C.)

;This software is OSI Certified Open Source Software.
;OSI Certified is a certification mark of the Open Source Initiative.

;This program is free software; you can redistribute it and/or
;modify it under the terms of the GNU General Public License
;as published by the Free Software Foundation; either version 2
;of the License, or (at your option) any later version.

;This program is distributed in the hope that it will be useful,
;but WITHOUT ANY WARRANTY; without even the implied warranty of
;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;GNU General Public License for more details.

;You should have received a copy of the GNU General Public License
;along with this program; if not, write to the Free Software
;Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

;This software shows a lost.exe , defaults FFP, Launches up to 10 exes, launches menu, makes a shortcut, and searches for clamwin, gives IE a custom title, etc. etc.
;To Do:  add EjectScript Function, add eject program option, add folder copy.

!define NAME "UP ME"
!define VER "0.9.9.0"
OutFile "..\StartYourApps.exe"
Caption "${NAME} | PortableApps.com"
VIProductVersion "${VER}"
VIAddVersionKey ProductName "${NAME}"
VIAddVersionKey Comments "Enhances the abilities of a Portable Menu."
VIAddVersionKey CompanyName "PortableApps.com"
VIAddVersionKey LegalCopyright "Digitxp"
VIAddVersionKey FileDescription "${NAME}"
VIAddVersionKey FileVersion "${VER}"
VIAddVersionKey ProductVersion "${VER}"
VIAddVersionKey InternalName "${NAME}"
VIAddVersionKey LegalTrademarks "PortableApps.com is a Trademark of Rare Ideas, LLC."
VIAddVersionKey OriginalFilename "${NAME}.exe"

;===They're called variables because they vary.
Var MENULAUNCH
Var MENUEXE
Var START1
Var START2
Var START3
Var START4
Var START5
Var START6
Var START7
Var START8
Var START9
Var START10
Var INIPATH
Var LOSTTEXT
;Var FFP_Path
;Var DefaultFFP
Var DRIVE
Var SHORTCUTPATH
Var SHORTCUTNAME
Var CLAMPATH
Var CLOSEPATH
Var CUSTOMIETITLE

;===Maybe a few runtime switches?
CRCCheck On
WindowIcon Off
SilentInstall Silent 
AutoCloseWindow True
RequestExecutionLevel user
XPStyle On

;===Or a few compression switches, perhaps?
SetCompress Auto
SetCompressor /SOLID lzma
SetCompressorDictSize 32
SetDatablockOptimize On

;===Oh, and include these, please...
!include "Registry.nsh"
!include "FileFunc.nsh"
!insertmacro GetRoot
!include "MUI.nsh"
!include "Registry.nsh"

;===Make the icon look pretty, not NSISy
Icon ".\icon.ico"

Section Main
IfFileExists "$EXEDIR\${NAME}.ini" "" NoINI
StrCpy $INIPATH "$EXEDIR\${NAME}.ini"
;===Read the INI, find what to do.
ReadINIStr $LostText $INIPATH "General" LOSTTEXT
ReadINIStr $CLAMPATH $INIPATH "ClamScan" CLAMPATH
;ReadINIStr $DefaultFFP $INIPATH "General" DefaultFFP
;ReadINIStr $FFP_Path $INIPATH "General" FFPPath
ReadINIStr $MENULAUNCH $INIPATH "Execute" MenuStartPath
ReadINIStr $MENUEXE $INIPATH "Execute" MENUEXEName
ReadINIStr $START10 $INIPATH "Execute" Start10
ReadINIStr $START9 $INIPATH "Execute" Start9
ReadINIStr $START8 $INIPATH "Execute" Start8
ReadINIStr $START7 $INIPATH "Execute" Start7
ReadINIStr $START6 $INIPATH "Execute" Start6
ReadINIStr $START5 $INIPATH "Execute" Start5
ReadINIStr $START4 $INIPATH "Execute" Start4
ReadINIStr $START3 $INIPATH "Execute" Start3
ReadINIStr $START2 $INIPATH "Execute" Start2
ReadINIStr $START1 $INIPATH "Execute" Start1
ReadINIStr $CLOSEPATH $INIPATH "Execute" CloseEXEPath
ReadINIStr $SHORTCUTPATH $INIPATH "CustomShortcut" SHORTCUTPATH
ReadINIStr $SHORTCUTNAME $INIPATH "CustomShortcut" SHORTCUTNAME
ReadINIStr $CUSTOMIETITLE $INIPATH "General" CustomIETitle
;ReadINIStr $CLOSEEXE $INIPATH "General" EjectEXE
Goto RealStuff

NoINI:
StrCpy $LostText "Help me! I'm lost! I don't know who I belong to because they never filled out the form! Just walk around and ask! Thanks!"
;StrCpy $FFP-Path "PortableApps\FirefoxPortable\FirefoxPortable.exe"
StrCpy $MENULAUNCH "PortableApps\PortableAppsMenu\PortableAppsMenu.exe"
StrCpy $MENUEXE "PortableAppsMenu.exe"
StrCpy $CLAMPATH ""

RealStuff:
;===Show Lost Text
	MessageBox MB_OK|MB_TOPMOST|MB_ICONEXCLAMATION "$LostText"

;===Make a shortcut on the desktop
	${GetRoot} $EXEDIR $DRIVE
	SetOutPath $DESKTOP
	CreateShortcut "$DRIVE Drive.lnk" "$DRIVE:\" "$EXEDIR\Other\PAM-Stick2s.ico" "CONTROL|SHIFT|P"
	CreateShortcut "Documents.lnk" "$DRIVE:\Documents\" "$EXEDIR\Other\documents.ico" "CONTROL|SHIFT|D"
	StrCmp $SHORTCUTPATH "" ScanViruses
	CreateShortcut "$SHORTCUTNAME.lnk" "$SHORTCUTPATH" "$EXEDIR\Other\customicon.ico" "CONTROL|SHIFT|Z"
	
;===Scan for viruses
ScanViruses:
	StrCmp $CLAMPATH "" +1 IETitle
	IfFileExists "$EXEDIR\$CLAMPATH\ClamWinPortable.exe" +1 +4
	Execwait '"$EXEDIR\$CLAMPATH\App\clamwin\bin\freshclam.exe" --datadir=".\$CLAMPATH\Data\db" --config-file="$CLAMPATH\App\clamwin\bin\freshclam.conf`'
	Execwait '"$EXEDIR\$CLAMPATH\App\clamwin\bin\clamscan.exe" --infected --database=".\$CLAMPATH\Data\db" --memory'
	Goto LookForMenu
	MessageBox MB_OK|MB_ICONEXCLAMATION "There is no Clamwin Portable where specified. Please either disable clamwin scanning or fix the path in the INI file.$\n$\nDon't forget, it should be in the form of 'Folder\Folder\ClamWinPortable'" 
	
;===Default FFP Now
/*	StrCmp $DefaultFFP "True" "" LookForMenu
	;===Thanks to Ryan McCue for the DefaultMy FFP Code
	${Registry::MoveKey} "HKCU\Software\Classes\.shtml" "HKCU\Software\AssociationsBackupbyUPME\.shtml" $R0
	${Registry::MoveKey} "HKCU\Software\Classes\.xht" "HKCU\Software\AssociationsBackupbyUPME\.xht" $R0
	${Registry::MoveKey} "HKCU\Software\Classes\.xhtm" "HKCU\Software\AssociationsBackupbyUPME\.xhtm" $R0
	${Registry::MoveKey} "HKCU\Software\Classes\.xhtml" "HKCU\Software\AssociationsBackupbyUPME\.xhtml" $R0
	${Registry::MoveKey} "HKCU\Software\Classes\.htm" "HKCU\Software\AssociationsBackupbyUPME\.htm" $R0
	${Registry::MoveKey} "HKCU\Software\Classes\.html" "HKCU\Software\AssociationsBackupbyUPME\.html" $R0
	${Registry::MoveKey} "HKCU\Software\Classes\FireFoxHTML"
*/
	;Still very beta, to do
IETitle:
;===Make IE PortableApps.com Provided
StrCmp $CUSTOMIETITLE "" LookForMenu
${Registry::MoveValue} "HKCU\Software\Internet Explorer\Main" "Window Title" "HKCU\Software\Internet Explorer\Main" "WindowTitleBackup" $R0
${Registry::Write} "HKCU\Software\Internet Explorer\Main" "Window Title" "$CUSTOMIETITLE" "REG_SZ" $0
Push $0

;===Execution
	LookForMenu:
		IfFileExists "$EXEDIR\$MENULAUNCH" "" MenuError

	LookFile1:
		IfFileExists "$EXEDIR\$START1" "" ErrorFile1
	
	LookFile2:	
		IfFileExists "$EXEDIR\$START2" "" ErrorFile2
	
	LookFile3:
		IfFileExists "$EXEDIR\$START3" "" ErrorFile3
	
	LookFile4:
		IfFileExists "$EXEDIR\$START4" "" ErrorFile4

	LookFile5:
		IfFileExists "$EXEDIR\$START5" "" ErrorFile5

	LookFile6:
		IfFileExists "$EXEDIR\$START6" "" ErrorFile6
	
	LookFile7:	
		IfFileExists "$EXEDIR\$START7" "" ErrorFile7

	LookFile8:
		IfFileExists "$EXEDIR\$START8" "" ErrorFile8
	
	LookFile9:
		IfFileExists "$EXEDIR\$START9" "" ErrorFile9
	
	LookFile10:
		IfFileExists "$EXEDIR\$START10" "" ErrorFile10
	
	Exec "$EXEDIR\$MENULAUNCH"
	Exec "$EXEDIR\$START1"
	Exec "$EXEDIR\$START2"
	Exec "$EXEDIR\$START3"
	Exec "$EXEDIR\$START4"
	Exec "$EXEDIR\$START5"
	Exec "$EXEDIR\$START6"
	Exec "$EXEDIR\$START7"
	Exec "$EXEDIR\$START8"
	Exec "$EXEDIR\$START9"
	Exec "$EXEDIR\$START10"
	Goto WhileMenuRunning
	
	MenuError:
		MessageBox MB_OK|MB_ICONINFORMATION "Sorry, but the path $MENULAUNCH cannot be found, please try to fix this."
		Goto LookFile1
	
	ErrorFile1:
		;===Don't error a blank, please!
		StrCmp $START1 "" LookFile2
		MessageBox MB_OK|MB_ICONINFORMATION "Sorry, but the path $START1 cannot be found, please try to fix this."
		Goto LookFile2
	
	ErrorFile2:
		StrCmp $START2 "" LookFile3
		MessageBox MB_OK|MB_ICONINFORMATION "Sorry, but the path $START2 cannot be found, please try to fix this."
		Goto LookFile3
	
	ErrorFile3:
		StrCmp $START3 "" LookFile4
		MessageBox MB_OK|MB_ICONINFORMATION "Sorry, but the path $START3 cannot be found, please try to fix this."
		Goto LookFile4
	
	ErrorFile4:
		StrCmp $START4 "" LookFile5
		MessageBox MB_OK|MB_ICONINFORMATION "Sorry, but the path $START4 cannot be found, please try to fix this."
		Goto LookFile5
	
	ErrorFile5:
		StrCmp $START5 "" LookFile6
		MessageBox MB_OK|MB_ICONINFORMATION "Sorry, but the path $START5 cannot be found, please try to fix this."
		Goto LookFile6
	
	ErrorFile6:
		StrCmp $START6 "" LookFile7
		MessageBox MB_OK|MB_ICONINFORMATION "Sorry, but the path $START6 cannot be found, please try to fix this."
		Goto LookFile7
	
	ErrorFile7:
		StrCmp $START7 "" LookFile8
		MessageBox MB_OK|MB_ICONINFORMATION "Sorry, but the path $START7 cannot be found, please try to fix this."
		Goto LookFile8
	
	ErrorFile8:
		StrCmp $START8 "" LookFile9
		MessageBox MB_OK|MB_ICONINFORMATION "Sorry, but the path $START8 cannot be found, please try to fix this."
		Goto LookFile9
	
	ErrorFile9:
		StrCmp $START9 "" LookFile10
		MessageBox MB_OK|MB_ICONINFORMATION "Sorry, but the path $START9 cannot be found, please try to fix this."
		Goto LookFile10
		
	ErrorFile10:
		StrCmp $START10 "" Error2
		MessageBox MB_OK|MB_ICONINFORMATION "Sorry, but the path $START10 cannot be found, please try to fix this."
	
	Error2:
		MessageBox MB_OK|MB_ICONINFORMATION "Apparently you didn't put any entries into the INI file.$\n$\nIf this isn't the case, please put the paths to your exe's starting from the end."

WhileMenuRunning:
	Sleep 1000
	FindProcDLL::FindProc "$MENUEXEName"                  
	StrCmp $R0 "1" WhileMenuRunning

;CloseUpShop
	Sleep 2000
	Delete "$DESKTOP\Explore Your Drive.lnk"
	Delete "$DESKTOP\Documents.lnk"
	StrCmp $Shortcut "Yes" "" +2
	Delete "$DESKTOP\$SHORTCUTNAME.lnk"
	StrCmp $CLOSEPATH "" +1 +2
	Exec $CLOSEPATH
	${Registry::Unload}
/*	SetOutPath "$TEMP"
	File "Ejectscript\Eject.exe"
*/
;Still beta; to do.
SectionEnd
Travis Carrico
Offline
Last seen: 13 years 10 months ago
Developer
Joined: 2006-10-22 00:30
well i don't think that line

well i don't think that line is even needed; i've never used it. the only thing you need is have the registry plugin installed and include the line !include "Registry.nsh" and at the end of the script use ${registry::Unload}

wraithdu
Offline
Last seen: 9 years 3 months ago
Developer
Joined: 2007-06-27 20:22
What he said. Post your

What he said. Post your script for us to see anyway, we can't tell what's going on really without it.

digitxp
digitxp's picture
Offline
Last seen: 11 years 2 weeks ago
Joined: 2007-11-03 18:33
.

Oh, forgot to unload...

Insert original signature here with Greasemonkey Script.

David Dixon II
David Dixon II's picture
Offline
Last seen: 7 months 3 weeks ago
Developer
Joined: 2007-06-11 22:54
Repeats

;===Oh, and include these, please...
!include "Registry.nsh"
!include "FileFunc.nsh"
!insertmacro GetRoot
!include "MUI.nsh"
!include "Registry.nsh"

delete one of the registry.nsh Wink

Code Here Finished With Warnings

after deleting one of those it compliled sussesfully Smile

3 warnings:
unknown variable/constant "Shortcut" detected, ignoring (C:\Documents and Settings\MyUserName\Desktop\turtle\pie.nsi:273)
Variable "MUI_TEMP1" not referenced or never set, wasting memory!
Variable "MUI_TEMP2" not referenced or never set, wasting memory!

Ps. VERY Nice App By The Way Wink

After Creating The Entire .ini File Correctly. I Got Led To The Line 262 Error After It Found All My Starts.

And The CustomShort Shortcut Is Screwed. It Created A Shortcut On My Desktop With A Link To "C:\PortableApps\CAFE\CAFEMod.exe E:\Other\customicon.ico" And The Drive Icon Follows Your App And Doesnt Go To The Desktop.

Hope This App Comes Out Looking Good. Cause I Like It Wink

Na na na, come on!

digitxp
digitxp's picture
Offline
Last seen: 11 years 2 weeks ago
Joined: 2007-11-03 18:33
Thanks

I'm only supporting this until the new menu comes out (Hopefully the new menu will have these features too.)

Insert original signature here with Greasemonkey Script.

David Dixon II
David Dixon II's picture
Offline
Last seen: 7 months 3 weeks ago
Developer
Joined: 2007-06-11 22:54
.

No Problem Smile

Na na na, come on!

Log in or register to post comments