phungus420
Deity
- Joined
- Mar 1, 2003
- Messages
- 6,296
I'm assuming this is like a print statement with Civ4. Is that correct? How do I set up an "echo"?
... Actually I dont think I ever have...hehe.You'll need to extract the files to a temporary folder, loop through all files and folders recursively (use RecFind writing to $UninstLog: FileWrite $UninstLog "...$\r$\n"
and then Rename each file to its new location.
Section "-un.StartMenu" SecUnStartMenu
;Delete Start Menu Shortcut
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
Delete "$SMPROGRAMS\$StartMenuFolder\${NAME}.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder"
SectionEnd
Section "-un.StartMenu" SecUnStartMenu
;Delete Start Menu Shortcut
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
FileWrite "C:\[B]A\DIRECTORY\THAT\ACTUALLY\EXISTS\[/B]Uninstall.log" "$SMPROGRAMS\$StartMenuFolder\${NAME}.lnk"
Delete "$SMPROGRAMS\$StartMenuFolder\${NAME}.lnk"
RMDir "$SMPROGRAMS\$StartMenuFolder"
SectionEnd
FileOpen $4 "$DESKTOP\SomeFile.txt" w
FileWrite $4 "hello"
FileClose $4
So basically When you install you choose where you want to install the start menu (I pick Firaxis games). This isn't getting written down. Ie, the variable $StartMenuFolder isn't returning anything. So it just pulls the parent directory. Any ideas?
and the Uninstall then just reverses everything in the log. Without having to quibble over doing it all manually. Section "Start Menu Shortcut" Section4
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${NAME}.lnk" "$INSTDIR1\Civ4BeyondSword.exe" "mod=\${MOD_LOC}" "$INSTDIR\Mods\${MOD_LOC}\${RAW_ICON}" 0
!insertmacro MUI_STARTMENU_WRITE_END
StrCpy $StartMenuFolder1 "$SMPROGRAMS\$StartMenuFolder"
!define START_MENU_FOLDER "$StartMenuFolder1"
SectionEnd
!define START_MENU_HACK "StartMenuHack.txt" ;Do not change this block
...
Var HackStartMenu
...
StrCpy $StartMenuFolder1 "$SMPROGRAMS\$StartMenuFolder"
FileOpen $4 "$INSTDIR\Mods\${MOD_LOC}\${START_MENU_HACK}" w
FileWrite $4 "$StartMenuFolder1"
FileClose $4
FileOpen $R4 "$INSTDIR\Mods\${MOD_LOC}\${START_MENU_HACK}" r
FileRead $R4 $HackStartMenu
FileClose $R4
Delete "$HackStartMenu\${NAME}.lnk"
RMDir "$HackStartMenu"


Section /o "${MOD_LOC}" Section1
SectionIn RO
SetOutPath "$INSTDIR1\Mods\${MOD_LOC}"
File /r "${MYCLSDIR}\*.*"
; write uninstall information to the registry
WriteRegStr ${FIRAXIS_REG_ROOT} "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MOD_LOC}" "DisplayName" "${NAME}"
WriteRegStr ${FIRAXIS_REG_ROOT} "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MOD_LOC}" "UninstallString" "$INSTDIR1\Mods\${MOD_LOC}\Uninstall.exe"
WriteRegStr ${FIRAXIS_REG_ROOT} "Software\Microsoft\Windows\CurrentVersion\Uninstall\${MOD_LOC}" "ModInstDir" "$INSTDIR1\Mods\"
WriteUninstaller "$INSTDIR1\Mods\${MOD_LOC}\Uninstall.exe"
SectionEnd
Section "Start Menu Shortcut" Section4
!insertmacro MUI_STARTMENU_WRITE_BEGIN Application
CreateDirectory "$SMPROGRAMS\$StartMenuFolder"
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\${NAME}.lnk" "$INSTDIR1\Civ4BeyondSword.exe" "mod=\${MOD_LOC}" "$INSTDIR\Mods\${MOD_LOC}\${RAW_ICON}" 0
CreateShortCut "$SMPROGRAMS\$StartMenuFolder\Uninstall.lnk" "$INSTDIR1\Mods\${MOD_LOC}\Uninstall.exe"
!insertmacro MUI_STARTMENU_WRITE_END
StrCpy $StartMenuFolder1 "$SMPROGRAMS\$StartMenuFolder"
WriteRegStr ${FIRAXIS_REG_ROOT} "Software\Microsoft\Windows\CurrentVersion\Uninstall\${SHORT_NAME}StartMenu" "StartMenuFolder" "$StartMenuFolder1"
SectionEnd
Function un.onInit
;get mod install path of from the registy
ReadRegStr $0 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MOD_LOC}" "ModInstDir"
ReadRegStr $R1 HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${SHORT_NAME}StartMenu" "StartMenuFolder"
FunctionEnd
Section "-un.StartMenu" SecUnStartMenu
;Delete Start Menu Shortcut
Delete "$R1\${NAME}.lnk"
Delete "$R1\Uninstall.lnk"
RMDir /r "$R1"
;Delete Files
SectionEnd
Section "un.Core" SecUnCore
RMDir /r "$0\${MOD_LOC}\*.*"
;Remove the installation directory
RMDir "$0\${MOD_LOC}"
;Delete Desktop Shortcut
Delete "$DESKTOP\${NAME}.lnk"
;Delete Quicklaunch Shortcut
Delete "$QUICKLAUNCH\${SHORT_NAME}.lnk"
SectionEnd
Section "-un.Registry" SecUnRegistry
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${MOD_LOC}"
DeleteRegKey HKEY_LOCAL_MACHINE "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${SHORT_NAME}StartMenu"
SectionEnd
