HM NIS Edit 2.03 Development Test 7

TaffinFoxcroft's picture
Submitted by TaffinFoxcroft on June 12, 2008 - 5:22am

Application: HM NIS Edit
Category: Development
Description: (Taken from the web site) HM NIS Edit is the best Editor/IDE for Nullsoft Scriptable Install System (NSIS). Its useful for experts and beginners in the creation of Setup programs with the NSIS.
Download:
NSIS Preconfigured:
http://cubegames.net/taneth/uploads/HM_NIS_Edit_Portable_NSIS_Preconfigu...
Just HM NIS Edit:
http://cubegames.net/taneth/uploads/HM_NIS_Edit_Portable_2.03_Developmen...
Release Notes:
Development Test 7 (31-07-2008):
fixed a bug where the INI wasn't being moved.
Development Test 6 (22-07-2008):
fixed the DefaultData problem, and made changes suggested by OliverK.... again.
Development Test 5 (04-07-2008):
fixed problems listed by OliverK.
Development Test 4 (28-06-2008):
fixed ReplaceInFile problems.
Development Test 3 (17-06-2008):
fixed up the integrated NSIS support.
Development Test 2 (13-06-2008):
Fixed some Typos.
Development Test 1 (6-06-2008):
Initial Release


( categories: )

Seems to work o/k

Have had a quick look. Quite a nice NSIS editor that lets you edit & compile in one application. Doesn't seem to have been updated in a long time though. I could be tempted to use this for script work instead of Notepad++/NSIS. I had a little bit of trouble configuring the compiler option, until I figured out it was looking for the original NSIS exe rather than the portablised NSIS launcher exe. Anyway, I like this little integrated editor/compiler. Good effort.

Kim

it is prety good, yeah. I was

it is prety good, yeah. I was using notepad++ for a bit, but then someone reccomemended this for some other guy, and I liked it. also, does anyone know what stuff the NSIS Portable launcher cleans up? like does makensis.exe leave anything or is it just the GUI?

Australia's Great Dividing Range : Dividing From What?
Patrick Patience is a key virtue.
behold, return of taneth111! (insert darth vader music here)

The NSISPortable launcher

The NSISPortable launcher will clean up the registry entries left by makensis.exe. I wrote the launcher to monitor nsis.exe, makensis.exe and zip2exe.exe, and only close if none of those are running.

The developer formerly known as ZGitRDun8705

makensis.exe/makensisw.exe

From looking at the source code for 'makensis.exe', I believe that it is only the GUI that uses the registry. The only things 'makensis.exe' uses are the following environment variables:

APPDATA (Windows)
HOME (Linux, Unix, etc)
NSISCONFDIR

I see no indication of that

I see no indication of that in the AppData folder or the Launcher source code.

Good gracious! There goes a kangaroo. I must have a practice with me boomerang- Now then, slowly back
If you throw that thing at me, I'll jump right on your head.
Innit marvellous? Got a land full of kangaroos and I had to pick that one.

RE: makensis.exe/makensisw.exe

It is in the actual source code for makensis.exe (makenssi.cpp).

True, it doesn't actually use the AppData folder (from what I could see), but it's there in the source.

If you have the source code archive for NSIS, just look in the file 'makenssi.cpp'.

Fair enough

Fair enough

Good gracious! There goes a kangaroo. I must have a practice with me boomerang- Now then, slowly back
If you throw that thing at me, I'll jump right on your head.
Innit marvellous? Got a land full of kangaroos and I had to pick that one.

Program looks nice.

I'm downloading and will test later.

Jacobm001

new version

Zach, i stole some of your nsis portable code and added it in. dev test 3 now available.

Australia's Great Dividing Range : Dividing From What?
Patrick Patience is a key virtue.
behold, return of taneth111! (insert darth vader music here)

its not stealing since it's

its not stealing since it's all OSS ;)

The developer formerly known as ZGitRDun8705

Settings

It doesn't remember where NSIS is. You need to replace the drive letter in it's options file.

Jacobm001

fixed in dev test 4.

fixed in dev test 4.

Australia's Great Dividing Range : Dividing From What?
Patrick Patience is a key virtue.
behold, return of taneth111! (insert darth vader music here)

Issues: Just downloaded Dev

Issues:

Just downloaded Dev Test 4-without NSIS.

Relaunches HM NIS edit after I close. If I remember correctly, this means you need a Goto TheEnd after your after your launch and exit, as well as when your down putting the registry back together. i.e.

     RemoveNSISSettings:
        	${registry::SaveKey} "HKEY_CURRENT_USER\Software\NSIS" "$SETTINGSDIRECTORY\NSIS_portable.reg" "" $0
                ${registry::DeleteKey} "HKEY_CURRENT_USER\Software\NSIS" $R0
		Sleep 100
		${registry::KeyExists} "HKEY_CURRENT_USER\Software\NSIS-BackupByNSISPortable" $R0
		${registry::MoveKey} "HKEY_CURRENT_USER\Software\NSIS-BackupByNSISPortable" "HKEY_CURRENT_USER\Software\NSIS" $R0
		Sleep 100
		Goto TheEnd
	LaunchAndExit:
		Exec $EXECSTRING
		Goto TheEnd

Doesn't appear to be fixing the path to my flash drive. Loses it when I go from computer to computer.- Figured it out! You don't seem to have your nisedit.ini anywhere. Put that in App/DefaultData to be copied in if the script can't find any setting in Data.

Also, MakeNSIS gives the following errors:
2 warnings:
Variable "MUI_TEMP1" not referenced or never set, wasting memory!
Variable "MUI_TEMP2" not referenced or never set, wasting memory!

