Karavirs
8th March 2006 01:41 UTC
User dialog / input from ini file
I've run into writers block and can't for the life of me figure out how to do this.
All I want to do is:
1)Show the user the various versions available in the attached ini file.
2)Get their selection
3)Download their selection (I know how to do this)
4)Execute the new installer (I know how to do this)
ini looks like this
[Auctioneer]
ver=3.2.0.555
[Unstable]
ver=3.2.0.0734
url=http://auctioneeraddon.com/dl/AuctioneerComplete/auctioneerpack-3.2.0.0734.exe
[Alpha]
ver=3.2.0.0729
url=http://auctioneeraddon.com/dl/AuctioneerComplete/auctioneerpack-3.2.0.0729.exe
[Beta]
ver=3.2.0.671
url=http://auctioneeraddon.com/dl/AuctioneerComplete/auctioneerpack-3.2.0.0671.exe
[Release]
ver=3.2.0.0620
url=http://auctioneeraddon.com/dl/AuctioneerComplete/auctioneerpack-3.2.0.0620.exe
dandaman32
8th March 2006 02:11 UTC
Page custom UpgradeMe GetReturn
Function UpgadeMe
;save the current ini file in case download fails
Rename $INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini $INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini.old
;get the latest auctioneer.ini file
inetc::get /SILENT "" "http://auctioneeraddon.com/dl/AuctioneerComplete/Auctineer.ini" "$INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini" /END
pop $R0
StrCmp $R0 "OK" gotnewver
;download failed so retreive old file
Rename $INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini.old $INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini
gotnewver:
; At this point, we have a file containing version info.
WriteINIStr "$PLUGINSDIR\upgrade.ini" "Settings" "NumFields" 6 ; Change this to the number of fields
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 1" Type Label
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 1" Top 0
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 1" Left 0
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 1" Right -1
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 1" Bottom 10
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 1" Text "Which version of $(^Name) do you want to use?"
ReadINIStr $0 $INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini "Auctioneer" ver
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 2" Type RadioButton
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 2" Top 12
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 2" Left 6
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 2" Right -1
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 2" Bottom 22
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 2" Text "The current version ($0)"
ReadINIStr $0 $INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini "Unstable" ver
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 3" Type RadioButton
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 3" Top 24
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 3" Left 6
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 3" Right -1
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 3" Bottom 34
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 3" Text "Unstable release ($0)"
ReadINIStr $0 $INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini "Alpha" ver
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 4" Type RadioButton
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 4" Top 36
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 4" Left 6
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 4" Right -1
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 4" Bottom 46
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 4" Text "Alpha release ($0)"
ReadINIStr $0 $INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini "Beta" ver
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 5" Type RadioButton
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 5" Top 48
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 5" Left 6
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 5" Right -1
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 5" Bottom 58
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 5" Text "Beta release ($0)"
ReadINIStr $0 $INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini "Release" ver
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 6" Type RadioButton
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 6" Top 60
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 6" Left 6
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 6" Right -1
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 6" Bottom 70
WriteINIStr $PLUGINSDIR\upgrade.ini "Field 6" Text "Stable release ($0)"
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\upgrade.ini"
Pop $1
GetDlgItem $0 $1 1200
CreateFont $2 "Tahoma" 8 700
SendMessage $0 0x30 $2 0 ; just for a visual tweak ;)
InstallOptions::show
FunctionEnd
Function GetReturn ; called right after the user clicks "next" on the custom page
ReadINIStr $0 $PLUGINSDIR\Upgrade.ini "Field 2" State
StrCmp $0 1 Current
ReadINIStr $0 $PLUGINSDIR\Upgrade.ini "Field 3" State
StrCmp $0 1 Unstable
ReadINIStr $0 $PLUGINSDIR\Upgrade.ini "Field 4" State
StrCmp $0 1 Alpha
ReadINIStr $0 $PLUGINSDIR\Upgrade.ini "Field 5" State
StrCmp $0 1 Beta
ReadINIStr $0 $PLUGINSDIR\Upgrade.ini "Field 6" State
StrCmp $0 1 Latest
; User did not select an option
MessageBox MB_OK|MB_ICONEXCLAMATION "Please select an option."
Abort ; Returns to the page
Unstable:
ReadINIStr $0 $INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini Unstable url
Goto get
Alpha:
ReadINIStr $0 $INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini Alpha url
Goto get
Beta:
ReadINIStr $0 $INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini Beta url
Goto get
Release:
ReadINIStr $0 $INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini Release url
get:
; At this point, $0 contains the URL of the file to download.
; You can use your downloader plugin to get the file
Current:
FunctionEnd
:D
NOTE: You may have meant:
inetc::get /SILENT "" "http://auctioneeraddon.com/dl/AuctioneerComplete/Auctioneer.ini" "$INSTDIR\Interface\AddOns\Auctioneer\Auctioneer.ini" /END
in the line at the top?
-dandaman32