Advertisement
EpicKnarvik97

My Program

Jul 26th, 2013
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 8.86 KB | None | 0 0
  1. #region ;**** Directives created by AutoIt3Wrapper_GUI ****
  2. #AutoIt3Wrapper_Icon=C:\Users\Kristian\Downloads\Minecraft Icon Version III.ico
  3. #AutoIt3Wrapper_Compression=4
  4. #endregion ;**** Directives created by AutoIt3Wrapper_GUI ****
  5.  
  6.  
  7.  
  8. #include <ButtonConstants.au3>
  9. #include <ComboConstants.au3>
  10. #include <GUIConstantsEx.au3>
  11. #include <GuiToolbar.au3>
  12. #include <StaticConstants.au3>
  13. #include <ToolbarConstants.au3>
  14. #include <WindowsConstants.au3>
  15. #include <GUIConstants.au3>
  16. #include <Misc.au3>
  17. #include <EditConstants.au3>
  18. #include <WindowsConstants.au3>
  19. #include <GuiComboBoxEx.au3>
  20. #include <TreeViewConstants.au3>
  21. #include <GuiTreeView.au3>
  22.  
  23.  
  24.  
  25. #region ### START Koda GUI section ### Form=c:\users\kristian\desktop\test.kxf
  26. $Test = GUICreate("KnarCraft Client", 945, 1003, 960, 0)
  27.  
  28. $Form1 = GUICreate("Form1", 945, 1003, 960, 0)
  29. $Button1 = GUICtrlCreateButton("Start Server", 24, 952, 75, 25)
  30. $Button2 = GUICtrlCreateButton("Stop Server", 840, 952, 75, 25)
  31. $Button3 = GUICtrlCreateButton("Kick", 112, 952, 75, 25)
  32. $Checkbox1 = GUICtrlCreateCheckbox("Hide Console", 24, 928, 97, 17)
  33. $Checkbox2 = GUICtrlCreateCheckbox("Old Version", 24, 904, 97, 17)
  34. $Command_Arguments = GUICtrlCreateInput("", 392, 952, 320, 21)
  35. $Button4 = GUICtrlCreateButton("Ban", 208, 952, 75, 25)
  36. $Button5 = GUICtrlCreateButton("OP", 304, 952, 75, 25)
  37. $Button6 = GUICtrlCreateButton("Custom Command", 728, 952, 91, 25)
  38. $Button7 = GUICtrlCreateButton("Save Server", 840, 920, 75, 25)
  39. $Label1 = GUICtrlCreateLabel("Choose Server Memory", 24, 848, 166, 20)
  40. GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
  41. $Combo1 = GUICtrlCreateCombo("-Xmx512M", 24, 872, 161, 25, $CBS_DROPDOWNLIST)
  42. GUICtrlSetData(-1, "-Xmx1024M|-Xmx2048M|-Xmx3072M|-Xmx4096M")
  43.  
  44. $TreeView1 = GUICtrlCreateTreeView(24, 24, 345, 730, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT), $WS_EX_CLIENTEDGE)
  45. $KnarCraft = GUICtrlCreateTreeViewItem("KnarCraft Server Information", $TreeView1)
  46. $OldKnarCraft = GUICtrlCreateTreeViewItem("Old KnarCraft", $TreeView1)
  47. $KnarWorld = GUICtrlCreateTreeViewItem("KnarWorldServer", $KnarCraft)
  48. GUICtrlCreateTreeViewItem("Commands", $KnarWorld)
  49. GUICtrlCreateTreeViewItem("Permissions", $KnarWorld)
  50. GUICtrlCreateTreeViewItem("Attractions", $KnarWorld)
  51. GUICtrlCreateTreeViewItem("KnarWorld", $OldKnarCraft)
  52.  
  53. $filemenu = GUICtrlCreateMenu("File")
  54. $fileitem = GUICtrlCreateMenuItem("Open...", $filemenu)
  55. $recentfilesmenu = GUICtrlCreateMenu("Recent Files", $filemenu)
  56. $separator1 = GUICtrlCreateMenuItem("", $filemenu)
  57. $exititem = GUICtrlCreateMenuItem("Exit", $filemenu)
  58. $helpmenu = GUICtrlCreateMenu("Help")
  59. $aboutitem = GUICtrlCreateMenuItem("About", $helpmenu)
  60. $tipsitem = GUICtrlCreateMenuItem("Tips", $helpmenu)
  61. $knarworlditem = GUICtrlCreateMenuItem("KnarWorld", $helpmenu)
  62.  
  63. GUISetState(@SW_SHOW)
  64. #endregion ### END Koda GUI section ###
  65.  
  66. ReadStats()
  67.  
  68. While 1
  69.     $chosen = GUICtrlRead($Combo1)
  70.     $args = GUICtrlRead($Command_Arguments)
  71.     $nMsg = GUIGetMsg()
  72.     If GUICtrlRead($Checkbox2) = 1 Then
  73.         $STATE = "CHECK"
  74.     Else
  75.         $STATE = "UNCHECK"
  76.     EndIf
  77.     If GUICtrlRead($Checkbox1) = 1 Then
  78.         $Hide = @SW_HIDE
  79.     Else
  80.         $Hide = @SW_SHOW
  81.     EndIf
  82.     Switch $nMsg
  83.         Case $GUI_EVENT_CLOSE
  84.             WriteStats()
  85.             Exit
  86.         Case $exititem
  87.             MsgBox(64, "KnarCraft", "KnarCraft client will now close")
  88.             WriteStats()
  89.             Exit
  90.         Case $Button1
  91.             Hub_func()
  92.         Case $Button3
  93.             If $STATE = "CHECK" Then
  94.                 Opt("WinTitleMatchMode", 3)
  95.                 $hwnd = WinGetHandle("C:\Windows\system32\java.exe")
  96.                 WinActivate($hwnd)
  97.                 ControlSend("C:\Windows\system32\java.exe", "", $hwnd, 'kick ')
  98.                 ControlSend("C:\Windows\system32\java.exe", "", $hwnd, $args)
  99.                 ControlSend("C:\Windows\system32\java.exe", "", $hwnd, '{ENTER}')
  100.             Else
  101.             EndIf
  102.         Case $Button4
  103.             If $STATE = "CHECK" Then
  104.                 Opt("WinTitleMatchMode", 3)
  105.                 $hwnd = WinGetHandle("C:\Windows\system32\java.exe")
  106.                 WinActivate($hwnd)
  107.                 ControlSend("C:\Windows\system32\java.exe", "", $hwnd, 'ban ')
  108.                 ControlSend("C:\Windows\system32\java.exe", "", $hwnd, $args)
  109.                 ControlSend("C:\Windows\system32\java.exe", "", $hwnd, '{ENTER}')
  110.             Else
  111.             EndIf
  112.         Case $Button5
  113.             If $STATE = "CHECK" Then
  114.                 Opt("WinTitleMatchMode", 3)
  115.                 $hwnd = WinGetHandle("C:\Windows\system32\java.exe")
  116.                 WinActivate($hwnd)
  117.                 ControlSend("C:\Windows\system32\java.exe", "", $hwnd, 'op ')
  118.                 ControlSend("C:\Windows\system32\java.exe", "", $hwnd, $args)
  119.                 ControlSend("C:\Windows\system32\java.exe", "", $hwnd, '{ENTER}')
  120.             EndIf
  121.         Case $Button7
  122.             If $STATE = "CHECK" Then
  123.                 Opt("WinTitleMatchMode", 3)
  124.                 $hwnd = WinGetHandle("C:\Windows\system32\java.exe")
  125.                 WinActivate($hwnd)
  126.                 ControlSend("C:\Windows\system32\java.exe", "", $hwnd, 'save-all {ENTER}')
  127.             EndIf
  128.         Case $Button6
  129.             If $STATE = "CHECK" Then
  130.                 Opt("WinTitleMatchMode", 3)
  131.                 $hwnd = WinGetHandle("C:\Windows\system32\java.exe")
  132.                 WinActivate($hwnd)
  133.                 ControlSend("C:\Windows\system32\java.exe", "", $hwnd, $args)
  134.                 ControlSend("C:\Windows\system32\java.exe", "", $hwnd, '{ENTER}')
  135.             Else
  136.             EndIf
  137.         Case $Button2
  138.             If $STATE = "CHECK" Then
  139.                 Opt("WinTitleMatchMode", 3)
  140.                 $hwnd = WinGetHandle("C:\Windows\system32\java.exe")
  141.                 ConsoleWrite("Window handle is " & $hwnd & @CRLF)
  142.                 WinActivate($hwnd)
  143.                 Send("stop {ENTER}")
  144.             Else
  145.                 Stop()
  146.             EndIf
  147.         Case $fileitem
  148.             $file = FileOpenDialog("Choose file...", @TempDir, "All (*.*)")
  149.             If @error <> 1 Then GUICtrlCreateMenuItem($file, $recentfilesmenu)
  150.         Case $aboutitem
  151.             MsgBox(0, "Server Client", "This is a client that lets you easily control the server")
  152.         Case $tipsitem
  153.             MsgBox(0, "Tips", "You can do lots with this client. Some basic tips: Check if you have the right configuration you want.")
  154.         Case $knarworlditem
  155.             MsgBox(0, "KnarWorld", "Knarworld is the original world from the original server. Here people have access to flymode, but can't interact with blocks except from in their hotel room.")
  156.         Case $KnarCraft
  157.             MsgBox(0, "KnarCraft", "KnarCraft is a collection of servers. Originally it was only a heavy server, but it was split when MineCraft 1.6.2 came out. Now it consists of one BungeeCord server and one Spigot server for each world from the old server.")
  158.         Case $OldKnarCraft
  159.             MsgBox(0, "Old KnarCraft", "Old KnarCraft is before the server got BungeeCord and was split in several pieces. Last version was when Minecraft was in 1.6.2. Some of the information here may not be relevant to the new system.")
  160.     EndSwitch
  161. WEnd
  162.  
  163.  
  164.  
  165.  
  166. Func WriteStats()
  167.     IniWrite("C:\Config.ini", "Checkbox", "Check1", GUICtrlRead($Checkbox1))
  168.     IniWrite("C:\Config.ini", "Checkbox", "Check2", GUICtrlRead($Checkbox2))
  169.     IniWrite("C:\Config.ini", "Combo", "Comb1", $chosen)
  170. EndFunc
  171.  
  172. Func ReadStats()
  173.     $Read1 = IniRead("C:\Config.ini", "Checkbox", "Check1", "1")
  174.     $Read2 = IniRead("C:\Config.ini", "Checkbox", "Check2", "1")
  175.     $Read3 = IniRead("C:\Config.ini", "Combo", "Comb1", StringSplit("-Xmx1024M|-Xmx2048M|-Xmx3072M|-Xmx4096M", "|"))
  176.     GUICtrlSetData($Combo1, IniRead("C:\Config.ini", "Combo", "Comb1", "-Xmx1024M|-Xmx2048M|-Xmx3072M|-Xmx4096M"))
  177.     If $Read1 = Int(1) = 1 Then
  178.         GUICtrlSetState($Checkbox1, $GUI_CHECKED)
  179.     Else
  180.         GUICtrlSetState($Checkbox1, $GUI_UNCHECKED)
  181.     EndIf
  182.     If $Read2 = Int(1) = 1 Then
  183.         GUICtrlSetState($Checkbox2, $GUI_CHECKED)
  184.     Else
  185.         GUICtrlSetState($Checkbox2, $GUI_UNCHECKED)
  186.     EndIf
  187. EndFunc
  188.  
  189. Func Hub_func()
  190.     If $STATE = "CHECK" Then
  191.         Run("java " & $chosen & ' -jar spigot-1.6.2-R0.1.jar', "E:\Spill\Alle spill\Minecraft\KnarCraft 2013", $Hide)
  192.     Else
  193.         Global $PID2 = Run("java " & $chosen & ' -jar "spigot-1.6.2-R0.1.jar"', "E:\Spill\Alle spill\Minecraft\Bungee Servers\Hub", $Hide)
  194.         WinWaitActive("C:\Windows\system32\java.exe")
  195.         WinSetTitle("C:\Windows\system32\java.exe","",$PID2)
  196.         Global $PID3 =Run("java " & $chosen & ' -jar "spigot-1.6.2-R0.1.jar"', "E:\Spill\Alle spill\Minecraft\Bungee Servers\Survival", $Hide)
  197.         WinWaitActive("C:\Windows\system32\java.exe")
  198.         WinSetTitle("C:\Windows\system32\java.exe","",$PID3)
  199.         Global $PID4 =Run("java " & $chosen & ' -jar "spigot-1.6.2-R0.1.jar"', "E:\Spill\Alle spill\Minecraft\Bungee Servers\KnarWorld", $Hide)
  200.         WinWaitActive("C:\Windows\system32\java.exe")
  201.         WinSetTitle("C:\Windows\system32\java.exe","",$PID4)
  202.         Global $PID5 =Run("java " & $chosen & ' -jar "spigot-1.6.2-R0.1.jar"', "E:\Spill\Alle spill\Minecraft\Bungee Servers\Plotworld", $Hide)
  203.         WinWaitActive("C:\Windows\system32\java.exe")
  204.         WinSetTitle("C:\Windows\system32\java.exe","",$PID5)
  205.         Global $PID1 =Run("java " & $chosen & ' -jar "BungeeCord.jar"', 'E:\Spill\Alle spill\Minecraft\bungee', $Hide)
  206.         WinWaitActive("C:\Windows\system32\java.exe")
  207.         WinSetTitle("C:\Windows\system32\java.exe","",$PID1)
  208.     EndIf
  209. EndFunc
  210.  
  211. Func Stop()
  212.     WinActivate($PID1)
  213.     Send("end {ENTER}")
  214.     WinActivate($PID2)
  215.     Send("stop{ENTER}")
  216.     WinActivate($PID3)
  217.     Send("stop{ENTER}")
  218.     WinActivate($PID4)
  219.     Send("stop{ENTER}")
  220.     WinActivate($PID5)
  221.     Send("stop{ENTER}")
  222. EndFunc   ;==>Stop
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement