OK...so I've done a few things to the script this week.
Here's a link of the completed package:
http://www.mediafire.com/?oaw677l02c9e95d
First I made it so the "DownloadFiles.exe" program downloads all the files, extracts them, moves files in proper places, deletes the installer and 7zip, and moves the "MyPaint Portable.exe" to the root folder from the app folder.
DownloadFiles:
Code: Select all
#NoTrayIcon
MsgBox (0, "Downloader", "Please be paitent while MyPaint downloads." )
InetGet ("http://download.gna.org/mypaint/mypaint-0.9.1-win32-installer.exe", @ScriptDir &"\app\app\mpi.exe", 0 )
Runwait ( @ScriptDir &"\app\app\7z.exe x mpi.exe", @ScriptDir &"\app\app\", @SW_HIDE )
DirCreate ( @ScriptDir &"\App\App\lib\" )
DirCreate ( @ScriptDir &"\App\App\lib\gtk-2.0" )
DirCreate ( @ScriptDir &"\App\App\share" )
DirCreate ( @ScriptDir &"\App\App\share\icons" )
DirCreate ( @ScriptDir &"\App\App\share\themes" )
DirCreate ( @ScriptDir &"\App\App\etc" )
DirMove ( @ScriptDir &"\App\App\$_OUTDIR\classic", @ScriptDir &"\App\App\brushes\classic", 1 )
DirMove ( @ScriptDir &"\App\App\$_OUTDIR\deevad", @ScriptDir &"\App\App\brushes\deevad", 1 )
DirMove ( @ScriptDir &"\App\App\$_OUTDIR\experimental", @ScriptDir &"\App\App\brushes\experimental", 1 )
DirMove ( @ScriptDir &"\App\App\$_OUTDIR\ramon", @ScriptDir &"\App\App\brushes\ramon", 1 )
DirMove ( @ScriptDir &"\App\App\$_OUTDIR\tanda", @ScriptDir &"\App\App\brushes\tanda", 1 )
DirMove ( @ScriptDir &"\App\App\$_OUTDIR\gtk-2.0\2.10.0", @ScriptDir &"\App\App\lib\gtk-2.0\2.10.0", 1 )
DirMove ( @ScriptDir &"\App\App\$_OUTDIR\hicolor", @ScriptDir &"\App\App\share\icons\hicolor", 1 )
DirMove ( @ScriptDir &"\App\App\$_OUTDIR\MS-Windows", @ScriptDir &"\App\App\share\themes\MS-Windows", 1 )
DirMove ( @ScriptDir &"\App\App\$_OUTDIR\gtk-2.0", @ScriptDir &"\App\App\etc\gtk-2.0", 1 )
DirRemove ( @ScriptDir &"\App\App\$_OUTDIR", 1 )
DirRemove ( @ScriptDir &"\App\App\$PLUGINSDIR", 1 )
FileDelete ( @ScriptDir &"\App\App\7z.exe" )
FileDelete ( @ScriptDir &"\App\App\7z.Dll" )
FileDelete ( @ScriptDir &"\App\App\mpi.exe" )
FileMove ( @ScriptDir &"\App\MyPaint Portable.exe", @ScriptDir , 1 )
MsgBox (0, "Finished", "MyPaint portable is ready to run." )
MyPaint Portable:
Code: Select all
#NoTrayIcon
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
Global $iPID
;If Running Quit
If ProcessExists("Mypaint.exe") Then
MsgBox(0, "Warning", "Mypaint is already running!")
Else
;Splash Screen
SPLASHIMAGEON("MyPaint Portable",@ScriptDir &"\app\info\splash.jpg",600,300 )
SLEEP(0x05DC)
SPLASHOFF()
;Backup Registry
;Run("regedit.exe /e backup1.reg HKEY_LOCAL_keypath, @ScriptDir &"\data\backup\reg")
;Run("regedit.exe /e backup2.reg HKEY_LOCAL_keypath, @ScriptDir &"\data\backup\reg")
;Run("regedit.exe /e backup3.reg HKEY_LOCAL_keypath, @ScriptDir &"\data\backup\reg")
;Backup Files
FileCopy(@userprofiledir &"\.recently-used.xbel", @ScriptDir &"\data\backup\files", 1)
DirMove(@userprofiledir &"\Local Settings\Application Data\MyPaint", @userprofiledir &"\Local Settings\Application Data\MyPaint1")
;Apply Registry Settings
;Run("regedit.exe /s settings1.reg", @ScriptDir &"\data\settings\reg")
;Run("regedit.exe /s settings2.reg", @ScriptDir &"\data\settings\reg")
;Run("regedit.exe /s settings3.reg", @ScriptDir &"\data\settings\reg")
;Copy Settings Files
FileCopy(@ScriptDir &"\data\settings\files", @userprofiledir &"\.recently-used.xbel", 1)
DirMove(@ScriptDir &"\data\settings\files\MyPaint", @userprofiledir &"\Local Settings\Application Data\MyPaint")
;Run the App
$iPID = Run(@ScriptDir & "\app\app\mypaint.exe")
While ProcessExists($iPID)
_ReduceMemory() ; Reduce the Memory of current PID, not used in RunWait. Normally memory is 11MB, not it will be 0.5MB!!
Sleep(100)
WEnd
;Delete Settings
DirRemove (@ScriptDir &"\data\settings", 1 )
DirCreate (@ScriptDir &"\data\Settings")
DirCreate (@ScriptDir &"\data\Settings\Files")
DirCreate (@ScriptDir &"\data\Settings\Reg")
;Backup Settings Registry
;Run("regedit.exe /e Settings1.reg HKEY_LOCAL_keypath, @ScriptDir &"\data\settings\reg")
;Run("regedit.exe /e Settings2.reg HKEY_LOCAL_keypath, @ScriptDir &"\data\settings\reg")
;Run("regedit.exe /e Settings3.reg HKEY_LOCAL_keypath, @ScriptDir &"\data\settings\reg")
;Backup Settings Files
FileCopy(@userprofiledir &"\.recently-used.xbel", @ScriptDir &"\data\settings\files", 1)
DirMove(@userprofiledir &"\Local Settings\Application Data\MyPaint", @ScriptDir &"\data\settings\files\MyPaint")
;Apply Delete Reg
Run("regedit.exe /s Delete.reg", @ScriptDir &"\data")
FileDelete ( @userprofiledir &"\.recently-used.xbel" )
;Apply Backup Registry
;Run("regedit.exe /s Backup1.reg", @ScriptDir &"\data\backup\reg")
;Run("regedit.exe /s Backup2.reg", @ScriptDir &"\data\backup\reg")
;Run("regedit.exe /s Backup3.reg", @ScriptDir &"\data\backup\reg")
;Copy Backup Files
FileCopy(@ScriptDir &"\data\backup\files", @userprofiledir &"\.recently-used.xbel", 1)
DirMove(@userprofiledir &"\Local Settings\Application Data\MyPaint1", @userprofiledir &"\Local Settings\Application Data\MyPaint")
;Delete Backup
DirRemove (@ScriptDir &"\data\Backup", 1 )
DirCreate (@ScriptDir &"\data\Backup")
DirCreate (@ScriptDir &"\data\Backup\Files")
DirCreate (@ScriptDir &"\data\Backup\Reg")
EndIf
Func _ReduceMemory() ; Only for the current process. Can be found on the AutoIt Forums.
Local $aReturn = DllCall("psapi.dll", "int", "EmptyWorkingSet", "long", -1)
If @error Then
Return SetError(1, 0, 0)
EndIf
Return $aReturn[0]
EndFunc ;==>_ReduceMemory