Jump to content

My Prodject in which i need help


Swift
 Share

Recommended Posts

Isn't that the same!? (i don't know :) )

No It Isn't

I don't know what swift wants but...

He wanted to fix bug where when you close settings window it closed whole program (i think that lol ;DD)

This is a big program with many things!

That's Only Menu Code,the whole program will be a lot bigger ;D
Link to comment
Share on other sites

There's a difference between what AscaroN and I did... I personally think my solution is more simple.

In AscaroN's code, when you press exit it changes a variable value so that the While $statement becomes false which consequently exits the loop.

In my code, when you press exit it simple exits the loop... Outside of the loop it then delete the GUI...

#include <GuiConstants.au3>

$Gui = GuiCreate("Test", 390, 360)

$Edit = GUICtrlCreateEdit("", 10, 20, 240, 200, $GUI_SS_DEFAULT_EDIT+$ES_READONLY)

$Button_1 = GUICtrlCreateButton("Button 1", 30, 240, 70, 20)
$Button_2 = GUICtrlCreateButton("Button 2", 160, 240, 70, 20)
$menue = GuiCtrlCreateMenu("Bot")
$settings = Guictrlcreatemenu("Settings")
GUICtrlcreatemenuitem("Connect", $menue)
GUICtrlcreatemenuitem("Disconnect", $menue)
GUICtrlcreatemenuitem("", $menue)
GUICtrlCreateMenuItem("Userlist Manager", $menue)
GUICtrlCreateMenuItem("Custom Command Editor", $menue)
GUICtrlCreateMenuItem("User Monitor", $menue)
GUICtrlCreateMenuItem("Get News And Check For Updates", $menue)
GUICtrlCreateMenuItem("", $menue)
GUICtrlCreateMenuItem("Ignore Clan Invitations", $menue)
GUICtrlCreateMenuItem("", $menue)
GUICtrlCreateMenuItem("Quick Channels", $menue)
GUICtrlCreateMenuItem("Exit", $menue)
$botsettings = GUICtrlCreateMenuItem("Bot Settings", $settings)
GUICtrlCreateMenuItem("Use UDF-8 Encoding/Decoding", $settings)
GUICtrlCreateMenuItem("", $settings)
GUICtrlCreateMenuItem("Edit Profile", $settings)
GUICtrlCreateMenuItem("Edit Chat Filters", $settings)
GUICtrlCreateMenuItem("Edit Catch Phrases", $settings)
GUICtrlCreateMenuItem("", $settings)
GUICtrlCreateMenuItem("View Caught Phrases", $settings)
GUICtrlCreateMenuItem("Edit Files...", $settings)
GUICtrlCreateMenuItem("", $settings)
$botSettingsItem = GUICtrlCreateMenuItem("Bot Settings", $settings); <--- I Assigned a variable to the "Bot Settings" item
GUICtrlCreateMenuItem("Reload Config", $settings)
GUICtrlCreateMenuItem("Reload Script", $settings)
$hi = GUICtrlCreateMenu("Connect")
GUICtrlCreateMenu("Disconnect")
$window = GUictrlcreatemenu("Window")
Guictrlcreatemenuitem("Toggle Join/Leave Messages", $window)
Guictrlcreatemenuitem("Toggle Chat Window Lock", $window)
Guictrlcreatemenuitem("Toggle Chat Filters", $window)
Guictrlcreatemenuitem("", $window)
Guictrlcreatemenuitem("Use Individual Whisper Windows", $window)
Guictrlcreatemenuitem("", $window)
Guictrlcreatemenuitem("Show Outgoing Whispers In Whisper Box", $window)
Guictrlcreatemenuitem("Hide Whispers In Main Window", $window)
Guictrlcreatemenuitem("", $window)
Guictrlcreatemenuitem("Logging Settings", $window)
Guictrlcreatemenuitem("", $window)
Guictrlcreatemenuitem("Clear Chat Window", $window)
Guictrlcreatemenuitem("Clear Whisper Window", $window)
Guictrlcreatemenuitem("", $window)
Guictrlcreatemenuitem("Flash Window On Events", $window)
Guictrlcreatemenuitem("Disable Void View", $window)
$help = guictrlcreatemenu("Help")
Guictrlcreatemenuitem("About...", $help)
Guictrlcreatemenuitem("Readme and Command List", $help)
Guictrlcreatemenuitem("Homepage", $help)

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button_1, $Button_2
            $NewData = "Wellcome!"
            If $Msg = $Button_2 Then $NewData = "Hello!"
            
            $Read_Edit = GUICtrlRead($Edit)
            If $Read_Edit <> "" Then $NewData = @CRLF & $NewData
            
            GUICtrlSetData($Edit, $Read_Edit & $NewData)
            GUICtrlSendMsg($Edit, 0xB7, 0, 0)
            
        Case $botSettingsItem; <-- Add an exception for the menu item
            _Bot()
    EndSwitch
WEnd


Func _Bot()
    WinMinimizeAll()

;;---Your Program below:
    $k = IniRead(@ScriptDir & "\Config.ini", "Config", "Account", "")
    $m = Iniread(@Scriptdir & "\config.ini", "config", "Password", "")
    $l = Iniread(@Scriptdir & "\config.ini", "config", "HomeChannel", "")
    $a = Iniread(@Scriptdir & "\config.ini", "config", "SetServer", "")
    $5 = iniread(@scriptdir & "\config.ini", "config", "WeBBoTSiTE", "")
    $keyz = iniread(@scriptdir & "\config.ini", "config", "CD-Key", "")



    $GUI = GUICreate($k & ", Online in channel Clan ByE", 390, 360, -1, -1)
    $Label_1 = GUICtrlCreateLabel("Account Name", 10, 5, 130, 15)
    Guictrlcreatelabel("WeBBoT WeBSiTE", 10, 170, 130, 15)
    $web = guictrlcreateinput($5, 10, 185, 100, 20)
    $Input_1 = GUICtrlCreateInput($k, 10, 20, 100, 20)
    $key = GUICtrlcreateinput($keyz, 10, 225, 100, 20)
    GUICtrlCreateLabel("Password", 10, 45, 130, 15)
    GUICtrlCreateLabel("Home Channel", 10, 85, 130, 15)
    GUICtrlCreateLabel("Server", 10, 125, 130, 15)
    Guictrlcreatelabel("CD-Key", 10, 210, 130, 15)
    $chan = GUICTRLCREATEINPUT($l, 10, 100, 100, 20)
    $pass = GUICtrlCreateInput($m, 10, 60, 100, 20)
    $server = GUICtrlCreateInput($a, 10, 140, 100, 20)
    $Button_3 = GUICtrlCreateButton("Disconnect", 115, 40, 70, 24)
    $Button_1 = GUICtrlCreateButton("&Connect", 120, 10, 60, 24)
    $Edit_1 = GUICtrlCreateEdit("", 190, 30, 150, 185, BitOR($ES_AUTOVSCROLL, $ES_READONLY))
    $Label_3 = GUICtrlCreateLabel("Battle.Net Info", 215, 10, 130, 15)
    $Button_4 = GUICtrlCreateButton("Save and Exit", 190, 221, 151)
    GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        Select
            Case $nMsg = $Button_1
                GUICtrlSetData($Edit_1, "Connecting..." & @CRLF & "Connected!" & @CRLF & "[BNLS] Connecting..." & @CRLF & "[BNLS] Connected!" & @CRLF & "Sending Login Information..." & @CRLF & "Login Successful!")
            Case $nMsg = $GUI_EVENT_CLOSE
                ExitLoop; <-- ExitLoop instead of Exit here
            Case $nMsg = $Button_3
                GUIctrlsetdata($edit_1, "[BNET] Disconnected!")
            Case $nMsg = $Button_4
                $EDIT_READ = GUICtrlRead($Input_1)
                IniWrite(@ScriptDir & "\Config.ini", "Config", "Account", $EDIT_READ)
                ExitLoop; <-- ExitLoop instead of Exit here
            Case $nMsg = $pass
                $password = GUIctrlread($pass)
                Iniwrite(@Scriptdir & "\config.ini", "Config", "Password", $password)
                ExitLoop; <-- ExitLoop instead of Exit here
            Case $nMsg = $chan
                $homechan = Guictrlread($chan)
                iniwrite(@scriptdir & "\config.ini", "Config", "HomeChannel", $homechan)
            Case $nMsg = $server
                $servers = guictrlread($server)
                iniwrite(@scriptdir & "\config.ini", "config", "SetServer", $servers)
            Case $nMsg = $web
                $website = GUICtrlRead($web)
                iniwrite(@scriptdir & "\config.ini", "config", "WeBBoTSiTE", $website)
            Case $nMsg = $key
                $keys = GUIctrlread($key)
                iniwrite(@scriptdir & "\config.ini", "config", "CD-Key", $keys)
            Case $nMsg = $button_1
                Send("C")
        EndSelect
    WEnd
    
; The exit loop bring exit the While 1 Loop so the code picks up here after reading the ExitLoop statement
    
    GuiDelete();Deletes the Bot Settings GUI
    
    WinMinimizeAllUndo(); I Added this just because you have a WinMinimizeAll() at the top
    
EndFunc
My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
Link to comment
Share on other sites

nice...nice...ok...but...1 more thing...how would i make the Connect button AT THE TOP write in the edit: Hello. and you press Disconnect AT THE TOP it says: Welcome

