Sign in to follow this  
Followers 0
narayanjr

FileOpen() FileRead()

9 posts in this topic

Func _ReadChangeLog()
    FileOpen("ChangeLog.txt", 0)
    $CLog = FileRead("ChangeLog.txt")
    GUICtrlCreateEdit($CLog,10, 10, 210,190,$ES_READONLY)
    $Msg = GUIGetMsg()
    MsgBox(0,"Msg", $Msg)
    Do
        $Msg = GUIGetMsg()
        Sleep(100)
    Until $Msg = $Read
    MsgBox(0,"Msg", $Msg)
EndFunc

Right now when the Read Log button is hit it opens a txt file reads it and displays it in the gui. I want the text to stay there until the Read Log button is hit again. and i need it to have a scroll bar since all the text wont fit in the amount of room that is there.

Right now if you hit the read button it displays it but no scroll bar and it doesnt keep the text there until the Read button is hit again

if you need the rest of the code let me know and ill post it

Share this post


Link to post
Share on other sites



ok the scroll bar should work but i think i know what the problem is with the first while loop, when i hit the read button as long as i dont move the cursor off the button then it leave the text and scroll bar. but as soon as i move the mouse it messes up and gets stuff in the while loop in the Read Function. If i hit the read button a second time without moving it off the button from the first time then it exits the loop but as soon as i try to move the cursor over the box it changes back to the original text. any help would be nice thanks.

HotKeySet("{END}","quit")
#include<guiconstants.au3>
#include <Constants.au3>
$Main = GUICreate("Chaos Sanc Mod downloader", 320, 250, -1, -1) 

$Download = GUICtrlCreateButton("Download"     , 230,  10, 80, -1, $BS_FLAT, -1)
$Install  = GUICtrlCreateButton("Install"      , 230,  40, 80, -1, $BS_FLAT, -1)
$Change   = GUICtrlCreateButton("ChangeLog.txt", 230,  80, 80, -1, $BS_FLAT, -1)
$Read     = GUICtrlCreateButton("Read Log"     , 230, 110, 80, -1, $BS_FLAT, -1)
$Canel    = GUICtrlCreateButton("Cancel"       , 230, 213, 80, -1, $BS_FLAT, -1)

$Bar = GUICtrlCreateProgress (10,215,210,20,$PBS_SMOOTH)
$Msg = .01
GUISetState ()