Sorry if I seen to be burying you. We can work out the PAF specific things after that. Good job, and a great app! Wish I'd found it.

Good gracious! There goes a kangaroo. I must have a practice with me boomerang- Now then, slowly back
If you throw that thing at me, I'll jump right on your head.
Innit marvellous? Got a land full of kangaroos and I had to pick that one.

thanks for the feedback.

thanks for the feedback. fixed in Dev test 5, which i will release.

Australia's Great Dividing Range : Dividing From What?
Patrick Patience is a key virtue.
behold, return of taneth111! (insert darth vader music here)

Doesn't appear to be fixing

Doesn't appear to be fixing drive paths either.

I went wild on the code the other night, if you want, I'll post it for you, though I still haven't gotten it to adjust the paths. Also, you'll need to move all of the files for the plugins, as per http://portableapps.com/node/11715#comment-76948. I didn't know this at the time of coding.

I would suggest figuring out of you are going to support an external compiler (one not under HM NIS EditPortable/App/nsis). If you do, well, its a barrel full.

Alright. I'll get off your case for now.

Good gracious! There goes a kangaroo. I must have a practice with me boomerang- Now then, slowly back
If you throw that thing at me, I'll jump right on your head.
Innit marvellous? Got a land full of kangaroos and I had to pick that one.

hmmm. i took the download

hmmm. i took the download link down becuase it wasn't properly doing the paths. seems like a common problem. also, what the launcher is meant to do in order:

  1. Move the INI from the data folder to the app dir.
  2. Adjust the paths in the INI.
  3. Move nsisconf.nsh to the nsis dir.
  4. Do some registry stuff for NSIS.
  5. Launch the app.
  6. Move the INI and nsisconf.nsh back to the data dir.
  7. Put the registry back.

there is a splash screen in there somewhere, but this is a list of the basic functions.

Australia's Great Dividing Range : Dividing From What?
Patrick Patience is a key virtue.
behold, return of taneth111! (insert darth vader music here)

Here's where I'm at. I still

Here's where I'm at. I got the AdjustPaths to work. If you want to be nice, you can mention me, but you don't have to.

;Copyright (C) 2004-2008 John T. Haller of PortableApps.com
;Copyright (C) 2008 Taneth111
;Website: http://portableapps.com/Development/Test

;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.

!define PORTABLEAPPNAME "HM NIS Edit Portable"
!define APPNAME "HMNISEdit"
!define NAME "HMNISEditPortable"
!define VER "1.5.5.0"
!define WEBSITE "PortableApps.com/DevelopmentTest"
!define DEFAULTEXE "nisedit.exe"
!define DEFAULTAPPDIR "NISEdit"

;=== Program Details
Name "${PORTABLEAPPNAME}"
OutFile "..\..\${NAME}Alternate.exe"
Caption "${PORTABLEAPPNAME} | PortableApps.com"
VIProductVersion "${VER}"
VIAddVersionKey ProductName "${PORTABLEAPPNAME}"
VIAddVersionKey Comments "Allows ${APPNAME} to be run from a removable drive.  For additional details, visit ${WEBSITE}"
VIAddVersionKey CompanyName "PortableApps.com And Contributors"
VIAddVersionKey LegalCopyright "John T. Haller And Contributors"
VIAddVersionKey FileDescription "${PORTABLEAPPNAME}"
VIAddVersionKey FileVersion "${VER}"
VIAddVersionKey ProductVersion "${VER}"
VIAddVersionKey InternalName "${PORTABLEAPPNAME}"
VIAddVersionKey LegalTrademarks "PortableApps.com is a Trademark of Rare Ideas, LLC."
VIAddVersionKey OriginalFilename "${NAME}.exe"
;VIAddVersionKey PrivateBuild ""
;VIAddVersionKey SpecialBuild ""

;=== Runtime Switches
CRCCheck On
WindowIcon Off
SilentInstall Silent
AutoCloseWindow True
RequestExecutionLevel user

; Best Compression
SetCompress Auto
SetCompressor /SOLID lzma
SetCompressorDictSize 32
SetDatablockOptimize On

;=== Include
!include "FileFunc.nsh"
!insertmacro GetParameters
!insertmacro GetRoot
!include "ReplaceInFile.nsh"
!include "StrRep.nsh"
!include "MUI.nsh"
!include "registry.nsh"
;=== Program Icon
Icon "..\..\App\AppInfo\appicon.ico"

;=== Icon & Stye ===
!define MUI_ICON "..\..\App\AppInfo\appicon.ico"

;=== Languages
;!insertmacro MUI_LANGUAGE "English"

LangString LauncherFileNotFound ${LANG_ENGLISH} "${PORTABLEAPPNAME} cannot be started. You may wish to re-install to fix this issue. (ERROR: $MISSINGFILEORPATH could not be found)"
LangString LauncherAlreadyRunning ${LANG_ENGLISH} "Another instance of ${APPNAME} is already running. Please close other instances of ${APPNAME} before launching ${PORTABLEAPPNAME}."
LangString LauncherAskCopyLocal ${LANG_ENGLISH} "${PORTABLEAPPNAME} appears to be running from a location that is read-only. Would you like to temporarily copy it to the local hard drive and run it from there?$\n$\nPrivacy Note: If you say Yes, your personal data within ${PORTABLEAPPNAME} will be temporarily copied to a local drive. Although this copy of your data will be deleted when you close ${PORTABLEAPPNAME}, it may be possible for someone else to access your data later."
LangString LauncherNoReadOnly ${LANG_ENGLISH} "${PORTABLEAPPNAME} can not run directly from a read-only location and will now close."