this is what i have so far...

#include <GuiConstants.au3>

$Settings = 0;settings window thing 

$Gui = GuiCreate("Test", 390, 360)

$Edit = GUICtrlCreateEdit("", 10, 20, 240, 200, $GUI_SS_DEFAULT_EDIT+$ES_READONLY)

GUICtrlCreateButton("Button 1", 30, 240, 70, 20)
GUICtrlCreateButton("Button 2", 160, 240, 70, 20)
$menue = GuiCtrlCreateMenu("Bot")
$settings = Guictrlcreatemenu("Settings")
$Button_1 = GUICtrlcreatemenuitem("Connect", $menue)
$Button_2 = GUICtrlcreatemenuitem("Disconnect", $menue)
GUICtrlcreatemenuitem("", $menue)
GUICtrlCreateMenuItem("Userlist Manager", $menue)
GUICtrlCreateMenuItem("Custom Command Editor", $menue)
GUICtrlCreateMenuItem("User Monitor", $menue)
GUICtrlCreateMenuItem("Get News And Check For Updates", $menue)
GUICtrlCreateMenuItem("", $menue)
GUICtrlCreateMenuItem("Ignore Clan Invitations", $menue)
GUICtrlCreateMenuItem("", $menue)
GUICtrlCreateMenuItem("Quick Channels", $menue)
GUICtrlCreateMenuItem("Exit", $menue)
$botsettingsitem = GUICtrlCreateMenuItem("Bot Settings", $settings)
GUICtrlCreateMenuItem("Use UDF-8 Encoding/Decoding", $settings)
GUICtrlCreateMenuItem("", $settings)
GUICtrlCreateMenuItem("Edit Profile", $settings)
GUICtrlCreateMenuItem("Edit Chat Filters", $settings)
GUICtrlCreateMenuItem("Edit Catch Phrases", $settings)
GUICtrlCreateMenuItem("", $settings)
GUICtrlCreateMenuItem("View Caught Phrases", $settings)
GUICtrlCreateMenuItem("Edit Files...", $settings)
GUICtrlCreateMenuItem("", $settings)
GUICtrlCreateMenuItem("Reload Config", $settings)
GUICtrlCreateMenuItem("Reload Script", $settings)
$connect = GUICtrlCreateMenu("Connect")
$disconnect = GUICtrlCreateMenu("Disconnect")
$window = GUictrlcreatemenu("Window")
Guictrlcreatemenuitem("Toggle Join/Leave Messages", $window)
Guictrlcreatemenuitem("Toggle Chat Window Lock", $window)
Guictrlcreatemenuitem("Toggle Chat Filters", $window)
Guictrlcreatemenuitem("", $window)
Guictrlcreatemenuitem("Use Individual Whisper Windows", $window)
Guictrlcreatemenuitem("", $window)
Guictrlcreatemenuitem("Show Outgoing Whispers In Whisper Box", $window)
Guictrlcreatemenuitem("Hide Whispers In Main Window", $window)
Guictrlcreatemenuitem("", $window)
Guictrlcreatemenuitem("Logging Settings", $window)
Guictrlcreatemenuitem("", $window)
Guictrlcreatemenuitem("Clear Chat Window", $window)
Guictrlcreatemenuitem("Clear Whisper Window", $window)
Guictrlcreatemenuitem("", $window)
Guictrlcreatemenuitem("Flash Window On Events", $window)
Guictrlcreatemenuitem("Disable Void View", $window)
$help = guictrlcreatemenu("Help")
$aboutbox = Guictrlcreatemenuitem("About...", $help)
$readme = Guictrlcreatemenuitem("Readme and Command List", $help)
$homepage = Guictrlcreatemenuitem("Homepage", $help)

GUISetState()

While 1
    $Msg = GUIGetMsg()
    Switch $Msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button_1, $Button_2
            $NewData = "Wellcome!"
            If $Msg = $Button_2 Then $NewData = "Hello!"
            
            $Read_Edit = GUICtrlRead($Edit)
            If $Read_Edit <> "" Then $NewData = @CRLF & $NewData
            
            GUICtrlSetData($Edit, $Read_Edit & $NewData)
            GUICtrlSendMsg($Edit, 0xB7, 0, 0)
        Case $connect, $disconnect
            $NewData = "Connecting.."
            If $Msg = $disconnect Then $NewData = "Disconnected!"
            $ReadD_Edit = GUICtrlRead($Edit)
            If $Read_Edit <> "" Then $NewData = @CRLF & $NewData
            
        Case $botSettingsItem; <-- Add an exception for the menu item
            $Settings = 1;enable settings window loop
            _Bot()
        Case $aboutbox
            MsgBox(0, "About", "BaDBoT v1.2 By: Swift")
        Case $readme
            mywindow()
        Case $homepage
            Run(@ComSpec & " /c Start https://www.autoitscript.com/forum/index.php?showuser=30516", "", @SW_HIDE)
            Sleep(3500)
            Send("y")
    EndSwitch
