Thread Tools Display Modes
09-10-07, 05:36 PM   #1
Ainu
A Murloc Raider
AddOn Compiler - Click to view compilations
Join Date: Sep 2007
Posts: 4
Unified UI Installer/Uninstaller

Holy grail, is it? First, let me describe this project:

An installer that will take the /Fonts, /Interface, and /WTF of your current UI and wrap them into a backup drive for later retrieval. It lists current compatible mod packs and then installs the selected one onto your WoW install, configuring it for all accounts, servers, and characters that were listed in your newly backed up files. Once done, it then copies over all your macros to the new character folders so all your toons have their old macros.

How does this work? Make a /root folder. This signifies the WoW directory. Copy in the ainu-installer.au3 and ainu-uninstaller.au3 script, and the directories as listed in the below image:



Notice the ACCTNAME and Charname folders? These are the folders named after your account and toon moved out to the /AinuUI folder (per this example) and renamed. All server names are unnecessary and can be deleted. The Charname you use is the one with the settings for your UI that will be installed on all characters via the installer.

What now? One last step: in the picture the folder named AinuUI is the name of YOUR UI, lets say "AwesomeUIPack" ... so in your /root directory (the one below /AwesomeUIPack) create a text file called AwesomeUIPack.aif ... this flags the setup program that your UI exists. In the future, I plan to have this file open in notepad via the script with your customization instructions post-install.

You're done! Your UI is now compatible with the setup system.

Here is an example UI using this structure: http://downloads.curse.com/details/9069/ ... v0.4 of the UI is uploading as I post containing this structure and updated installer utility.

- HOW IT WORKS -

This is a script built for AutoIT3 which can be found at http://www.autoitscript.com/autoit3/ . It can be compiled and decompiled through this scripting system (included are compiled versions for the lazy) though I really REALLY don't want people EVER EVER EVER using .exe files they download off the net. The code for the installer is in the next post.
  Reply With Quote
09-10-07, 05:38 PM   #2
Ainu
A Murloc Raider
AddOn Compiler - Click to view compilations
Join Date: Sep 2007
Posts: 4
The code is kind of fugly of yet, but I will polish it if anyone has any interest in this project.

Code:
; ainu-installer.au3
$root = InputBox("Gathering Information", "Enter the root directory for World of Warcraft:", "C:\World of Warcraft", "", 300, 150);

$numui = 0;
$pos = 0;
Dim $uiname[100];

$search = FileFindFirstFile($root & "\*.*");
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern");
    Exit;
EndIf
While 1
    $file = FileFindNextFile($search) ;
    If @error Then ExitLoop;
    ;MsgBox(4096, "File:", $file)
    If StringInStr($file, ".aif") > 0 Then
	
	$uiname[$numui] = StringLeft($file, StringInStr($file, ".aif") - 1);
	$numui += 1;
    EndIf
WEnd
FileClose($search);

If $numui = 0 Then
	MsgBox(0, "Error", "No UI installs found!");
	Exit;
EndIf

If $numui > 0 Then
	$msgtxt = "UI ID files found:";

	For $pos = 0 to $numui Step 1
		If $pos > 0 AND $pos < $numui Then
			$msgtxt &= ",";
		EndIf

		$msgtxt = $msgtxt & " " & $uiname[$pos];
	Next

	$msgtxt = $msgtxt & @LF & @LF & "Please enter your UI selection:";
	$ui = InputBox("Please Select UI", $msgtxt, $uiname[0], "", 300, 500);
EndIf

$dirmatch = 0;

$search = FileFindFirstFile($root & "\*.*");
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern");
    Exit;
EndIf
While 1
    $file = FileFindNextFile($search) ;
    If @error Then ExitLoop;
    ;MsgBox(4096, "File:", $file)
    If StringCompare($file, $ui, 0) == 0 Then
	$dirmatch = 1;
	ExitLoop;
    EndIf
WEnd
FileClose($search);

If $dirmatch == 0 Then
	MsgBox(0, "Error", "Install Directory Missing!");
	Exit;
EndIf

$solobackupname = InputBox("Gathering Information", "Enter the name of the backup directory you would like to create (ex: Backup):", "Backup", "", 300, 150);

$sv = "SavedVariables";
$backupname = $root & "\" & $solobackupname;