Var PROGRAMDIRECTORY
Var SETTINGSDIRECTORY
Var ADDITIONALPARAMETERS
Var EXECSTRING
Var PROGRAMEXECUTABLE
Var INIPATH
Var SECONDARYLAUNCH
Var DISABLESPLASHSCREEN
Var LASTDRIVE
Var CURRENTDRIVE
Var MISSINGFILEORPATH
Var ALTERNATENSISPATH

Section "Main"
	;=== Check if already running
	System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${NAME}") i .r1 ?e'
	Pop $0
	StrCmp $0 0 CheckINI
		StrCpy $SECONDARYLAUNCH "true"

	CheckINI:
		;=== Find the INI file, if there is one
		IfFileExists "$EXEDIR\${NAME}.ini" "" CheckSubINI
			StrCpy "$INIPATH" "$EXEDIR"
			Goto ReadINI

	CheckSubINI:
		IfFileExists "$EXEDIR\${NAME}\${NAME}.ini" "" NoINI
			StrCpy "$INIPATH" "$EXEDIR\${NAME}"
			Goto ReadINI

	ReadINI:
		;=== Read the parameters from the INI file
		ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "${APPNAME}Directory"
		StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\$0"
		ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "SettingsDirectory"
		StrCpy "$SETTINGSDIRECTORY" "$EXEDIR\$0"
		ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "AlternateNSISPath"
		StrCpy "$ALTERNATENSISPATH" "$EXEDIR\$0"
	

		;=== Check that the above required parameters are present
		IfErrors NoINI
		ReadINIStr $ADDITIONALPARAMETERS "$INIPATH\${NAME}.ini" "${NAME}" "AdditionalParameters"
		ReadINIStr $DISABLESPLASHSCREEN "$INIPATH\${NAME}.ini" "${NAME}" "DisableSplashScreen"

	;CleanUpAnyErrors:
		;=== Any missing unrequired INI entries will be an empty string, ignore associated errors
		ClearErrors

		;=== Correct PROGRAMEXECUTABLE if blank
		StrCmp $PROGRAMEXECUTABLE "" "" EndINI
			StrCpy "$PROGRAMEXECUTABLE" "${DEFAULTEXE}"
			Goto EndINI

	NoINI:
		;=== No INI file, so we'll use the defaults
		StrCpy "$ADDITIONALPARAMETERS" ""
		StrCpy "$PROGRAMEXECUTABLE" "${DEFAULTEXE}"

		IfFileExists "$EXEDIR\App\${DEFAULTAPPDIR}\${DEFAULTEXE}" "" NoProgramEXE
			StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\App\${DEFAULTAPPDIR}"
			StrCpy "$SETTINGSDIRECTORY" "$EXEDIR\Data\settings"
			GoTo EndINI

	EndINI:
		IfFileExists "$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" FoundProgramEXE

	NoProgramEXE:
		;=== Program executable not where expected
		StrCpy $MISSINGFILEORPATH $PROGRAMEXECUTABLE
		MessageBox MB_OK|MB_ICONEXCLAMATION `$(LauncherFileNotFound)`
		Abort
		
	FoundProgramEXE:
		;=== Check if running
		StrCmp $SECONDARYLAUNCH "true" GetPassedParameters
		FindProcDLL::FindProc "${DEFAULTEXE}"
		StrCmp $R0 "1" WarnAnotherInstance DisplaySplash

	WarnAnotherInstance:
		MessageBox MB_OK|MB_ICONINFORMATION `$(LauncherAlreadyRunning)`
		Abort
	
	DisplaySplash:
		StrCmp $DISABLESPLASHSCREEN "true" GetPassedParameters
			;=== Show the splash screen while processing registry entries
			InitPluginsDir
			File /oname=$PLUGINSDIR\splash.jpg "${NAME}.jpg"
			newadvsplash::show /NOUNLOAD 1000 100 0 -1 /L $PLUGINSDIR\splash.jpg
	
	GetPassedParameters:
		;=== Get any passed parameters
		${GetParameters} $0
		StrCmp "'$0'" "''" "" LaunchProgramParameters

		;=== No parameters
		StrCpy $EXECSTRING `"$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE"`
		Goto AdditionalParameters

	LaunchProgramParameters:
		StrCpy $EXECSTRING `"$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" $0`

	AdditionalParameters:
		StrCmp $ADDITIONALPARAMETERS "" SettingsDirectory

		;=== Additional Parameters
		StrCpy $EXECSTRING `$EXECSTRING $ADDITIONALPARAMETERS`
	
	SettingsDirectory:
		;=== Set the settings directory if we have a path
		IfFileExists "$SETTINGSDIRECTORY\*.*" CheckForSettings
			CreateDirectory $SETTINGSDIRECTORY
	
	CheckForSettings:
		StrCmp $SECONDARYLAUNCH "true" LaunchAndExit
		IfFileExists "$SETTINGSDIRECTORY\nisedit.ini" AdjustPaths
		Rename "$EXEDIR\App\DefaultData\nisedit.ini" "$PROGRAMDIRECTORY\nisedit.ini"
		Goto AdjustPaths
		;IfFileExists "$EXEDIR\App\DefaultData\nisedit.ini" "" Launch
		;	CopyFiles /SILENT "$EXEDIR\App\DefaultData\nisedit.ini" "$PROGRAMDIRECTORY"
		;	Goto Launch	
		
    AdjustPaths:
		ReadINIStr $LASTDRIVE "$SETTINGSDIRECTORY\${NAME}Settings.ini" "${NAME}Settings" "LastDrive"
		${GetRoot} $EXEDIR $CURRENTDRIVE
		StrCmp $LASTDRIVE $CURRENTDRIVE StoreCurrentDriveLetter
		IfFileExists "$SETTINGSDIRECTORY\nisedit.ini" "" StoreCurrentDriveLetter
			${ReplaceInFile} "$SETTINGSDIRECTORY\nisedit.ini" '$LASTDRIVE' '$CURRENTDRIVE'
			Delete "$SETTINGSDIRECTORY\nisedit.ini.old"
		Goto NSISDirectorySetup

	StoreCurrentDriveLetter:
		WriteINIStr "$SETTINGSDIRECTORY\${NAME}Settings.ini" "${NAME}Settings" "LastDrive" "$CURRENTDRIVE"
	
	NSISDirectorySetup:
		Rename "$SETTINGSDIRECTORY\nisedit.ini" "$PROGRAMDIRECTORY\nisedit.ini"
		IfFileExists "$SETTINGSDIRECTORY\nsisconf.nsh" MoveNSISSettings CheckAlternateNSIS
		
    MoveNSISSettings:
        Rename "$SETTINGSDIRECTORY\nsisconf.nsh" "$EXEDIR\App\nsis\nsisconf.nsh"
		Goto Launch
		
	CheckAlternateNSIS:
		IfFileExists "$CURRENTDRIVE\PortableApps\NSISPortable\NSISPortable.exe" FixNSH UseINIAlternatePath
	
	FixNSH:
	Rename "$CURRENTDRIVE\PortableApps\NSISPortable\Data\settings\nsisconf.nsh" "$CURRENTDRIVE\PortableApps\NSISPortable\App\NSIS\nsisconf.nsh"
	Goto Launch
	
	UseINIAlternatePath:
	Rename "$CURRENTDRIVE\$ALTERNATENSISPATH\Data\settings\nsisconf.nsh" "$CURRENTDRIVE\$ALTERNATENSISPATH\NSISPortable\App\nsis\nsisconf.nsh"
	Goto Launch
	
	Launch:
		StrCmp $SECONDARYLAUNCH "true" LaunchAndExit
		Exec $EXECSTRING
		;=== Backup the registry
		${registry::KeyExists} "HKEY_CURRENT_USER\Software\NSIS-BackupByNSISPortable" $R0
		${registry::KeyExists} "HKEY_CURRENT_USER\Software\NSIS" $R0
		${registry::MoveKey} "HKEY_CURRENT_USER\Software\NSIS" "HKEY_CURRENT_USER\Software\NSIS-BackupByNSISPortable" $R0
		Sleep 100
		NsExec::ExecToStack `"$WINDIR\system32\reg.exe" import "$SETTINGSDIRECTORY\NSIS_portable.reg"`
		
	CheckRunning:
		Sleep 1000
		FindProcDLL::FindProc "${DEFAULTEXE}"                  
		StrCmp $R0 "1" CheckRunning

	;=== Put the settings file back
	Sleep 500
	Rename "$PROGRAMDIRECTORY\nisedit.ini" "$SETTINGSDIRECTORY\nisedit.ini"
        IfFileExists "$EXEDIR\App\nsis\*.*" "" RemoveNSISSettings
        Goto TheEnd
        
        RemoveNSISSettings:
        	${registry::SaveKey} "HKEY_CURRENT_USER\Software\NSIS" "$SETTINGSDIRECTORY\NSIS_portable.reg" "" $0
                ${registry::DeleteKey} "HKEY_CURRENT_USER\Software\NSIS" $R0
		Sleep 100
		${registry::KeyExists} "HKEY_CURRENT_USER\Software\NSIS-BackupByNSISPortable" $R0
		${registry::MoveKey} "HKEY_CURRENT_USER\Software\NSIS-BackupByNSISPortable" "HKEY_CURRENT_USER\Software\NSIS" $R0
		Sleep 100
		Goto TheEnd
	LaunchAndExit:
		Exec $EXECSTRING
		Goto TheEnd

	TheEnd:
		newadvsplash::stop /WAIT