While $Msg <>  $GUI_EVENT_CLOSE
    $Msg = GUIGetMsg()
    $Pos = GUIGetCursorInfo($Main)
    
    If $Msg = $Download Then
        $Confirm = MsgBox(4,"Conformation", "Are you sure you want to download?")
        If $Confirm = 6 Then
            _StartModDownload()
        EndIf
    ElseIf $Msg = $Install Then
        $Confirm = MsgBox(4,"Conformation", "Are you sure you want to install?")
        If $Confirm = 6 Then
            _InstallMod()
        EndIf
    ElseIf $Msg = $Change Then
        $Confirm = MsgBox(4,"Conformation", "Are you sure you want to download the ChangeLog.txt?")
        If $Confirm = 6 Then
            _StartChangeDownload()
        EndIf
    ElseIf $Msg = $Read Then
        _ReadChangeLog()
    ElseIf $Msg = $Canel Then
        Exit
    EndIf

    If $Pos[4] = 0 Then
        GUICtrlCreateEdit("Welcome to Chaos Sanc Mod downloader." & @CRLF & @CRLF &" Hover mouse over a button for a description.", 10, 10, 210,190,$ES_READONLY+$ES_AUTOVSCROLL+$WS_VSCROLL)
        Do
            $Msg = GUIGetMsg()
            $Pos = GUIGetCursorInfo($Main)
        Until $Pos[4] <> 0
    ElseIf $Pos[4] = 3 Then
        GUICtrlCreateEdit("Click to download to the most recent version of Chaos Sanc Mod by DareDevil", 10, 10, 210,190,$ES_READONLY+$ES_AUTOVSCROLL+$WS_VSCROLL)
        Do
            $Msg = GUIGetMsg()
            $Pos = GUIGetCursorInfo($Main)
            
            If $Msg = $Download Then
                $Confirm = MsgBox(4,"Conformation", "Are you sure you want to download?")
                If $Confirm = 6 Then
                    _StartModDownload()
                EndIf
            EndIf
        Until $Pos[4] <> 3
    ElseIf $Pos[4] = 4 Then
        GUICtrlCreateEdit("Click to Install Chaos Sanc Mod. There is no conformation after this DO NOT click if you do not want to Install.", 10, 10, 210,190,$ES_READONLY+$ES_AUTOVSCROLL+$WS_VSCROLL)
        Do
            $Msg = GUIGetMsg()
            $Pos = GUIGetCursorInfo($Main)
            
            If $Msg = $Install Then
                $Confirm = MsgBox(4,"Conformation", "Are you sure you want to install?")
                If $Confirm = 6 Then
                    _InstallMod()
                EndIf
            EndIf
        Until $Pos[4] <> 4
    ElseIf $Pos[4] = 5 Then
        GUICtrlCreateEdit("Click to download the most recent ChangeLog.txt file.  ChangeLog.txt shows the most recent changes made to Chaos Sanc Mod.", 10, 10, 210,190,$ES_READONLY+$ES_AUTOVSCROLL+$WS_VSCROLL)
        Do
            $Msg = GUIGetMsg()
            $Pos = GUIGetCursorInfo($Main)
            
            If $Msg = $Change Then
                $Confirm = MsgBox(4,"Conformation", "Are you sure you want to download the ChangeLog.txt?")
                If $Confirm = 6 Then
                    _StartChangeDownload()
                EndIf
            EndIf
        Until $Pos[4] <> 5
    ElseIf $Pos[4] = 6 Then
        GUICtrlCreateEdit("Click to View changelog.txt.", 10, 10, 210,190,$ES_READONLY+$ES_AUTOVSCROLL+$WS_VSCROLL)
        Do
            $Msg = GUIGetMsg()
            $Pos = GUIGetCursorInfo($Main)
            
            If $Msg = $Read Then
                _ReadChangeLog()
            EndIf
        Until $Pos[4] <> 6
    ElseIf $Pos[4] = 7 Then
        GUICtrlCreateEdit("Click to Close this window.", 10, 10, 210,190,$ES_READONLY+$ES_AUTOVSCROLL+$WS_VSCROLL)
        Do
            $Msg = GUIGetMsg()
            $Pos = GUIGetCursorInfo($Main)
            
            If $Msg = $Canel Then
                Exit
            EndIf
        Until $Pos[4] <> 7
    EndIf
WEnd


Func _StartModDownload()
    InetGet("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX","",1)
    GUICtrlDelete($Download)
    GUICtrlDelete($Change)
    GUICtrlDelete($Install)
    GUICtrlDelete($Read)
    GUICtrlCreateEdit("Please Wait While Downloading...", 10, 10, 210,190,$ES_READONLY+$ES_AUTOVSCROLL+$WS_VSCROLL)
    
    While @InetGetActive
        $i =  @InetGetBytesRead / 11013154 *100
        GUICtrlSetData($Bar, $i)
        Sleep(250)
    Wend
    
    $Download = GUICtrlCreateButton("Download"     , 230,  10, 80, -1, $BS_FLAT, -1)
    $Install  = GUICtrlCreateButton("Install"      , 230,  40, 80, -1, $BS_FLAT, -1)
    $Change   = GUICtrlCreateButton("ChangeLog.txt", 230,  80, 80, -1, $BS_FLAT, -1)
    $Read     = GUICtrlCreateButton("Read Log"     , 230, 110, 80, -1, $BS_FLAT, -1)
    GUICtrlCreateEdit("Welcome to Chaos Sanc Mod downloader." & @CRLF & @CRLF &" Hover mouse over a button for a description.", 10, 10, 210,190,$ES_READONLY+$ES_AUTOVSCROLL+$WS_VSCROLL)
    Sleep(1000)
    GUICtrlSetData($Bar, 0)