$dirmatch = 0;

$search = FileFindFirstFile($root & "\*.*");
If $search = -1 Then
    MsgBox(0, "Error", "No files/directories matched the search pattern");
    Exit;
EndIf
While 1
    $file = FileFindNextFile($search) ;
    If @error Then ExitLoop;
    ;MsgBox(4096, "File:", $file)
    If StringCompare($file, $solobackupname, 0) == 0 Then
	$dirmatch = 1;
	ExitLoop;
    EndIf
WEnd
FileClose($search);

If $dirmatch == 1 Then
	MsgBox(0, "Error", "Backup directory exists!");
	Exit;
EndIf

MsgBox(4096, "DISCLAIMER!", "Hit OK to start moving files, exit script NOW to avoid backing them up!!!  Once you hit okay this will possibly take a while, I'll let you know when we're done.  Crashing this prematurely or doing file changes or whatnot during this install can cause unrepairable damage to your WoW installation.  Seriously, if you have second thoughts or want to do anything other than let this install, please right click on the macro button in your system tray and hit exit before hitting okay on this screen.");

; Backing up old information.

DirCreate($backupname);

$statustxt = "Backing up files ... " & @LF & $root & "\WTF -> " & $backupname & "\WTF";
SplashTextOn("Installing ... ", $statustxt, 500, 100, -1, -1, 4, "", 8)
DirMove($root & "\WTF", $backupname & "\WTF");

$statustxt = "Backing up files ... " & @LF & $root & "\Interface -> " & $backupname & "\Interface";
ControlSetText("Installing ... ", "", "Static1", $statustxt);
DirMove($root & "\Interface", $backupname & "\Interface");

$statustxt = "Backing up files ... " & @LF & $root & "\Fonts -> " & $backupname & "\Fonts";
ControlSetText("Installing ... ", "", "Static1", $statustxt);
DirMove($root & "\Fonts", $backupname & "\Fonts");

; Installing UI