SectionEnd

Your problem was here:

${ReplaceInFile} "$SETTINGSDIRECTORY\nisedit.ini" '$LASTDRIVE' '$CURRENTDRIVE'

You had added some extra gobble-de-gook, which was messing up the replace. It stores in the manner of "X:"

I also added some ini gobble-de-gook which allows for the NSIS portable to be in more places then

  1. PortableApps\NSISPortable
  2. HM NIS Portable\App\nsis

Good work on the base. Continue the project. I still get the mui temp warnings, I haven't figured out where those are from.

Enjoy
OliverK

Good gracious! There goes a kangaroo. I must have a practice with me boomerang- Now then, slowly back
If you throw that thing at me, I'll jump right on your head.
Innit marvellous? Got a land full of kangaroos and I had to pick that one.

MUI: kill it!

(I got caught with this also, in BPBible Portable!)

MUI is not needed unless you need a page like the Mozilla thing on the first run of FF
You aren't doing that, so you can remove the lines:

!include "MUI.nsh"
!define MUI_ICON "..\..\App\AppInfo\appicon.ico"
;!insertmacro MUI_LANGUAGE "English"

You'll save at least 5KB if you disable it! :O

Also, you use registry.nsh. You really MUST HAVE

${registry::Unload}

in TheEnd - otherwise it'll leave stuff in %TEMP%