EndFunc

Func _StartChangeDownload()
    InetGet("XXXXXXXXXXXXXXXXXXXXXXXXXX","",1)
    GUICtrlDelete($Download)
    GUICtrlDelete($Change)
    GUICtrlDelete($Install)
    GUICtrlDelete($Read)
    GUICtrlCreateEdit("Please Wait While Downloading...", 10, 10, 210,190,$ES_READONLY+$ES_AUTOVSCROLL+$WS_VSCROLL)
    
    While @InetGetActive
        $i =  @InetGetBytesRead / 718 *100
        GUICtrlSetData($Bar, $i)
        Sleep(250)
    Wend

    $Download = GUICtrlCreateButton("Download"     , 230,  10, 80, -1, $BS_FLAT, -1)
    $Install  = GUICtrlCreateButton("Install"      , 230,  40, 80, -1, $BS_FLAT, -1)
    $Change   = GUICtrlCreateButton("ChangeLog.txt", 230,  80, 80, -1, $BS_FLAT, -1)
    $Read     = GUICtrlCreateButton("Read Log"     , 230, 110, 80, -1, $BS_FLAT, -1)
    GUICtrlCreateEdit("Welcome to Chaos Sanc Mod downloader." & @CRLF & @CRLF &" Hover mouse over a button for a description.", 10, 10, 210,190,$ES_READONLY+$ES_AUTOVSCROLL+$WS_VSCROLL)
    Sleep(1000)
    GUICtrlSetData($Bar, 0)
EndFunc

Func _InstallMod()
    GUICtrlDelete($Download)
    GUICtrlDelete($Change)
    GUICtrlDelete($Install)
    GUICtrlDelete($Read)
    GUICtrlCreateEdit("Please Wait While Installing...", 10, 10, 210,190,$ES_READONLY+$ES_AUTOVSCROLL+$WS_VSCROLL)
    Run(@ComSpec & " /c " & 'start "data" "C:\Program Files\Diablo II\data.exe"', "", @SW_HIDE)
    WinWaitActive("Chilkat Zip 2 Secure EXE")
    ControlSend("Chilkat Zip 2 Secure EXE", "", 1003, "C:\Program Files\Diablo II")
    Sleep(250)
    ControlClick("Chilkat Zip 2 Secure EXE", "", 1001)

    Do
        $text = WinGetText("Chilkat Zip 2 Secure EXE", "")
        $text = StringTrimLeft($text,141)
        $text = StringTrimRight($text,1)
        Sleep(500)
    Until $text = "Finished!"

    ControlClick("Chilkat Zip 2 Secure EXE", "", 2)
    MsgBox(0,"Done","Install Successful")
    
    $Download = GUICtrlCreateButton("Download"     , 230,  10, 80, -1, $BS_FLAT, -1)
    $Install  = GUICtrlCreateButton("Install"      , 230,  40, 80, -1, $BS_FLAT, -1)
    $Change   = GUICtrlCreateButton("ChangeLog.txt", 230,  80, 80, -1, $BS_FLAT, -1)
    $Read     = GUICtrlCreateButton("Read Log"     , 230, 110, 80, -1, $BS_FLAT, -1)
    GUICtrlCreateEdit("Welcome to Chaos Sanc Mod downloader." & @CRLF & @CRLF &" Hover mouse over a button for a description.", 10, 10, 210,190,$ES_READONLY+$ES_AUTOVSCROLL+$WS_VSCROLL)
EndFunc

