Okay, I finished coding IntelliLaunch.
So, here's the deal- I'm posting this in code form for right now. You should use the standard portableapps format, in the following setup:
*App
---*AppName
---*AppInfo
------appinfo.ico
------appinfo.ini
*Data
---configuration.ini
---*Registry
---*SetOutPathDirectory
---*AppData
---*Config
*Source
---*Other
------Intelliluanch.nsi
------StrRep.nsh
------ReplaceinFile.nsh
------GetParameters.nsh
------IntellLaunch.jpg
At some point, I will make a test package available to certain testers, preferably those who are willing to connect to IRC, as IMHO, it is the best way for support to occur.
You will need the following INI file:
#IF YOU DON"T USE A VARIABLE LEAVE IT AS FALSE!!!!!!!!!!!!!!!!!!!!!!!!!!!! [Application] ExeName= ExecutableDirectory= CheckRunning=True #Normally, you should leave "CheckRunning" set to true [Settings] HKCU=False HKLM=False Config_File=False Manipulate_Set_Out_Path=False #Utilize "True" or "False" for each settings storage place. [RegistryBranch] HKCU_Branch=False HKLM_Branch=False #Do from HKLM\Software, ie. "Software\AppName" #DO NOT INCLUDE THE FINAL SLASH!!!!!!!!!!!!!!!!!!!!!! [Config_File_1] #For Location_# Specify the location of the file from the Luancher's directory #For instance, for a file in App\Appname\AppConfig, set Location_#=App\Appname\AppConfig Location_1=False #For Config_File_#, specify the name of the file. Config_File_1=False [Config_File_2] Location_2=False Config_File_2=False [Config_File_3] Location_3=False Config_File_3=False [Config_File_4] Location_4=False Config_File_4=False [Config_File_5] Location_5=False Config_File_5=False [Config_File_6] Location_6=False Config_File_6=False [Update] Update_Locations=False #Set to "True" if you want the files to adjust the path for you Update_Location_File_1=False Update_Location_File_2=False Update_Location_File_3=False [Variables] Path=False #Set Path from the AppNamePortable Directory #Seperate indivual paths with a ";" App_Data_Redirect=False #AppData redirect has been known not to work
If you do not use a setting, leave it as False!! I cannot stress this enough. If you don't do this, IntelliLaunch will act like RetardLaunch, and not due what you want it to 
IntelliLaunchCode:
;Copyright(C) OliverKrystal 2008
;Copyright (C) 2004-2008 John T. Haller
;Website: https://portableapps.com/node/16268
;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.
;=== Program Details
Name "IntelliLaunch"
OutFile "..\..\IntelliLaunch.exe"
Caption "IntelliLaunch | PortableApps.com"
VIProductVersion "0.0.1.0"
VIAddVersionKey Comments "A luancher that use a configuration INI to allow a user to create a custom wrapper"
VIAddVersionKey CompanyName "PortableApps.com"
VIAddVersionKey LegalCopyright "PortableApps.com and Contributers"
VIAddVersionKey FileDescription ""
VIAddVersionKey FileVersion "0.0.1.0"
VIAddVersionKey ProductVersion "0.0.1.0"
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 ;no icon for the script
SilentInstall Silent ;NSIS is actually an installer language. This keeps the script from popping open a window
AutoCloseWindow True ;in case it shows up anyway
RequestExecutionLevel user
;=== Include
;!include "GetParameters.nsh" ;these three !includes make the macro able to work
!include "ReplaceInFile.nsh"
!include "StrRep.nsh"
!include "TextFunc.nsh"
!include "MUI.nsh" ;for multi language support
!include "Registry.nsh"
;!insertmacro cfgigWrite ;this is the part that fixes the cfg file so it allows points to the write place. Commenting out prevents the script from compiling, and thus, running.
!insertmacro GetRoot
;!insertmacro UserInfo
;=== Program Icon
Icon "..\..\App\AppInfo\appicon.ico" ;defines the icon for the script
;=== Icon & Stye ===
!define MUI_ICON "..\..\App\AppInfo\appicon.ico"
;=== Languages
!insertmacro MUI_LANGUAGE "English"
LangString LauncherFileNotFound ${LANG_ENGLISH} "$PROGRAMEXECUTABLE 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 $PROGRAMEXECUTABLE is already running. Please close other instances of $PROGRAMEXECUTABLE before launching IntelliLaunch."
LangString LauncherAskCopyLocal ${LANG_ENGLISH} "$PROGRAMEXECUTABLE 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} "$PROGRAMEXECUTABLE can not run directly from a read-only location and will now close."
LangString LauncherNotAdmin ${LANG_ENGLISH} "$PROGRAMEXECUTABLE needs Administrative rights to be able to run and this login does not have them."
; These are all the INI Values needed to load up and start this thing :(
Var CONFIGINI
Var PROGRAMEXECUTABLE
Var PROGRAMDIRECTORY
Var HKCUUSE
Var HKLMUSE
Var CONFIGFILELOCATIONUSE
Var HKCUBRANCH
Var HKLMBRANCH
Var CONFIGFILELOCATION1
Var CONFIGFILELOCATION2
Var CONFIGFILELOCATION3
Var CONFIGFILELOCATION4
Var CONFIGFILELOCATION5
Var CONFIGFILELOCATION6
Var CONFIGFILE1
Var CONFIGFILE2
Var CONFIGFILE3
Var CONFIGFILE4
Var CONFIGFILE5
Var CONFIGFILE6
Var UPDATELOCATION
Var UPDATEFILE1
Var UPDATEFILE2
Var UPDATEFILE3
Var PATHADDITION
Var APPDATAREDIRECT
; Settings Directory values
Var CONFIGDIRECTORY
Var SETOUTPATHDIRECTORY
Var REGISTRYDIRECTORY
Section "Main"
IfFileExists "$EXEDIR\Data\configuration.ini" DisplaySplash
;=== Configuration INI not where expected
MessageBox MB_OK|MB_ICONEXCLAMATION `IntelliLuanch's Configuration INI was not found. Please insure that you have a placed a configured Configuration.ini in the Data folder`
Abort
DisplaySplash:
;=== Show the splash screen before processing the files
InitPluginsDir
File /oname=$PLUGINSDIR\splash.jpg "IntelliLuanch.jpg"
newadvsplash::show /NOUNLOAD 1000 0 0 -1 /L $PLUGINSDIR\splash.jpg
;Let's load our values into this thing
StrCpy $CONFIGINI "$EXEDIR\Data\configuration.ini"
;Check right off the bat if we need Admin Rights or not. We'll check the INI.
ReadINIStr $HKCUUSE "$CONFIGINI" "Settings" "HKCU"
ReadINIStr $HKLMUSE "$CONFIGINI" "Settings" "HKLM"
ReadINIStr $CONFIGFILELOCATIONUSE "$CONFIGINI" "Settings" "Config_File"
;=== Any missing unrequired INI entries will be an empty string, ignore associated errors
ClearErrors
;Let's check write now for Registry Keys in the HKLM location. If we find them there, check if we are admins on the computer- if fail, so say and abort load\run\et all; else, we can keep loading
StrCmp $HKLMUSE "False" "ContinueLoading"
UserInfo::GetAccountType
Pop $0
StrCmp $0 "Admin" ContinueLoading
MessageBox MB_OK|MB_ICONINFORMATION `$(LauncherNotAdmin)`
Abort
ContinueLoading:
;So we've checked to see if we need Admin Rights. We either didn't, and we can keep loading, or we did and we have the rights
;Load Application Information, setup up the Program Directory and Program Executable
ReadINIStr $PROGRAMEXECUTABLE "$CONFIGINI" "Application" "ExeName"
ReadINIStr $PROGRAMDIRECTORY "$CONFIGINI" "Application" "ExecutableDirectory"
;=== Any missing unrequired INI entries will be an empty string, ignore associated errors
ClearErrors
;Check to make sure that the exe is present before we take the time to do anything more
IfFileExists "$PROGRAMDIRECTORY\$PROGRAMEXECUTABLE" CheckRunning
;=== Program executable not where expected
MessageBox MB_OK|MB_ICONEXCLAMATION `$PROGRAMEXECUTABLE was not found. Please check your configuration`
Abort
CheckRunning:
;Check to make sure that the user hasn't changed the defualt Check running behavior in the INI- And for now we're gonna leave the user type floating in $0
ReadINIStr $1 "$CONFIGINI" "Application" "ExecutableDirectory"
StrCmp $1 "False" ConfigFileCheck
FindProcDLL::FindProc "$PROGRAMEXECUTABLE"
StrCmp $R0 "1" "" ConfigFileCheck
MessageBox MB_OK|MB_ICONINFORMATION `$(LauncherAlreadyRunning)`
Abort
ConfigFileCheck:
;Check to see if there's any variable loading we can skip- Start with the config files
StrCmp $CONFIGFILELOCATIONUSE "False" CheckRegistryUse ;If false, skip loading these variables and go to loading the registry
;Setup the defualt congif locations
StrCpy $CONFIGDIRECTORY "$EXEDIR\Data\Config"
;Read the Names of the Configuration Files that the program uses
ReadINIStr $CONFIGFILELOCATION1 "$CONFIGINI" "Configuration_Data" "Location_1"
ReadINIStr $CONFIGFILE1 "$CONFIGINI" "Configuration_Data" "Config_File_1"
ReadINIStr $CONFIGFILELOCATION2 "$CONFIGINI" "Configuration_Data" "Location_2"
ReadINIStr $CONFIGFILE2 "$CONFIGINI" "Configuration_Data" "Config_File_2"
ReadINIStr $CONFIGFILELOCATION3 "$CONFIGINI" "Configuration_Data" "Location_3"
ReadINIStr $CONFIGFILE3 "$CONFIGINI" "Configuration_Data" "Config_File_3"
ReadINIStr $CONFIGFILELOCATION4 "$CONFIGINI" "Configuration_Data" "Location_4"
ReadINIStr $CONFIGFILE4 "$CONFIGINI" "Configuration_Data" "Config_File_4"
ReadINIStr $CONFIGFILELOCATION5 "$CONFIGINI" "Configuration_Data" "Location_5"
ReadINIStr $CONFIGFILE5 "$CONFIGINI" "Configuration_Data" "Config_File_5"
ReadINIStr $CONFIGFILELOCATION6 "$CONFIGINI" "Configuration_Data" "Location_6"
ReadINIStr $CONFIGFILE6 "$CONFIGINI" "Configuration_Data" "Config_File_6"
;=== Any missing unrequired INI entries will be an empty string, ignore associated errors
ClearErrors
;Now, check to see if any of those files need to have their locations updated.
ReadINIStr $UPDATELOCATION "$CONFIGINI" "Update" "Update_Locations"
StrCmp $UPDATELOCATION "False" ProcessFiles ;If false, go to moving the files around. Else, deal with updating
;Read the Update Locations
ReadINIStr $UPDATEFILE1 "$CONFIGINI" "Update" "Update_Location_File_1"
ReadINIStr $UPDATEFILE2 "$CONFIGINI" "Update" "Update_Location_File_2"
ReadINIStr $UPDATEFILE3 "$CONFIGINI" "Update" "Update_Location_File_3"
;=== Any missing unrequired INI entries will be an empty string, ignore associated errors
ClearErrors
;=== Update files for new location
;We're updating everything now, because once we move them, we'll hve no freaking clue and it'll be harder to handle updating them; so let's do it now
${GetRoot} $EXEDIR $0
ReadINIStr $1 "$EXEDIR\Data\IntellaLaunchSettings.ini" "IntellaLaunchSettings" "LastDriveLetter"
StrCmp $1 "" StoreCurrentDriveLetter
StrCmp $1 $0 Launch
${ReplaceInFile} "$CONFIGDIRECTORY\$UPDATEFILE1" "$1\" "$0\"
Delete "$CONFIGDIRECTORY\$UPDATEFILE1.old"
;Check to see if now is the time to stop- remeber, we wouldn't be here if $UPDATELOCATION was false :D
StrCmp $UPDATEFILE2 "False" StoreCurrentDriveLetter
${ReplaceInFile} "$CONFIGDIRECTORY\$UPDATEFILE2" "$1\" "$0\"
Delete "$CONFIGDIRECTORY\$UPDATEFILE2.old"
;Check to see if now is the time to stop- remeber, we wouldn't be here if $UPDATELOCATION was false :D
StrCmp $UPDATEFILE3 "False" StoreCurrentDriveLetter
${ReplaceInFile} "$CONFIGDIRECTORY\$UPDATEFILE3" "$1\" "$0\"
Delete "$CONFIGDIRECTORY\$UPDATEFILE3.old"
;Heirarchy makes sure we store the drive letter, next line
StoreCurrentDriveLetter:
WriteINIStr "$EXEDIR\Data\IntellaLaunchSettings.ini" "IntellaLaunchSettings" "LastDriveLetter" "$0"
;Let's process, the files and move them about, k?
ProcessFiles:
Rename "$CONFIGDIRECTORY\$CONFIGFILE1" "$CONFIGFILELOCATION1\$CONFIGFILE1"
StrCmp $CONFIGFILE2 "False" CheckRegistryUse
Rename "$CONFIGDIRECTORY\$CONFIGFILE2" "$CONFIGFILELOCATION2\$CONFIGFILE2"
StrCmp $CONFIGFILE3 "False" CheckRegistryUse
Rename "$CONFIGDIRECTORY\$CONFIGFILE3" "$CONFIGFILELOCATION3\$CONFIGFILE3"
StrCmp $CONFIGFILE4 "False" CheckRegistryUse
Rename "$CONFIGDIRECTORY\$CONFIGFILE4" "$CONFIGFILELOCATION4\$CONFIGFILE4"
StrCmp $CONFIGFILE5 "False" CheckRegistryUse
Rename "$CONFIGDIRECTORY\$CONFIGFILE5" "$CONFIGFILELOCATION1\$CONFIGFILE5"
StrCmp $CONFIGFILE6 "False" CheckRegistryUse
Rename "$CONFIGDIRECTORY\$CONFIGFILE6" "$CONFIGFILELOCATION1\$CONFIGFILE6"
CheckRegistryUse:
StrCmp $HKCUUSE "False" SetUpEnviroment
StrCmp $HKLMUSE "False" SetUpEnviroment
;Here's where our registry manipulations come into play
ReadINIStr $HKCUBRANCH "$CONFIGINI" "RegistryBranch" "HKCU_Branch"
ReadINIStr $HKLMBRANCH "$CONFIGINI" "RegistryBranch" "HKLM_Branch"
StrCpy $REGISTRYDIRECTORY "$EXEDIR\Data\Registry"
;=== Any missing unrequired INI entries will be an empty string, ignore associated errors
ClearErrors
;Begin Playing with the registry
;================================================ >HLKM SECTIONHKCU SECTIONHLKM SECTION CLEANUPHKCU SECTION CLEANUP
If you submit a bug report:
- Include, in the pre tags, your configuration.ini
- The name of the app, and where you got it from and where is saves stuff
- A thorough description of the problem, please track it down as much as possible. I'm not expecting you to hack at my code, just tell me what's failing
- The bug report should be posted here, in this blog.
If you do not provide the needed information, I can not help you.
Also, if it fails with the app redirect, I can't really help you. That's something that's app specific, unless it is my implementation of it that is failing.- OliverK's blog
- Log in or register to post comments
Comments
Looks cool. :D
Looks cool.
Maybe I try it with one or two apps I wanna try 
I just started binary testing
I just started binary testing today, and I had quite a few bugs
Anyway, here's a updated version that deals with the registry successfully:
http://oliverkrystal.pastebin.com/f39f4a242
Note that any config files will fail