And no, I can't test it yet - I'm only going on what OliverK posted! I would have downloaded it, but you removed the link... :-(

Chris Morgan (formerly chrism) :-)

Religion = Christian\Christadelphian
Likes_Swearing = false
Portable_App_Developer = true

Thanks

Thanks

Good gracious! There goes a kangaroo. I must have a practice with me boomerang- Now then, slowly back
If you throw that thing at me, I'll jump right on your head.
Innit marvellous? Got a land full of kangaroos and I had to pick that one.

i noticed you referenced to

i noticed you referenced to PortableApps\NSISPortable\NSISPortable.exe.
HM NIS Edit only likes to reference to the actual command line file, makensis.exe.
fixed that and uploaded new version.

Australia's Great Dividing Range : Dividing From What?
Patrick Patience is a key virtue.
behold, return of taneth111! (insert darth vader music here)

look

look again.

NSISDirectorySetup:
		Rename "$SETTINGSDIRECTORY\nisedit.ini" "$PROGRAMDIRECTORY\nisedit.ini"
		IfFileExists "$SETTINGSDIRECTORY\nsisconf.nsh" MoveNSISSettings CheckAlternateNSIS
		
    MoveNSISSettings:
        Rename "$SETTINGSDIRECTORY\nsisconf.nsh" "$EXEDIR\App\nsis\nsisconf.nsh"
		Goto Launch
		
	CheckAlternateNSIS:
		IfFileExists "$CURRENTDRIVE\PortableApps\NSISPortable\NSISPortable.exe" FixNSH UseINIAlternatePath
	
	FixNSH:
	Rename "$CURRENTDRIVE\PortableApps\NSISPortable\Data\settings\nsisconf.nsh" "$CURRENTDRIVE\PortableApps\NSISPortable\App\NSIS\nsisconf.nsh"
	Goto Launch

It only does this for using the NSIS Portable if its not under App/nsis
Which it checks first.
By the way, the INI alternate path allows someone not using stuff under the PApps folder. Or, using it inside of another folder.

Good gracious! There goes a kangaroo. I must have a practice with me boomerang- Now then, slowly back
If you throw that thing at me, I'll jump right on your head.
Innit marvellous? Got a land full of kangaroos and I had to pick that one.

yes but: IfFileExists

yes but:

IfFileExists "$CURRENTDRIVE\PortableApps\NSISPortable\NSISPortable.exe" FixNSH UseINIAlternatePath

refers to NSISPortable.exe and HM NIS Edit only likes makensis.exe, as in the command line version.

Australia's Great Dividing Range : Dividing From What?
Patrick Patience is a key virtue.
behold, return of taneth111! (insert darth vader music here)

It uses to see whether to

It uses to see whether to flop X:/PortableApps/NsisPortable/App/nsis/config or X:/PortableApps/HM NIS Edit Portable/App/nsis

I'll leave you alon, and see if your version is working- mine is having trouble storing the directory letter.

Good gracious! There goes a kangaroo. I must have a practice with me boomerang- Now then, slowly back
If you throw that thing at me, I'll jump right on your head.
Innit marvellous? Got a land full of kangaroos and I had to pick that one.

Should I leave you

Should I leave you alone?
Nether set up paths properly.
The problem is here:

AdjustPaths:
		ReadINIStr $LASTDRIVE "$SETTINGSDIRECTORY\${NAME}Settings.ini" "${NAME}Settings" "LastDrive"
		${GetRoot} $EXEDIR $CURRENTDRIVE
		StrCmp $LASTDRIVE $CURRENTDRIVE StoreCurrentDriveLetter
		IfFileExists "$SETTINGSDIRECTORY\nisedit.ini" "" StoreCurrentDriveLetter
			${ReplaceInFile} "$SETTINGSDIRECTORY\nisedit.ini" '$LASTDRIVE' '$CURRENTDRIVE'
			Delete "$SETTINGSDIRECTORY\nisedit.ini.old"
		Goto NSISDirectorySetup

Those extra "" in IfFileExists "$SETTINGSDIRECTORY\nisedit.ini" "" StoreCurrentDriveLetter are throwing things off.

You still need to put a nisedit.ini in the defualtdata directory! Its saving to the registry.

I really like this app, and I'm trying to help. You are, however, more then welcome to tell me to buzz off and go away.

Good gracious! There goes a kangaroo. I must have a practice with me boomerang- Now then, slowly back
If you throw that thing at me, I'll jump right on your head.
Innit marvellous? Got a land full of kangaroos and I had to pick that one.

actually, i like your

actually, i like your criticism, i usually dont get anywhere near as much as i like. :P
fixing as you read this.

Australia's Great Dividing Range : Dividing From What?
Patrick Patience is a key virtue.
behold, return of taneth111! (insert darth vader music here)

Okay. I feel like a dufas

Okay. I feel like a dufas and shall apologize. When I added in some extra code- I broke the path adjustment, since it wasn't able to store the new drive letter. So, then I make it store the letter- bet then it never gets around to actually replacing the drive letter.

So . . . I broke you script. I busted it and busted it good. But, thankfully, I've gotten the problem fixed. Now, if all the other features work . . .

;Copyright (C) 2004-2008 John T. Haller of PortableApps.com

;Website: http://portableapps.com/Development/Test

;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.

!define PORTABLEAPPNAME "HM NIS Edit Portable"
!define APPNAME "HMNISEdit"
!define NAME "HMNISEditPortable"
!define VER "1.5.5.0"
!define WEBSITE "PortableApps.com/DevelopmentTest"
!define DEFAULTEXE "nisedit.exe"
!define DEFAULTAPPDIR "NISEdit"