Func _ReadChangeLog()
    $handle = FileOpen("ChangeLog.txt", 0)
    $CLog = FileRead("ChangeLog.txt")
    GUICtrlCreateEdit($CLog,10, 10, 210,190,$WS_VSCROLL, $ES_MULTILINE)
    $Msg = GUIGetMsg()
    While $Msg <> $Read
        $Msg = GUIGetMsg()
        Sleep(500)
    WEnd
    FileClose($handle)
    
EndFunc

Func quit()
    Exit
EndFunc

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

your script should look like:

While 1
    $Msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            Exit
        Case $Msg = $Read
            _ReadChangeLog()
    EndSelect
WEnd

Func _ReadChangeLog()
    FileOpen("ChangeLog.txt", 0)
    $CLog = FileRead("ChangeLog.txt")
    GUICtrlCreateEdit($CLog,10, 10, 210,190,$ES_READONLY + $WS_HSCROLL)
EndFunc

wow - you've put alot of stuff into the main loop and I'm sure that 90% of it shouldn't be there

The main loop is used to get messages from the GUI and sometimes for executing some code.

Keep in mind that the main loop is executed very often (if you put 100 sleep inside then it will be executed 10 times/sec) - do you really need such a big amount of code to be executed over and over?

You can tidy up your script.

Put a little work into it, create functions and it definitely will look better and it will be more easy to read.

Edited by enaiman

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

but how would i make the mouse hovering thing work with that?

ok ill try and make it more functions and tidy it

Edited by narayanjr

Share this post


Link to post
Share on other sites

My post solved your issue with the read function - so your script will work if you include that code.

Tidying up the code is a future job for you so don't think too much about it.


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

HotKeySet("{END}", "quit")
#include<guiconstants.au3>
#include <Constants.au3>
$Main = GUICreate("Chaos Sanc Mod downloader", 320, 250, -1, -1)

$Download = GUICtrlCreateButton("Download", 230, 10, 80, -1, $BS_FLAT, -1)
$Install = GUICtrlCreateButton("Install", 230, 40, 80, -1, $BS_FLAT, -1)
$Change = GUICtrlCreateButton("ChangeLog.txt", 230, 80, 80, -1, $BS_FLAT, -1)
$Read = GUICtrlCreateButton("Read Log", 230, 110, 80, -1, $BS_FLAT, -1)
$Canel = GUICtrlCreateButton("Cancel", 230, 213, 80, -1, $BS_FLAT, -1)
GUICtrlCreateEdit("Welcome to Chaos Sanc Mod downloader." & @CRLF & @CRLF & " Hover mouse over a button for a description.", 10, 10, 210, 190, $ES_READONLY + $ES_AUTOVSCROLL + $WS_VSCROLL)
$Bar = GUICtrlCreateProgress(10, 215, 210, 20, $PBS_SMOOTH)
GUISetState()

