Code:
#include <GuiConstants.au3>
GuiCreate("LRET - Leoj's Realmlist Edit Tool", 392, 250,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
$Input_1 = GuiCtrlCreateInput("no server entered", 110, 80, 250, 20)
$Button_3 = GuiCtrlCreateButton("current", 290, 190, 80, 25)
;$Button_1 = GuiCtrlCreateButton("origional", 150, 190, 80, 25)
$Button_2 = GuiCtrlCreateButton("change", 30, 190, 80, 25)
GUICtrlSetState(-1, $GUI_FOCUS); the focus is on this button
$Group_3 = GuiCtrlCreateGroup("edit realmlist.wtf", 30, 16, 340, 92)
$Checkbox_4 = GuiCtrlCreateCheckbox("launch World of Warcraft", 40, 130, 250, 20)
$Checkbox_5 = GuiCtrlCreateCheckbox("display contents of realmlist.wtf", 40, 150, 250, 30)
$Group_6 = GuiCtrlCreateGroup("options", 30, 110, 340, 74)
$Combo_9 = GuiCtrlCreateList("us.logon.worldofwarcraft.com", 110, 35, 250, 60)
GUICtrlSetData(-1,"eu.logon.worldofwarcraft.com")
$Radio_10 = GuiCtrlCreateRadio("default:", 40, 45, 70, 20)
$Radio_11 = GuiCtrlCreateRadio("custom:", 40, 80, 70, 20)
GUICtrlSetState (-1,1)
;$Label_2 = GuiCtrlCreateLabel("Current Realm: " & $origchars, 30, 5, 220, 20)
;$Label_1 = GuiCtrlCreateLabel("for: [www.MMOwned.com] by: [Leoj]", 30, 5, 220, 20)
GUISetState () ; will display an dialog box with 2 button
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
;Case $msg = $Button_1
;$file5 = FileOpen("C:\\Program Files\World of Warcraft\realmlist.wtf", 0)
; Check if file opened for reading OK
;If $file5 = -1 Then
; MsgBox(0, "Error", "Unable to open your realmlist! Make sure WoW is installed to the default directory.")
; Exit
;EndIf
;While 1
; $ochars = FileRead($file5, 666)
; If @error = -1 Then ExitLoop
; MsgBox(0, "Realmlist Contents", $ochars)
;Wend
;FileClose($file5)
Case $msg = $Button_2
$file = FileOpen("C:\\Program Files\World of Warcraft\realmlist.wtf", 2)
; Check if file opened for writing OK
If $file = -1 Then
MsgBox(0, "Error", "Unable to open your realmlist! Make sure WoW is installed to the default directory.")
Exit
EndIf
If GUICtrlRead($Radio_10) = 1 Then
FileWrite($file, "set realmlist " & GUICtrlRead($Combo_9))
FileClose($file)
EndIf
If GUICtrlRead($Radio_11) = 1 Then
$custom = GUICtrlRead($Input_1)
$badstring = "no server entered"
If $custom = $badstring Then
FileWrite($file, "Please..." & @CRLF & "1. chose a default server." & @CRLF & "2. enter a valid server name.")
FileClose($file)
msgbox(0, "Error", "You have not entered a server.")
Else
FileWrite($file, "set realmlist " & $custom)
FileClose($file)
EndIf
EndIf
If GUICtrlRead($Checkbox_4) = 1 Then
Run("C:\\Program Files\World of Warcraft\WoW.exe", "")
EndIf
If GUICtrlRead($Checkbox_5) = 1 Then
$file3 = FileOpen("C:\\Program Files\World of Warcraft\realmlist.wtf", 0)
; Check if file opened for reading OK
If $file3 = -1 Then
MsgBox(0, "Error", "Unable to open your realmlist! Make sure WoW is installed to the default directory.")
Exit
EndIf
While 1
$chars = FileRead($file3, 666)
If @error = -1 Then ExitLoop
MsgBox(0, "Realmlist Contents", $chars)
Wend
FileClose($file3)
EndIf
Case $msg = $Button_3
$file3 = FileOpen("C:\\Program Files\World of Warcraft\realmlist.wtf", 0)
; Check if file opened for reading OK
If $file3 = -1 Then
MsgBox(0, "Error", "Unable to open your realmlist! Make sure WoW is installed to the default directory.")
Exit
EndIf
While 1
$chars = FileRead($file3, 666)
If @error = -1 Then ExitLoop
MsgBox(0, "Realmlist Contents", $chars)
Wend
FileClose($file3)
EndSelect
Wend
;msgbox(0, "CurrentR:", $origchars)
;msgbox(0, "Changed Realmlist to:", GUICtrlRead($Combo_9)) ; Will demonstrate Button 2 being pressed
;msgbox (0,"state",StringFormat("GUICtrlRead=%d\nGUICtrlGetState=%d",GUICtrlRead($Checkbox_4),GUICtrlGetState($Checkbox_4)))
Exit