$statustxt = "Installing new files ... " & @LF & $root & "\" & $ui & "\WTF -> " & $root & "\WTF";
ControlSetText("Installing ... ", "", "Static1", $statustxt);
DirCopy($root & "\" & $ui & "\WTF", $root & "\WTF");

$statustxt = "Installing new files ... " & @LF & $root & "\" & $ui & "\Fonts -> " & $root & "\Fonts";
ControlSetText("Installing ... ", "", "Static1", $statustxt);
DirCopy($root & "\" & $ui & "\Fonts", $root & "\Fonts");

$statustxt = "Installing new files ... " & @LF & $root & "\" & $ui & "\Interface -> " & $root & "\Interface";
ControlSetText("Installing ... ", "", "Static1", $statustxt);
DirCopy($root & "\" & $ui & "\Interface", $root & "\Interface");

; Hacking your account and sharding your purples
$statustxt = "";
ControlSetText("Installing ... ", "", "Static1", $statustxt);

$search = FileFindFirstFile($backupname & "\WTF\Account\*.*");
If $search = -1 Then
    MsgBox(0, "Error", "You had no accounts active!  Exiting install with errors ...");
    Exit;
EndIf
While 1

	$file = FileFindNextFile($search) ;
	If @error Then ExitLoop;

	$statustxt = "Progress ... " & @LF & "Installing to account:  " & $file & @LF;
	ControlSetText("Installing ... ", "", "Static1", $statustxt);

	DirCopy($root & "\" & $ui & "\ACCTNAME", $root & "\WTF\Account\ACCTNAME", 1);
	DirMove($root & "\WTF\Account\ACCTNAME", $root & "\WTF\Account\" & $file);

	; Server file copy/creation
	$server = FileFindFirstFile($backupname & "\WTF\Account\" & $file & "\*.*");
	If $server = -1 Then
		MsgBox(0, "Error", "You had no accounts active!  Exiting install with errors ...");
		Exit;
	EndIf

	While 1
		$file2 = FileFindNextFile($server) ;
		If @error Then ExitLoop;
		If (StringCompare($file2, $sv, 0) <> 0 AND StringInStr($file2, ".") == 0) Then 
		;MsgBox(4096, "Server:", $root & "\WTF\Account\" & $file & "\" & $file2)

				DirCreate($root & "\WTF\Account\" & $file & "\" & $file2);

				; Character folder copy/creation
				$toonname = FileFindFirstFile($backupname & "\WTF\Account\" & $file & "\" & $file2 & "\*.*");
				If $toonname = -1 Then
					MsgBox(0, "Error", "You had no characters active!  Exiting install with errors ...");
				Exit;
				EndIf


				While 1
					$file3 = FileFindNextFile($toonname) ;
					If @error Then ExitLoop;

					$statustxt = "Progress ... " & @LF & "Installing to account:  " & $file & @LF & "Character - " & $file3;
					ControlSetText("Installing ... ", "", "Static1", $statustxt);

					DirCopy($root & "\" & $ui & "\Charname", $root & "\WTF\Account\" & $file & "\" & $file2 & "\" & $file3, 1);
					FileCopy($backupname & "\WTF\Account\" & $file & "\" & $file2 & "\" & $file3 & "\macros-*", $root & "\WTF\Account\" & $file & "\" & $file2 & "\" & $file3 & "\", 1);
					;MsgBox(4096, "Toon:", $root & "\WTF\Account\" & $file & "\" & $file2 & "\" & $file3)
				Wend
				FileClose($toonname);
		EndIf

	Wend
	FileClose($server);
WEnd
FileClose($search);

MsgBox(4096, "Install Complete!", "Install Complete!");

Last edited by Ainu : 09-10-07 at 05:41 PM.
  Reply With Quote
09-10-07, 05:40 PM   #3
Ainu
A Murloc Raider
AddOn Compiler - Click to view compilations
Join Date: Sep 2007
Posts: 4
As you can see, the uninstaller is much simpler, just removing your new files and putting your old ones back.

Code:
; ainu-uninstaller.au3
$root = InputBox("Gathering Uninstall Information", "Enter the root directory for World of Warcraft:", "C:\World of Warcraft", "", 300, 150);

$solobackupname = InputBox("Gathering Uninstall Information", "Enter the name of the backup directory you would like to restore (ex: Backup):", "Backup", "", 300, 150);

$backupname = $root & "\" & $solobackupname;

DirRemove($root & "/WTF", 1);
DirRemove($root & "/Fonts", 1);
DirRemove($root & "/Interface", 1);

DirMove($backupname & "/WTF", $root & "/WTF");
DirMove($backupname & "/Fonts", $root & "/Fonts");
DirMove($backupname & "/Interface", $root & "/Interface");
DirRemove($backupname);

MsgBox(4096, "Uninstall Complete", "Backup restored and deleted.  Have a nice day!");
  Reply With Quote
09-12-07, 03:13 PM   #4
Kaomie
A Scalebane Royal Guard
 
Kaomie's Avatar
AddOn Author - Click to view addons
Join Date: Jan 2007
Posts: 438
That is quite interesting, I am still looking at an automated system to distribute a compilation that would not be an executable (I am currently using InnoSetup, which works just fine otherwise).

The problem is there is no "appropriate" scripting language natively available in Windows. I am personally using ActivePerl to automate many things but it is still missing a good GUI extension and you need to install the environment. This is kind of similar with AutoIt as you either still need the interpreter or you have to produce a self-contained executable, so there is no real added value.

The only option I haven't really tried yet would be to use a VBS script, which does not require any additional installation to run. But I am not sure people would trust a VBS any more than an EXE
__________________
Kaomie
"WE LOTS OF PEOPLE FROM STRONG SERVER GUILDS" - Trade Channel
  Reply With Quote
09-13-07, 03:53 AM   #5
Ainu
A Murloc Raider
AddOn Compiler - Click to view compilations
Join Date: Sep 2007
Posts: 4
I considered VBS and other methods before looking at AutoIT since you can do much nicer interfaces that are much simpler to use. The problem that you'd face is that they aren't as transparant as an AutoIT script for people to look into and see the mechanics of it (and see that people won't be hacking your account and sharding your purples). Even the most basic understanding of coding would show that the above script simply moves files around for you.

It would be pretty easy to code this in C++ as well, but the whole point was to make something that you could either get from a safe location as a compiled version or preferably run from a script that you can assure yourself is safe.

Walking the line between usability and paranoia is a tricky task
  Reply With Quote

WoWInterface » AddOns, Compilations, Macros » Released AddOns » Unified UI Installer/Uninstaller


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off