WEnd


Func _Bot()

;;---Your Program below:
    $k = IniRead(@ScriptDir & "\Config.ini", "Config", "Account", "")
    $m = Iniread(@Scriptdir & "\config.ini", "config", "Password", "")
    $l = Iniread(@Scriptdir & "\config.ini", "config", "HomeChannel", "")
    $a = Iniread(@Scriptdir & "\config.ini", "config", "SetServer", "")
    $5 = iniread(@scriptdir & "\config.ini", "config", "WeBBoTSiTE", "")
    $keyz = iniread(@scriptdir & "\config.ini", "config", "CD-Key", "")



    $GUI = GUICreate($k & ", Online in channel Clan ByE", 390, 360, -1, -1)
    $Label_1 = GUICtrlCreateLabel("Account Name", 10, 5, 130, 15)
    Guictrlcreatelabel("WeBBoT WeBSiTE", 10, 170, 130, 15)
    $web = guictrlcreateinput($5, 10, 185, 100, 20)
    $Input_1 = GUICtrlCreateInput($k, 10, 20, 100, 20)
    $key = GUICtrlcreateinput($keyz, 10, 225, 100, 20)
    GUICtrlCreateLabel("Password", 10, 45, 130, 15)
    GUICtrlCreateLabel("Home Channel", 10, 85, 130, 15)
    GUICtrlCreateLabel("Server", 10, 125, 130, 15)
    Guictrlcreatelabel("CD-Key", 10, 210, 130, 15)
    $chan = GUICTRLCREATEINPUT($l, 10, 100, 100, 20)
    $pass = GUICtrlCreateInput($m, 10, 60, 100, 20)
    $server = GUICtrlCreateInput($a, 10, 140, 100, 20)
    $Button_3 = GUICtrlCreateButton("Disconnect", 115, 40, 70, 24)
    $Button_1 = GUICtrlCreateButton("&Connect", 120, 10, 60, 24)
    $Edit_1 = GUICtrlCreateEdit("", 190, 30, 150, 185, BitOR($ES_AUTOVSCROLL, $ES_READONLY))
    $Label_3 = GUICtrlCreateLabel("Battle.Net Info", 215, 10, 130, 15)
    $Button_4 = GUICtrlCreateButton("Save and Exit", 190, 221, 151)
    GUISetState(@SW_SHOW)
While $settings = 1;settings on
        $nMsg = GUIGetMsg()
        Select
            Case $nMsg = $Button_1
                GUICtrlSetData($Edit_1, "Connecting..." & @CRLF & "Connected!" & @CRLF & "[BNLS] Connecting..." & @CRLF & "[BNLS] Connected!" & @CRLF & "Sending Login Information..." & @CRLF & "Login Successful!")
            Case $nMsg = $GUI_EVENT_CLOSE
                GUIDelete($k & ", Online in channel Clan ByE");delete settings window
                $Settings = 0;turn off settings
            Case $nMsg = $Button_3
                GUIctrlsetdata($edit_1, "[BNET] Disconnected!")
            Case $nMsg = $Button_4
                $EDIT_READ = GUICtrlRead($Input_1)
                IniWrite(@ScriptDir & "\Config.ini", "Config", "Account", $EDIT_READ)
                Exit
            Case $nMsg = $pass
                $password = GUIctrlread($pass)
                Iniwrite(@Scriptdir & "\config.ini", "Config", "Password", $password)
                Exit
            Case $nMsg = $chan
                $homechan = Guictrlread($chan)
                iniwrite(@scriptdir & "\config.ini", "Config", "HomeChannel", $homechan)
            Case $nMsg = $server
                $servers = guictrlread($server)
                iniwrite(@scriptdir & "\config.ini", "config", "SetServer", $servers)
            Case $nMsg = $web
                $website = GUICtrlRead($web)
                iniwrite(@scriptdir & "\config.ini", "config", "WeBBoTSiTE", $website)
            Case $nMsg = $key
                $keys = GUIctrlread($key)
                iniwrite(@scriptdir & "\config.ini", "config", "CD-Key", $keys)
            Case $nMsg = $button_1
                Send("C")
            EndSelect
WEnd
EndFunc

Func mywindow()
    While 1
$moos = GUICreate("Readme And Command List", 250, 250)
GUISetState()
Select
    Case $GUI_EVENT_CLOSE
      GuiDelete($moos)
EndSelect
WEnd
EndFunc

--Thanks

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...