;=== Program Details
Name "${PORTABLEAPPNAME}"
OutFile "..\..\${NAME}.exe"
Caption "${PORTABLEAPPNAME} | PortableApps.com"
VIProductVersion "${VER}"
VIAddVersionKey ProductName "${PORTABLEAPPNAME}"
VIAddVersionKey Comments "Allows ${APPNAME} to be run from a removable drive.  For additional details, visit ${WEBSITE}"
VIAddVersionKey CompanyName "PortableApps.com And Contributors"
VIAddVersionKey LegalCopyright "John T. Haller And Contributors"
VIAddVersionKey FileDescription "${PORTABLEAPPNAME}"
VIAddVersionKey FileVersion "${VER}"
VIAddVersionKey ProductVersion "${VER}"
VIAddVersionKey InternalName "${PORTABLEAPPNAME}"
VIAddVersionKey LegalTrademarks "PortableApps.com is a Trademark of Rare Ideas, LLC."
VIAddVersionKey OriginalFilename "${NAME}.exe"
;VIAddVersionKey PrivateBuild ""
;VIAddVersionKey SpecialBuild ""

;=== Runtime Switches
CRCCheck On
WindowIcon Off
SilentInstall Silent
AutoCloseWindow True
RequestExecutionLevel user

; Best Compression
SetCompress Auto
SetCompressor /SOLID lzma
SetCompressorDictSize 32
SetDatablockOptimize On

;=== Include
!include "FileFunc.nsh"
!insertmacro GetParameters
!insertmacro GetRoot
!include "ReplaceInFile.nsh"
!include "StrRep.nsh"
!include "registry.nsh"
;=== Program Icon
Icon "..\..\App\AppInfo\appicon.ico"

;=== Icon & Stye ===

LangString LauncherFileNotFound ${LANG_ENGLISH} "${PORTABLEAPPNAME} cannot be started. You may wish to re-install to fix this issue. (ERROR: $MISSINGFILEORPATH could not be found)"
LangString LauncherAlreadyRunning ${LANG_ENGLISH} "Another instance of ${APPNAME} is already running. Please close other instances of ${APPNAME} before launching ${PORTABLEAPPNAME}."
LangString LauncherAskCopyLocal ${LANG_ENGLISH} "${PORTABLEAPPNAME} appears to be running from a location that is read-only. Would you like to temporarily copy it to the local hard drive and run it from there?$\n$\nPrivacy Note: If you say Yes, your personal data within ${PORTABLEAPPNAME} will be temporarily copied to a local drive. Although this copy of your data will be deleted when you close ${PORTABLEAPPNAME}, it may be possible for someone else to access your data later."
LangString LauncherNoReadOnly ${LANG_ENGLISH} "${PORTABLEAPPNAME} can not run directly from a read-only location and will now close."

Var PROGRAMDIRECTORY
Var SETTINGSDIRECTORY
Var ADDITIONALPARAMETERS
Var EXECSTRING
Var PROGRAMEXECUTABLE
Var INIPATH
Var SECONDARYLAUNCH
Var DISABLESPLASHSCREEN
Var LASTDRIVE
Var CURRENTDRIVE
Var MISSINGFILEORPATH
Var ALTERNATENSISPATH

