Jump to content
Sign in to follow this  
Drew

New Problem - Inside

Recommended Posts

Drew

I can't figure this problem out either. Or maybe it's not a problem , and it's just that I'm not doing it right... But here we go:

When: Case $FullInstall , I need it to do the FileInstalls.

Oh wow. Something just hit me... FileInstall takes action at these two times: When source is compiled , and when the Program is run.

So I can't have this happen when I press a button... Well that sparks a new question...

How can I make it so that when user presses the button $FullInstall , It extracts these files to the specified location? ( In my test-ready script , @DesktopDir& "\testcomplete\File.Extension")

Here's my script.

NOTE: Yes you will see that this program is made for Diablo II. No need to hide it, this is NOT a hack, this is NOT a bot... This program in NO way gives any user any advantage over any other user. This program will help confused players install and configure their files to play on a private server that I am part of the staff. I clearify that this is NOT a hack of any kind because I have had people turn away from helping me because they thought I was creating a hack.

;Notes
;
;Remember to add "GUICtrlSetbkColor(-1, 0x000000)" to the new buttons to make them show up black!!!!
;
;Things to Do:
;
;Alot.
;
;
;
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global  $InstallFile = True

#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Form1", 476, 513, 204, 122)
GUISetBkColor(0x000000)
$Pic1 = GUICtrlCreatePic("C:\Documents and Settings\Dreu\Desktop\GUI_Images\Skull.JPG", 8, 0, 481, 401, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
$Label1 = GUICtrlCreateLabel("D2War Installer V1.0.0", 16, 480, 166, 25)
GUICtrlSetFont(-1, 12, 800, 2, "Palatino Linotype")
GUICtrlSetColor(-1, 0x808000)
$Label2 = GUICtrlCreateLabel("By: Dreu ( Aka Veteran )", 288, 480, 177, 25)
GUICtrlSetFont(-1, 12, 800, 2, "Palatino Linotype")
GUICtrlSetColor(-1, 0x808000)
$ReadMe = GUICtrlCreateButton("Read Me", 192, 440, 113, 25, 0, $WS_EX_STATICEDGE)
GUICtrlSetFont(-1, 10, 800, 2, "Palatino Linotype")
GUICtrlSetColor(-1, 0x808000)
GUICtrlSetbkColor(-1, 0x000000)
$FullInstall = GUICtrlCreateButton("Full Install", 160, 392, 177, 33, 0, $WS_EX_STATICEDGE)
GUICtrlSetFont(-1, 12, 800, 2, "Palatino Linotype")
GUICtrlSetColor(-1, 0x808000)
GUICtrlSetbkColor(-1, 0x000000)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $ReadMe
            MsgBox( 0, "Yep", "Works")
        Case $FullInstall
            $D2WarFolder = Inputbox( "D2War Folder Name", "Please enter the name of the Diablo II folder you wish to use for D2War.")
            MsgBox( 0, "Folder", "The Folder You Chose Was: "&$D2WarFolder)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2Glide.dll", @desktopdir& "" &$D2WarFolder &"\D2Glide.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2Gdi.dll", @desktopdir& "" &$D2WarFolder &"\D2Gdi.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2gfx.dll", @desktopdir& "" &$D2WarFolder &"\D2gfx.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2Direct3D.dll", @desktopdir& "" &$D2WarFolder&"\D2Direct3D.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2Game.dll", @desktopdir& "" &$D2WarFolder&"\D2Game.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2Common.dll", @desktopdir& "" &$D2WarFolder&"\D2Common.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2Launch.dll", @desktopdir& "" &$D2WarFolder&"\D2Launch.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2MCPClient.dll", @desktopdir& "" &$D2WarFolder&"\D2MCPClient.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2Multi.dll", @desktopdir& "" &$D2WarFolder&"\D2Multi.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2Net.dll", @desktopdir& "" &$D2WarFolder&"\D2Net.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2sound.dll", @desktopdir& "" &$D2WarFolder&"\D2sound.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2Lang.dll", @desktopdir& "" &$D2WarFolder&"\D2Lang.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2Win.dll", @desktopdir& "" &$D2WarFolder&"\D2Win.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\Storm.dll", @desktopdir& "" &$D2WarFolder&"\Storm.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\Fog.dll", @desktopdir& "" &$D2WarFolder&"\Fog.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\ijl11.dll", @desktopdir& "" &$D2WarFolder&"\ijl11.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2CMP.dll", @desktopdir& "" &$D2WarFolder&"\D2CMP.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2DDraw.dll", @desktopdir& "" &$D2WarFolder&"\D2DDraw.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\D2Client.dll", @desktopdir& "" &$D2WarFolder&"\D2Client.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\Bnclient.dll", @desktopdir& "" &$D2WarFolder&"\Bnclient.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\binkw32.dll", @desktopdir& "" &$D2WarFolder&"\binkw32.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\Patch_D2.mpq", @desktopdir& "" &$D2WarFolder&"\Patch_D2.mpq", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\SmackW32.dll", @desktopdir& "" &$D2WarFolder&"\SmackW32.dll", 1)
            If $InstallFile = True Then FileInstall("C:\Documents and Settings\Dreu\Desktop\d2war_files_v1.1\Diablo II.exe", @desktopdir& "" &$D2WarFolder&"\Diablo II.exe", 1)
            
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
Generator

Nothing looks wrong at the first glance of your script, since I don't have AutoIt installed here unfortunately i can't help you on this one. But why declaring a boolean true at the beginning and making an if statement in the middle, extra work for nothing.

Share this post


Link to post
Share on other sites
Drew

This is the direct example from the command: FileInstall

Located in the help file:

$b = True

If $b = True Then FileInstall("C:\test.bmp", "D:\mydir\test.bmp")

So thats the format I followed. I learn as I go, and I start at the helpfile. =)

Share this post


Link to post
Share on other sites
covaks

I still think you should just zip everything up, including an unzip.exe, and then you just need two FileInstall commands. Then, you could have a button that fires up the unzip.exe and extracts everything when the user wants. Would probably make things easier. Plus, if you ever need to redo the files, you don't have to modify/re-compile your script, just update the files.zip and your set.

Share this post


Link to post
Share on other sites
Generator

This is the direct example from the command: FileInstall

Located in the help file:

$b = True

If $b = True Then FileInstall("C:\test.bmp", "D:\mydir\test.bmp")

So thats the format I followed. I learn as I go, and I start at the helpfile. =)

Good to hear that. But as you move along you'll realized that the button is the if statement you'll be triggering(In this case, case statement) and there' no need to put If in front of every file install. Even though you want to you can put them all under 1 if statement. To improve you program(If you intend to publish it at some point) you can add some simple error checking which prevents user from screwing around and messing up the script.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×