;Copyright 2007 Ryan McCue ;Website: http://PortableApps.com/ ;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 "Profile Copier" OutFile "ProfileCopier.exe" Caption "Profile Copier" ;=== Include !include "MUI.nsh" !include "nsDialogs.nsh" !include "FileFunc.nsh" !insertmacro GetParent ;=== Program Icon Icon "..\..\App\AppInfo\appicon.ico" ;=== Icon & Stye === !define MUI_ICON "..\..\App\AppInfo\appicon.ico" BrandingText "PortableApps.com - Your Digital Life, Anywhere™" ;=== Pages !define MUI_ABORTWARNING !insertmacro MUI_PAGE_WELCOME Page custom SelectApplication SelectApplicationFinish Page custom SelectPaths !insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_FINISH !insertmacro MUI_LANGUAGE "English" ;=== Variables Var PROFILELOCATION Var LOCATIONRELATIVE Var APPPATH Var SELECTEDAPP ;=== Dialogs HWNDs Var SELECTAPPDIALOG Var SELECTAPPTEXT Function SelectApplication StrCpy $SELECTEDAPP "FirefoxPortable" nsDialogs::Create /NOUNLOAD 1018 Pop $SELECTAPPDIALOG StrCmp "$SELECTAPPDIALOG" "error" Error ${NSD_CreateLabel} 0 0 100% 12u "Select application" ${NSD_CreateRadioButton} 0 12u 100% 12u "FirefoxPortable" Pop $SELECTAPPTEXT nsDialogs::Show MessageBox MB_OK "$APPPATH" Goto End Error: Abort End: FunctionEnd Function SelectApplicationFinish ${NSD_GetText} $SELECTAPPTEXT $0 MessageBox MB_OK "$0" FunctionEnd Function SelectPaths /*nsDialogs::Create /NOUNLOAD 1018 ${NSD_CreateLabel} 0 0 100% 12u "Select path to $SELECTEDAPP (i.e. E:\PortableApps\$SELECTEDAPP)" ${NSD_CreateDirRequest} 0 12u 85% 12u "E:\PortableApps\$SELECTEDAPP" ${NSD_CreateBrowseButton} 85% 12u 15% 12u "Browse..." nsDialogs::Show*/ FunctionEnd Section ;SetDetailsPrint none DetailPrint "Finding profile location..." ReadINIStr $PROFILELOCATION "$APPDATA\Mozilla\Firefox\profiles.ini" "Profile0" "Path" ReadINIStr $LOCATIONRELATIVE "$APPDATA\Mozilla\Firefox\profiles.ini" "Profile0" "IsRelative" StrCmp "$LOCATIONRELATIVE" "0" AbsoluteLocation StrCpy $PROFILELOCATION "$APPDATA\Mozilla\Firefox\$PROFILELOCATION" AbsoluteLocation: DetailPrint "Looking for portable profile..." ${GetParent} "$EXEDIR" $R0 IfFileExists "$R0\$SELECTEDAPP\*.*" Copy nsDialogs::SelectFolderDialog "Select path to $SELECTEDAPP (i.e. E:\PortableApps\$SELECTEDAPP)" "E:\PortableApps\$SELECTEDAPP" Pop $APPPATH StrCmp "$APPPATH" "error" Error IfFileExists "$APPPATH\*.*" "" Error Copy: DetailPrint "Copying profile..." CopyFiles "$PROFILELOCATION" "$R0\$SELECTEDAPP\Data\profile" DetailPrint "Done!" Sleep 1000 Goto End Error: MessageBox MB_OK|MB_ICONEXCLAMATION "$SELECTEDAPP was not found." End: SectionEnd