Section "Main"
	;=== Check if already running
	System::Call 'kernel32::CreateMutexA(i 0, i 0, t "${NAME}") i .r1 ?e'
	Pop $0
	StrCmp $0 0 CheckINI
		StrCpy $SECONDARYLAUNCH "true"

	CheckINI:
		;=== Find the INI file, if there is one
		IfFileExists "$EXEDIR\${NAME}.ini" "" CheckSubINI
			StrCpy "$INIPATH" "$EXEDIR"
			Goto ReadINI

	CheckSubINI:
		IfFileExists "$EXEDIR\${NAME}\${NAME}.ini" "" NoINI
			StrCpy "$INIPATH" "$EXEDIR\${NAME}"
			Goto ReadINI

	ReadINI:
		;=== Read the parameters from the INI file
		ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "${APPNAME}Directory"
		StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\$0"
		ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "SettingsDirectory"
		StrCpy "$SETTINGSDIRECTORY" "$EXEDIR\$0"
		ReadINIStr $0 "$INIPATH\${NAME}.ini" "${NAME}" "AlternateNSISPath"
		StrCpy "$ALTERNATENSISPATH" "$EXEDIR\$0"
	

		;=== Check that the above required parameters are present
		IfErrors NoINI
		ReadINIStr $ADDITIONALPARAMETERS "$INIPATH\${NAME}.ini" "${NAME}" "AdditionalParameters"
		ReadINIStr $DISABLESPLASHSCREEN "$INIPATH\${NAME}.ini" "${NAME}" "DisableSplashScreen"

	;CleanUpAnyErrors:
		;=== Any missing unrequired INI entries will be an empty string, ignore associated errors
		ClearErrors

		;=== Correct PROGRAMEXECUTABLE if blank
		StrCmp $PROGRAMEXECUTABLE "" "" EndINI
			StrCpy "$PROGRAMEXECUTABLE" "${DEFAULTEXE}"
			Goto EndINI

	NoINI:
		;=== No INI file, so we'll use the defaults
		StrCpy "$ADDITIONALPARAMETERS" ""
		StrCpy "$PROGRAMEXECUTABLE" "${DEFAULTEXE}"

		IfFileExists "$EXEDIR\App\${DEFAULTAPPDIR}\${DEFAULTEXE}" "" NoProgramEXE
			StrCpy "$PROGRAMDIRECTORY" "$EXEDIR\App\${DEFAULTAPPDIR}"
			StrCpy "$SETTINGSDIRECTORY" "$EXEDIR\Data\settings"
			GoTo EndINI

	EndINI:
		IfFileExists "$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" FoundProgramEXE

	NoProgramEXE:
		;=== Program executable not where expected
		StrCpy $MISSINGFILEORPATH $PROGRAMEXECUTABLE
		MessageBox MB_OK|MB_ICONEXCLAMATION `$(LauncherFileNotFound)`
		Abort
		
	FoundProgramEXE:
		;=== Check if running
		StrCmp $SECONDARYLAUNCH "true" GetPassedParameters
		FindProcDLL::FindProc "${DEFAULTEXE}"
		StrCmp $R0 "1" WarnAnotherInstance DisplaySplash

	WarnAnotherInstance:
		MessageBox MB_OK|MB_ICONINFORMATION `$(LauncherAlreadyRunning)`
		Abort
	
	DisplaySplash:
		StrCmp $DISABLESPLASHSCREEN "true" GetPassedParameters
			;=== Show the splash screen while processing registry entries
			InitPluginsDir
			File /oname=$PLUGINSDIR\splash.jpg "${NAME}.jpg"
			newadvsplash::show /NOUNLOAD 1000 100 0 -1 /L $PLUGINSDIR\splash.jpg
	
	GetPassedParameters:
		;=== Get any passed parameters
		${GetParameters} $0
		StrCmp "'$0'" "''" "" LaunchProgramParameters

		;=== No parameters
		StrCpy $EXECSTRING `"$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE"`
		Goto AdditionalParameters

	LaunchProgramParameters:
		StrCpy $EXECSTRING `"$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" $0`

	AdditionalParameters:
		StrCmp $ADDITIONALPARAMETERS "" SettingsDirectory

		;=== Additional Parameters
		StrCpy $EXECSTRING `$EXECSTRING $ADDITIONALPARAMETERS`
	
	SettingsDirectory:
		;=== Set the settings directory if we have a path
		IfFileExists "$SETTINGSDIRECTORY\*.*" CheckForSettings
			CreateDirectory $SETTINGSDIRECTORY
	
	CheckForSettings:
		StrCmp $SECONDARYLAUNCH "true" LaunchAndExit
		IfFileExists "$SETTINGSDIRECTORY\nisedit.ini" AdjustPaths
		Rename "$EXEDIR\App\DefaultData\nisedit.ini" "$PROGRAMDIRECTORY\nisedit.ini"
		Goto AdjustPaths
		
    AdjustPaths:
		ReadINIStr $LASTDRIVE "$SETTINGSDIRECTORY\${NAME}Settings.ini" "${NAME}Settings" "LastDrive"
		${GetRoot} $EXEDIR $CURRENTDRIVE
		StrCmp $LASTDRIVE $CURRENTDRIVE StoreCurrentDriveLetter
		IfFileExists "$SETTINGSDIRECTORY\nisedit.ini" UpdateSettings StoreCurrentDriveLetter
		
	UpdateSettings:
		${ReplaceInFile} "$SETTINGSDIRECTORY\nisedit.ini" '$LASTDRIVE\' '$CURRENTDRIVE\'
		Delete "$SETTINGSDIRECTORY\nisedit.ini.old"
		Goto StoreCurrentDriveLetter

	StoreCurrentDriveLetter:
		WriteINIStr "$SETTINGSDIRECTORY\${NAME}Settings.ini" "${NAME}Settings" "LastDrive" "$CURRENTDRIVE"
		Goto NSISDirectorySetup
		
	NSISDirectorySetup:
		Rename "$SETTINGSDIRECTORY\nisedit.ini" "$PROGRAMDIRECTORY\nisedit.ini"
		IfFileExists "$SETTINGSDIRECTORY\nsisconf.nsh" MoveNSISSettings CheckAlternateNSIS
		
    MoveNSISSettings:
        Rename "$SETTINGSDIRECTORY\nsisconf.nsh" "$EXEDIR\App\nsis\nsisconf.nsh"
		Goto Launch
		
    CheckAlternateNSIS:
		IfFileExists "$CURRENTDRIVE\PortableApps\NSISPortable\NSISPortable.exe" FixNSH UseINIAlternatePath
	
    FixNSH:
		Rename "$CURRENTDRIVE\PortableApps\NSISPortable\Data\settings\nsisconf.nsh" "$CURRENTDRIVE\PortableApps\NSISPortable\App\NSIS\nsisconf.nsh"
		Goto Launch
	
    UseINIAlternatePath:
		Rename "$CURRENTDRIVE\$ALTERNATENSISPATH\Data\settings\nsisconf.nsh" "$CURRENTDRIVE\$ALTERNATENSISPATH\NSISPortable\App\nsis\nsisconf.nsh"
		Goto Launch
	
    Launch:
		StrCmp $SECONDARYLAUNCH "true" LaunchAndExit
			;=== Backup the registry
			${registry::KeyExists} "HKEY_CURRENT_USER\Software\NSIS-BackupByNSISPortable" $R0
			${registry::KeyExists} "HKEY_CURRENT_USER\Software\NSIS" $R0
			${registry::MoveKey} "HKEY_CURRENT_USER\Software\NSIS" "HKEY_CURRENT_USER\Software\NSIS-BackupByNSISPortable" $R0
			Sleep 100
			NsExec::ExecToStack `"$WINDIR\system32\reg.exe" import "$SETTINGSDIRECTORY\NSIS_portable.reg"`
       	Exec $EXECSTRING
       	
	CheckRunning:
		Sleep 1000
		FindProcDLL::FindProc "${DEFAULTEXE}"                  
		StrCmp $R0 "1" CheckRunning

	;=== Put the settings file back
	Sleep 500
	Rename "$PROGRAMDIRECTORY\nisedit.ini" "$SETTINGSDIRECTORY\nisedit.ini"
        IfFileExists "$EXEDIR\App\nsis\*.*" "" RemoveNSISSettings
        Goto TheEnd
        
        RemoveNSISSettings:
        	${registry::SaveKey} "HKEY_CURRENT_USER\Software\NSIS" "$SETTINGSDIRECTORY\NSIS_portable.reg" "" $0
                ${registry::DeleteKey} "HKEY_CURRENT_USER\Software\NSIS" $R0
		Sleep 100
		${registry::KeyExists} "HKEY_CURRENT_USER\Software\NSIS-BackupByNSISPortable" $R0
		${registry::MoveKey} "HKEY_CURRENT_USER\Software\NSIS-BackupByNSISPortable" "HKEY_CURRENT_USER\Software\NSIS" $R0
		Sleep 100
		Goto TheEnd
	LaunchAndExit:
		Exec $EXECSTRING
		Goto TheEnd

	TheEnd:
		${registry::Unload}
		newadvsplash::stop /WAIT