While 1
    $Msg = GUIGetMsg()
    $Pos = GUIGetCursorInfo($Main)
    
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
        Case $Msg = $Download 
            $Confirm = MsgBox(4, "Conformation", "Are you sure you want to download?")
            If $Confirm = 6 Then
                _StartModDownload()
            EndIf
        Case $Msg = $Install
            $Confirm = MsgBox(4, "Conformation", "Are you sure you want to install?")
            If $Confirm = 6 Then
                _InstallMod()
            EndIf
        Case $Msg = $Change
            $Confirm = MsgBox(4, "Conformation", "Are you sure you want to download the ChangeLog.txt?")
            If $Confirm = 6 Then
                _StartChangeDownload()
            EndIf
        Case  $Msg = $Canel
            Exit
        Case $Msg = $Read
            _ReadChangeLog()
        Case $Pos[4] = 3
            GUICtrlCreateEdit("Click to download to the most recent version of Chaos Sanc Mod by DareDevil", 10, 10, 210, 190, $ES_READONLY + $ES_AUTOVSCROLL + $WS_VSCROLL)
            Do
                $Pos = GUIGetCursorInfo($Main)
            Until $Pos[4] <> 3
        Case $Pos[4] = 4 
            GUICtrlCreateEdit("Click to Install Chaos Sanc Mod. There is no conformation after this DO NOT click if you do not want to Install.", 10, 10, 210, 190, $ES_READONLY + $ES_AUTOVSCROLL + $WS_VSCROLL)
            Do
                $Pos = GUIGetCursorInfo($Main)
            Until $Pos[4] <> 4
        Case $Pos[4] = 5 
            GUICtrlCreateEdit("Click to download the most recent ChangeLog.txt file.  ChangeLog.txt shows the most recent changes made to Chaos Sanc Mod.", 10, 10, 210, 190, $ES_READONLY + $ES_AUTOVSCROLL + $WS_VSCROLL)
            Do
                $Pos = GUIGetCursorInfo($Main)
            Until $Pos[4] <> 5
        Case $Pos[4] = 6
            GUICtrlCreateEdit("Click to View changelog.txt.", 10, 10, 210, 190, $ES_READONLY + $ES_AUTOVSCROLL + $WS_VSCROLL)
            Do
                $Pos = GUIGetCursorInfo($Main)
            Until $Pos[4] <> 6
        Case $Pos[4] = 7
            GUICtrlCreateEdit("Click to Close this window.", 10, 10, 210, 190, $ES_READONLY + $ES_AUTOVSCROLL + $WS_VSCROLL)
            Do
                $Pos = GUIGetCursorInfo($Main)
            Until $Pos[4] <> 7
    EndSelect
WEnd


