the_lord_mephy Posted November 18, 2004 Posted November 18, 2004 Here's my code:expandcollapse popup#include "GUIConstants.au3" #region viewer info $ver = "1.0" #endregion $winwidth = @DesktopWidth - 4 $winheight = @DesktopHeight - 70 $es = BitOr($WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY) $win = GUICreate("PindleGod Viewer v"& $ver, $winwidth, $winheight, 1, 1) $edit = GUICtrlCreateEdit("", 1, 1, $winwidth / 2, $winheight - 25, $es) $start = GuiCtrlCreateMenu("&Start") $newrun = GuiCtrlCreateMenuItem("&New &Run", $start) $restart = GuiCtrlCreateMenuItem("&Restart", $start) $end = GuiCtrlCreateMenu("&End") $crun = GUICtrlCreateMenuitem("&Current &Run", $end) $pindl = GUICtrlCreateMenuitem("&PindleGod", $end) $group1 = GuiCtrlCreateGroup("Information", $winwidth / 2 + 5, 1, $winwidth / 2 - 10, $winheight / 2) $group2 = GuiCtrlCreateGroup("Status", $winwidth / 2 + 5, $winheight / 2 + 5, $winwidth / 2 - 10, $winheight / 2 - 30) #region Information $editconfig = GuiCtrlCreateButton("Edit Config.ini", $winwidth / 2 + 90, 200, 90, 20) GuiCtrlCreateLabel("Account name: ", $winwidth / 2 + 10, 20, 75, 20) $accountinput = GUICtrlCreateInput("Loading...", $winwidth / 2 + 90, 20, 90, 20) GuiCtrlSetState($accountinput, $GUI_DISABLE) $editaccount = GuiCtrlCreateButton("Edit", $winwidth / 2 + 185, 20, 70, 20) GuiCtrlCreateLabel("Password: ", $winwidth / 2 + 10, 50, 75, 20) $passwordinput = GuiCtrlCreateInput("Loading...", $winwidth / 2 + 90, 50, 90, 20) GuiCtrlSetState($passwordinput, $GUI_DISABLE) $editpassword = GuiCtrlCreateButton("Edit", $winwidth / 2 + 185, 50, 70, 20) GuiCtrlCreateLabel("CD Key: ", $winwidth / 2 + 10, 80, 75, 20) $cdkeyinput = GuiCtrlCreateInput("Loading...", $winwidth / 2 + 90, 80, 90, 20) GuiCtrlSetState($cdkeyinput, $GUI_DISABLE) $editcdkey = GuiCtrlCreateButton("Edit", $winwidth / 2 + 185, 80, 70, 20) GuiCtrlCreateLabel("Games: ", $winwidth / 2 + 10, 110, 75, 20) $numberofgamesinput = GuiCtrlCreateInput("Loading...", $winwidth / 2 + 90, 110, 90, 20) GuiCtrlSetState($numberofgamesinput, $GUI_DISABLE) $editnumberofgames = GuiCtrlCreateButton("Edit", $winwidth / 2 + 185, 110, 70, 20) GuiCtrlCreateLabel("Char Type: ", $winwidth / 2 + 10, 140, 75, 20) $charactertypeinput = GuiCtrlCreateInput("Loading...", $winwidth / 2 + 90, 140, 90, 20) GuiCtrlSetState($charactertypeinput, $GUI_DISABLE) $editcharactertype = GuiCtrlCreateButton("Edit", $winwidth / 2 + 185, 140, 70, 20) GuiCtrlCreateLabel("Teleport: ", $winwidth / 2 + 10, 170, 75, 20) $teleportyes = GuiCtrlCreateRadio("Yes", $winwidth / 2 + 90, 170, 50, 20) GuiCtrlSetState($teleportyes, $GUI_DISABLE) $teleportno = GuiCtrlCreateRadio("No", $winwidth / 2 + 145, 170, 35, 20) GuiCtrlSetState($teleportno, $GUI_DISABLE) $editteleport = GuiCtrlCreateButton("Edit", $winwidth / 2 + 185, 170, 70, 20) #endregion $teleport = IniRead("Config.ini", "Information", "teleport", "") If $teleport = "1" Then GuiCtrlSetState($teleportyes, $GUI_CHECKED) GuiCtrlSetState($teleportno, $GUI_UNCHECKED) Else GuiCtrlSetState($teleportyes, $GUI_UNCHECKED) GuiCtrlSetState($teleportno, $GUI_CHECKED) EndIf GuiSetState() _EditAppendText($edit, "PindleGod viewer v" & $ver & " started.") _EditAppendText($edit, "Welcome to PindleGod©'s Viewer!") _EditAppendText($edit, "If you find any bugs, please report them to pindlegod@yahoo.com") While 1 $account = IniRead("Config.ini", "Information", "Username", "Null") GuiCtrlSetData($accountinput, $account, 1) $password = IniRead("Config.ini", "Information", "Password", "Null") GuiCtrlSetData($passwordinput, $password, 1) $cdkey = IniRead("Config.ini", "Information", "CDKey", "Null") GuiCtrlSetData($cdkeyinput, $cdkey, 1) $numberofgames = IniRead("Config.ini", "Information", "NumberofGames", "Null") GuiCtrlSetData($numberofgamesinput, $numberofgames, 1) $charactertype = IniRead("Config.ini", "Information", "CharacterType", "Null") GuiCtrlSetData($charactertypeinput, $charactertype, 1) $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $newrun _EditAppendText($edit, "Current Run ended") _EditAppendText($edit, "Waiting for 3 seconds to create new game due to flood control.") Sleep(3000) _EditAppendText($edit, "New Run began") Case $msg = $crun _EditAppendText($edit, "Current Run Ended") Case $msg = $restart $confirm = Msgbox(4, "Confirm", "Are you sure you wish to restart PindleGod? (If you are in the middle of a run, it will be canceled)") If $confirm = 6 Then If FileExists("restart.exe") Then Run(@ScriptDir & "\restart.exe") Exit Else $errorabort = MsgBox(4, "Error", "Unable to find necessary file(s). Would you like to abort PindleGod?") If $errorabort = 6 Then Exit EndIf EndIf EndIf Case $msg = $editconfig Run('notepad.exe "' & @ScriptDir & '\Config.ini"') Case $msg = $editteleport GuiCtrlSetState($teleportyes, $GUI_ENABLE) GuiCtrlSetState($teleportno, $GUI_ENABLE) GuiCtrlSetState($editteleport, $GUI_DISABLE) $newteleport = GuiCtrlCreateButton("Save", $winwidth / 2 + 255, 170, 50, 20) Do $msg = GUIGetMsg() Until $msg = $newteleport If (GuiRead($teleportyes) = $GUI_CHECKED) and (GuiRead($teleportno) = $GUI_UNCHECKED) Then $newteleportname = "1" ElseIf (GuiRead($teleportno) = $GUI_CHECKED) and (GuiRead($teleportyes = $GUI_UNCHECKED)) Then $newteleportname = "0" Else $newteleportname = "0" EndIf IniWrite("Config.ini", "Information", "Teleport", $newteleportname) GuiCtrlDelete($newteleport) GuiCtrlSetState($teleportyes, $GUI_DISABLE) GuiCtrlSetState($teleportno, $GUI_DISABLE) GuiCtrlSetState($editteleport, $GUI_ENABLE) Case $msg = $editaccount GuiCtrlSetState($accountinput, $GUI_ENABLE) GuiCtrlSetState($editaccount, $GUI_DISABLE) $newaccount = GuiCtrlCreateButton("Save", $winwidth / 2 + 255, 20, 50, 20) Do $msg = GUIGetMsg() Until $msg = $newaccount $newaccountname = GUIRead($accountinput) IniWrite("Config.ini", "Information", "Username", $newaccountname) GuiCtrlDelete($newaccount) GuiCtrlSetState($editaccount, $GUI_ENABLE) GuiCtrlSetState($accountinput, $GUI_DISABLE) Case $msg = $editpassword GuiCtrlSetState($passwordinput, $GUI_ENABLE) GuiCtrlSetState($editpassword, $GUI_DISABLE) $newpassword = GuiCtrlCreateButton("Save", $winwidth / 2 + 255, 50, 50, 20) Do $msg = GUIGetMsg() Until $msg = $newpassword $newpasswordname = GUIRead($passwordinput) IniWrite("Config.ini", "Information", "Password", $newpasswordname) GuiCtrlDelete($newpassword) GuiCtrlSetState($editpassword, $GUI_ENABLE) GuiCtrlSetState($passwordinput, $GUI_DISABLE) Case $msg = $editcdkey MsgBox(0, "CD Key", "Your CD key is not necessary. It is just used incase Diablo II crashes. If CD key is not available, set the value to -1.") GuiCtrlSetState($cdkeyinput, $GUI_ENABLE) GuiCtrlSetState($editcdkey, $GUI_DISABLE) $newcdkey = GuiCtrlCreateButton("Save", $winwidth / 2 + 255, 80, 50, 20) Do $msg = GUIGetMsg() Until $msg = $newcdkey $newcdkeyname = GUIRead($cdkeyinput) IniWrite("Config.ini", "Information", "CDKey", $newcdkeyname) GuiCtrlDelete($newcdkey) GuiCtrlSetState($editcdkey, $GUI_ENABLE) GuiCtrlSetState($cdkeyinput, $GUI_DISABLE) Case $msg = $editnumberofgames GuiCtrlSetState($numberofgamesinput, $GUI_ENABLE) GuiCtrlSetState($editnumberofgames, $GUI_DISABLE) $newnumberofgames = GuiCtrlCreateButton("Save", $winwidth / 2 + 255, 110, 50, 20) Do $msg = GUIGetMsg() Until $msg = $newnumberofgames $newnumberofgamesname = GUIRead($numberofgamesinput) IniWrite("Config.ini", "Information", "NumberofGames", $newnumberofgamesname) GuiCtrlDelete($newnumberofgames) GuiCtrlSetState($editnumberofgames, $GUI_ENABLE) GuiCtrlSetState($numberofgamesinput, $GUI_DISABLE) Case $msg = $editcharactertype MsgBox(0, "Edit", "Please only enter the first three letters of your character type:" &@CRLF & "Sor, Bar, Nec, Pal, Ass, Dru, Ama") GuiCtrlSetState($charactertypeinput, $GUI_ENABLE) GuiCtrlSetState($editcharactertype, $GUI_DISABLE) $newcharactertype = GuiCtrlCreateButton("Save", $winwidth / 2 + 255, 140, 50, 20) Do $msg = GUIGetMsg() Until $msg = $newcharactertype If StringLen(GUIRead($charactertypeinput)) <> 3 and not (String(GUIRead($charactertypeinput)) = "") Then MsgBox(0, "Error", "You entered an invalid character type (please make sure you entered only the first three letters of the character type)") GuiCtrlSetData($charactertypeinput, IniRead("Config.ini", "Information", "CharacterType", "")) EndIf $newcharactertypename = GUIRead($charactertypeinput) IniWrite("Config.ini", "Information", "CharacterType", $newcharactertypename) GuiCtrlDelete($newcharactertype) GuiCtrlSetState($editcharactertype, $GUI_ENABLE) GuiCtrlSetState($charactertypeinput, $GUI_DISABLE) Case $msg = $pindl $confirmexit = MsgBox(4, "Confirm", "Are you sure you would like to exit PindleGod viewer?") If $confirmexit = 6 Then Exit EndIf EndSelect WEnd Func _EditAppendText($editname, $data) GuiCtrlSetData($editname, "[" & @HOUR & ":" & @MIN & ":" & @SEC & "]: " & $data & @CRLF, 0) EndFuncWhat I want is for it to check the Config.ini file to see if Teleport = 1 or 0 and to set the radio buttons depending on the result. Is there any way that you know I can do this? I tried:$teleport = IniRead("Config.ini", "Information", "teleport", "") If $teleport = "1" Then GuiCtrlSetState($teleportyes, $GUI_CHECKED) GuiCtrlSetState($teleportno, $GUI_UNCHECKED) Else GuiCtrlSetState($teleportyes, $GUI_UNCHECKED) GuiCtrlSetState($teleportno, $GUI_CHECKED) EndIfI tried that Inside and out side of the loop and when it was inside the loop it would check it every like 1/2 second and uncheck it off immediately after. My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Developers Jos Posted November 18, 2004 Developers Posted November 18, 2004 (edited) just do a "Checked" for the Radio button needed, since the other will auto uncheck.. Like: $teleport = IniRead("Config.ini", "Information", "teleport", "") If $teleport = "1" Then GuiCtrlSetState($teleportyes, $GUI_CHECKED) Else GuiCtrlSetState($teleportno, $GUI_CHECKED) EndIf Edited November 18, 2004 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
the_lord_mephy Posted November 18, 2004 Author Posted November 18, 2004 Thanks JdeB My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
layer Posted November 18, 2004 Posted November 18, 2004 Also, isn't the #include "GUIConstants.au3" supposed to be #include <GUIConstants.au3>? FootbaG
Holger Posted November 19, 2004 Posted November 19, 2004 @layer: please take a look in the helpfile under "Keyword/Statement Reference" and then "#include". In the "Parameters" table it is better discribed :-) Regards Holger Old project:GUI/Tray menu with icons and colors Other old stuff:IconFileScanner, TriState/ThreeState GUI TreeView, GUI ContextMenu created out of a TreeView
the_lord_mephy Posted November 20, 2004 Author Posted November 20, 2004 I usually do <GUIConstants.au3> Idk why I used "'s this time lol what ever =-o My site for HTML Help :)[quote name='Valik' date='Oct 15 2004, 12:29 PM']Maybe nobody is an "elite uber-coder" like me because thinking is a capital offense in today's online-world?[right][snapback]36427[/snapback][/right][/quote]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now