SectionEnd

Now, I'll shut my stupid mouth and leave you alone.

I due hope this goes official.

Good gracious! There goes a kangaroo. I must have a practice with me boomerang- Now then, slowly back
If you throw that thing at me, I'll jump right on your head.
Innit marvellous? Got a land full of kangaroos and I had to pick that one.

thanks for all of your

thanks for all of your criticism, and re-writing. hopefully this should be all that needs to be done, but i cant do a compile a school, so i'll get the new version up at home.

Australia's Great Dividing Range : Dividing From What?
Patrick Patience is a key virtue.
behold, return of taneth111! (insert darth vader music here)

Okay. Again, I'm sorry about

Okay. Again, I'm sorry about screwing it up.

Good gracious! There goes a kangaroo. I must have a practice with me boomerang- Now then, slowly back
If you throw that thing at me, I'll jump right on your head.
Innit marvellous? Got a land full of kangaroos and I had to pick that one.

don't worry about it. i'm not

don't worry about it. i'm not too stressed. :P
EDIT: made fixes, and released a new version.
EDIT2: fixed a problem, new version. see main post.

Australia's Great Dividing Range : Dividing From What?
Patrick Patience is a key virtue.
behold, return of taneth111! (insert darth vader music here)

Testing

Just testing HM NIS Edit 2.03 Development Test 7 with NSIS Preconfigured.

  • Clicking File->Reopen shows your recently used files
  • The compiler path is C:\Documents and Settings\Taffin.UPSTAIRS-1\Desktop\HMNISEditPortable\App\NSIS\makensis.exe
  • The compiler help path is C:\Documents and Settings\Taffin.UPSTAIRS-1\Desktop\HMNISEditPortable\App\NSIS\NSIS.chm
  • The BrowserHome is set to http://forums.winamp.com/forumdisplay.php?s=&forumid=65
  • Maybe you should create a default nisedit.ini in the DefaultData folder, with adjusted paths inside.

They have the Internet on computers now? - Homer Simpson

Fixed, and uploading new

Fixed, and uploading new version now.

Australia's Great Dividing Range : Dividing From What?
Patrick Patience is a key virtue.
behold, return of taneth111! (insert darth vader music here)

http://portableapps.com/node/

http://portableapps.com/node/15916

I don't know if you've solved the inital setup location, but you could use something like the code there.

I'll post here just for fun:

SkipSplashScreen:
		;=== Check for data files
		IfFileExists "$PROGRAMDIRECTORY\config.conf" GetPassedParameters ;=== settings already in program directory
		IfFileExists "$SETTINGSDIRECTORY\config.conf" MoveSettings ;=== settings found in data directory
		
		;=== Copy the default settings files
		StrCmp $DEFAULTLOCATION "true" "" GetPassedParameters ;=== if not default location, user is on their own
		CreateDirectory "$SETTINGSDIRECTORY"
		CopyFiles /SILENT "$EXEDIR\App\DefaultData\settings\*.*" "$SETTINGSDIRECTORY\"
		;${StrReplace} $0 '\' '/' '$PROGRAMDIRECTORY\bin\ffmpeg.exe' ;you don't usually need these, unless the app is . . .  funny :D
		;${StrReplace} $1 '/' '\\' '$FFMPEGPATH'
		${ConfigWrite} "$SETTINGSDIRECTORY\config.conf" "ffmpegLibLocation=" "$FFMPEGPATH" $R0
		${GetRoot} $EXEDIR $0
		${DirState} "$0\Documents\Videos\" $VIDEOEXIST
		StrCmp $VIDEOEXIST "-1" SetAtRoot SetAtVideos
		       SetAtVideos:
                                   ${ConfigWrite} "$SETTINGSDIRECTORY\config.conf" "downloadDir=" '$0\\Documents\\Videos\\' $R0
                                   Goto MoveSettings
                        SetAtRoot:
                                  ${ConfigWrite} "$SETTINGSDIRECTORY\config.conf" "downloadDir=" '$0\\' $R0

Good gracious! There goes a kangaroo. I must have a practice with me boomerang- Now then, slowly back
If you throw that thing at me, I'll jump right on your head.
Innit marvellous? Got a land full of kangaroos and I had to pick that one.