Func _StartModDownload()
    InetGet("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "C:\Program Files\Diablo II\data.exe", "", 1)
    GUICtrlDelete($Download)
    GUICtrlDelete($Change)
    GUICtrlDelete($Install)
    GUICtrlDelete($Read)
    GUICtrlCreateEdit("Please Wait While Downloading...", 10, 10, 210, 190, $ES_READONLY + $ES_AUTOVSCROLL + $WS_VSCROLL)
    
    While @InetGetActive
        $i = @InetGetBytesRead / 11013154 * 100
        GUICtrlSetData($Bar, $i)
        Sleep(250)
    WEnd
    
    $Download = GUICtrlCreateButton("Download", 230, 10, 80, -1, $BS_FLAT, -1)
    $Install = GUICtrlCreateButton("Install", 230, 40, 80, -1, $BS_FLAT, -1)
    $Change = GUICtrlCreateButton("ChangeLog.txt", 230, 80, 80, -1, $BS_FLAT, -1)
    $Read = GUICtrlCreateButton("Read Log", 230, 110, 80, -1, $BS_FLAT, -1)
    GUICtrlCreateEdit("Welcome to Chaos Sanc Mod downloader." & @CRLF & @CRLF & " Hover mouse over a button for a description.", 10, 10, 210, 190, $ES_READONLY + $ES_AUTOVSCROLL + $WS_VSCROLL)
    Sleep(1000)
    GUICtrlSetData($Bar, 0)
EndFunc   ;==>_StartModDownload

Func _StartChangeDownload()
    InetGet("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "", 1)
    GUICtrlDelete($Download)
    GUICtrlDelete($Change)
    GUICtrlDelete($Install)
    GUICtrlDelete($Read)
    GUICtrlCreateEdit("Please Wait While Downloading...", 10, 10, 210, 190, $ES_READONLY + $ES_AUTOVSCROLL + $WS_VSCROLL)
    
    While @InetGetActive
        $i = @InetGetBytesRead / 718 * 100
        GUICtrlSetData($Bar, $i)
        Sleep(250)
    WEnd

    $Download = GUICtrlCreateButton("Download", 230, 10, 80, -1, $BS_FLAT, -1)
    $Install = GUICtrlCreateButton("Install", 230, 40, 80, -1, $BS_FLAT, -1)
    $Change = GUICtrlCreateButton("ChangeLog.txt", 230, 80, 80, -1, $BS_FLAT, -1)
    $Read = GUICtrlCreateButton("Read Log", 230, 110, 80, -1, $BS_FLAT, -1)
    GUICtrlCreateEdit("Welcome to Chaos Sanc Mod downloader." & @CRLF & @CRLF & " Hover mouse over a button for a description.", 10, 10, 210, 190, $ES_READONLY + $ES_AUTOVSCROLL + $WS_VSCROLL)
    Sleep(1000)
    GUICtrlSetData($Bar, 0)
EndFunc   ;==>_StartChangeDownload

Func _InstallMod()
    GUICtrlDelete($Download)
    GUICtrlDelete($Change)
    GUICtrlDelete($Install)
    GUICtrlDelete($Read)
    GUICtrlCreateEdit("Please Wait While Installing...", 10, 10, 210, 190, $ES_READONLY + $ES_AUTOVSCROLL + $WS_VSCROLL)
    Run(@ComSpec & " /c " & 'start "data" "C:\Program Files\Diablo II\data.exe"', "", @SW_HIDE)
    WinWaitActive("Chilkat Zip 2 Secure EXE")
    ControlSend("Chilkat Zip 2 Secure EXE", "", 1003, "C:\Program Files\Diablo II")
    Sleep(250)
    ControlClick("Chilkat Zip 2 Secure EXE", "", 1001)

    Do
        $text = WinGetText("Chilkat Zip 2 Secure EXE", "")
        $text = StringTrimLeft($text, 141)
        $text = StringTrimRight($text, 1)
        Sleep(500)
    Until $text = "Finished!"

    ControlClick("Chilkat Zip 2 Secure EXE", "", 2)
    MsgBox(0, "Done", "Install Successful")
    
    $Download = GUICtrlCreateButton("Download", 230, 10, 80, -1, $BS_FLAT, -1)
    $Install = GUICtrlCreateButton("Install", 230, 40, 80, -1, $BS_FLAT, -1)
    $Change = GUICtrlCreateButton("ChangeLog.txt", 230, 80, 80, -1, $BS_FLAT, -1)
    $Read = GUICtrlCreateButton("Read Log", 230, 110, 80, -1, $BS_FLAT, -1)
    GUICtrlCreateEdit("Welcome to Chaos Sanc Mod downloader." & @CRLF & @CRLF & " Hover mouse over a button for a description.", 10, 10, 210, 190, $ES_READONLY + $ES_AUTOVSCROLL + $WS_VSCROLL)
EndFunc   ;==>_InstallMod

Func _ReadChangeLog()
    FileOpen("ChangeLog.txt", 0)
    $CLog = FileRead("ChangeLog.txt")
    GUICtrlCreateEdit($CLog,10, 10, 210,190,$WS_VSCROLL, $ES_MULTILINE)
EndFunc   ;==>_ReadChangeLog

Func quit()
    Exit
EndFunc   ;==>quit

well i did the entire thing with cases which I'm not sure if i did it right first time ive used them. right now it works the same as it did before if i click the read button then nothing happens until i move th mouse off of the button then it shows the changelog and a vertical scroll bar but as soon as i try and touch it it disappears and if i click where the text was it erases all the text that was there and puts the last thing of text that was there. None of the buttons do what they are suppose to until the mouse is moved off of the button

Edited by narayanjr

Share this post


Link to post
Share on other sites

replaced all GuiCtrlCreateEdit (yeah - you were creating dozens of edits one in top of other) with GuiCtrlSetData

try your code now and see how it's working.

HotKeySet("{END}", "quit")
#include<guiconstants.au3>
#include <Constants.au3>
$Main = GUICreate("Chaos Sanc Mod downloader", 320, 250, -1, -1)

$Download = GUICtrlCreateButton("Download", 230, 10, 80, -1, $BS_FLAT, -1)
$Install = GUICtrlCreateButton("Install", 230, 40, 80, -1, $BS_FLAT, -1)
$Change = GUICtrlCreateButton("ChangeLog.txt", 230, 80, 80, -1, $BS_FLAT, -1)
$Read = GUICtrlCreateButton("Read Log", 230, 110, 80, -1, $BS_FLAT, -1)
$Canel = GUICtrlCreateButton("Cancel", 230, 213, 80, -1, $BS_FLAT, -1)
$editb = GUICtrlCreateEdit("Welcome to Chaos Sanc Mod downloader." & @CRLF & @CRLF & " Hover mouse over a button for a description.", 10, 10, 210, 190, $ES_READONLY + $ES_AUTOVSCROLL + $WS_VSCROLL)
$Bar = GUICtrlCreateProgress(10, 215, 210, 20, $PBS_SMOOTH)
GUISetState()

While 1
    $Msg = GUIGetMsg()
    $Pos = GUIGetCursorInfo($Main)
    
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
        Case $Msg = $Download 
            $Confirm = MsgBox(4, "Conformation", "Are you sure you want to download?")
            If $Confirm = 6 Then
                _StartModDownload()
            EndIf
        Case $Msg = $Install
            $Confirm = MsgBox(4, "Conformation", "Are you sure you want to install?")
            If $Confirm = 6 Then
                _InstallMod()
            EndIf
        Case $Msg = $Change
            $Confirm = MsgBox(4, "Conformation", "Are you sure you want to download the ChangeLog.txt?")
            If $Confirm = 6 Then
                _StartChangeDownload()
            EndIf
        Case  $Msg = $Canel
            Exit
        Case $Msg = $Read
            _ReadChangeLog()
        Case $Pos[4] = 3
            GUICtrlSetData($editb, "Click to download to the most recent version of Chaos Sanc Mod by DareDevil")
            Do
                $Pos = GUIGetCursorInfo($Main)
            Until $Pos[4] <> 3
        Case $Pos[4] = 4 
            GUICtrlSetData($editb,"Click to Install Chaos Sanc Mod. There is no conformation after this DO NOT click if you do not want to Install.")
            Do
                $Pos = GUIGetCursorInfo($Main)
            Until $Pos[4] <> 4
        Case $Pos[4] = 5 
            GUICtrlSetData($editb,"Click to download the most recent ChangeLog.txt file.  ChangeLog.txt shows the most recent changes made to Chaos Sanc Mod.")
            Do
                $Pos = GUIGetCursorInfo($Main)
            Until $Pos[4] <> 5
        Case $Pos[4] = 6
            GUICtrlSetData($editb,"Click to View changelog.txt.")
            Do
                $Pos = GUIGetCursorInfo($Main)
            Until $Pos[4] <> 6
        Case $Pos[4] = 7
            GUICtrlSetData($editb,"Click to Close this window.")
            Do
                $Pos = GUIGetCursorInfo($Main)
            Until $Pos[4] <> 7
    EndSelect
WEnd


Func _StartModDownload()
    InetGet("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "C:\Program Files\Diablo II\data.exe", "", 1)
    GUICtrlDelete($Download)
    GUICtrlDelete($Change)
    GUICtrlDelete($Install)
    GUICtrlDelete($Read)
    GUICtrlSetData($editb,"Please Wait While Downloading...")
    
    While @InetGetActive
        $i = @InetGetBytesRead / 11013154 * 100
        GUICtrlSetData($Bar, $i)
        Sleep(250)
    WEnd
    
    $Download = GUICtrlCreateButton("Download", 230, 10, 80, -1, $BS_FLAT, -1)
    $Install = GUICtrlCreateButton("Install", 230, 40, 80, -1, $BS_FLAT, -1)
    $Change = GUICtrlCreateButton("ChangeLog.txt", 230, 80, 80, -1, $BS_FLAT, -1)
    $Read = GUICtrlCreateButton("Read Log", 230, 110, 80, -1, $BS_FLAT, -1)
    GUICtrlSetData($editb,"Welcome to Chaos Sanc Mod downloader." & @CRLF & @CRLF & " Hover mouse over a button for a description.")
    Sleep(1000)
    GUICtrlSetData($Bar, 0)
EndFunc   ;==>_StartModDownload

Func _StartChangeDownload()
    InetGet("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", "", 1)
    GUICtrlDelete($Download)
    GUICtrlDelete($Change)
    GUICtrlDelete($Install)
    GUICtrlDelete($Read)
    GUICtrlSetData($editb,"Please Wait While Downloading...")
    
    While @InetGetActive
        $i = @InetGetBytesRead / 718 * 100
        GUICtrlSetData($Bar, $i)
        Sleep(250)
    WEnd

    $Download = GUICtrlCreateButton("Download", 230, 10, 80, -1, $BS_FLAT, -1)
    $Install = GUICtrlCreateButton("Install", 230, 40, 80, -1, $BS_FLAT, -1)
    $Change = GUICtrlCreateButton("ChangeLog.txt", 230, 80, 80, -1, $BS_FLAT, -1)
    $Read = GUICtrlCreateButton("Read Log", 230, 110, 80, -1, $BS_FLAT, -1)
    GUICtrlSetData($editb,"Welcome to Chaos Sanc Mod downloader." & @CRLF & @CRLF & " Hover mouse over a button for a description.")
    Sleep(1000)
    GUICtrlSetData($Bar, 0)
EndFunc   ;==>_StartChangeDownload

Func _InstallMod()
    GUICtrlDelete($Download)
    GUICtrlDelete($Change)
    GUICtrlDelete($Install)
    GUICtrlDelete($Read)
    GUICtrlSetData($editb,"Please Wait While Installing...")
    Run(@ComSpec & " /c " & 'start "data" "C:\Program Files\Diablo II\data.exe"', "", @SW_HIDE)
    WinWaitActive("Chilkat Zip 2 Secure EXE")
    ControlSend("Chilkat Zip 2 Secure EXE", "", 1003, "C:\Program Files\Diablo II")
    Sleep(250)
    ControlClick("Chilkat Zip 2 Secure EXE", "", 1001)

    Do
        $text = WinGetText("Chilkat Zip 2 Secure EXE", "")
        $text = StringTrimLeft($text, 141)
        $text = StringTrimRight($text, 1)
        Sleep(500)
    Until $text = "Finished!"

    ControlClick("Chilkat Zip 2 Secure EXE", "", 2)
    MsgBox(0, "Done", "Install Successful")
    
    $Download = GUICtrlCreateButton("Download", 230, 10, 80, -1, $BS_FLAT, -1)
    $Install = GUICtrlCreateButton("Install", 230, 40, 80, -1, $BS_FLAT, -1)
    $Change = GUICtrlCreateButton("ChangeLog.txt", 230, 80, 80, -1, $BS_FLAT, -1)
    $Read = GUICtrlCreateButton("Read Log", 230, 110, 80, -1, $BS_FLAT, -1)
    GUICtrlSetData($editb,"Welcome to Chaos Sanc Mod downloader." & @CRLF & @CRLF & " Hover mouse over a button for a description.")
EndFunc   ;==>_InstallMod

Func _ReadChangeLog()
    FileOpen("ChangeLog.txt", 0)
    $CLog = FileRead("ChangeLog.txt")
    GUICtrlSetData($editb,$CLog)
EndFunc   ;==>_ReadChangeLog

Func quit()
    Exit
EndFunc   ;==>quit

SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

all the text works fine the scroll bar and read function work perfect thank you but none of the buttons do any thing until you click then move mouse off of the button but i think i can fix that easy enough yup got it to work Thank You enaiman for all your help

Edited by narayanjr

Share this post


Link to post
Share on other sites

no worries :whistle:

Glad it worked :lmao:


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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  
Followers 0