Spoiler anzeigen
#NoTrayIcon
[/autoit] [autoit][/autoit] [autoit]; ================================;
; Bukkit Server Manager
; Made by Kazu
; © 2011 Kazu Mikura
; ================================;
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <File.au3>
$hFile = FileOpen("server.log")
$Process = 0
#Region ### START Koda GUI section ### Form=d:\autoit\bukkit server manager\gui.kxf
$GUI = GUICreate("Bukkit Server Manager", 684, 405, 192, 124)
$OVERVIEW= GUICtrlCreateEdit("", 8, 48, 665, 305)
$START = GUICtrlCreateButton("Start", 8, 8, 81, 25, $WS_GROUP)
$STOP = GUICtrlCreateButton("Stop", 104, 8, 81, 25, $WS_GROUP)
$RESTART = GUICtrlCreateButton("Restart", 200, 8, 81, 25, $WS_GROUP)
$SAVEALL = GUICtrlCreateButton("Save-All", 296, 8, 81, 25, $WS_GROUP)
$RELOAD = GUICtrlCreateButton("Reload", 392, 8, 81, 25, $WS_GROUP)
$INPUT = GUICtrlCreateInput("", 8, 368, 665, 21)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $START
;~ $Process = Run("craftbukkit-0.0.1-SNAPSHOT.jar", "", default,0x3 )
$Process = Run(@ProgramFilesDir&'\Java\jre6\bin\java.exe -Xms1024M -Xmx1024M -jar craftbukkit-0.0.1-SNAPSHOT.jar ', '', '', 0x9)
Case $STOP
StdinWrite ( $Process, "stop" )
Case $RESTART
Case $SAVEALL
StdinWrite ( $Process, "save-all" )
Case $RELOAD
StdinWrite ( $Process, "reload" )
EndSwitch
If ProcessExists( $Process) Then
Do
$data = StdoutRead($Process)
If $data <> "" Then
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $data = ' & $data & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
FileWrite($hFile, $data&@CRLF)
EndIf
Until @error <> 0
EndIf
WEnd
Einen Error erhalte ich nicht, zumindest keinen sichtbaren.
Jedoch kann ich den Servermanager erst beenden, wenn ich den Prozess beendet habe.
Die Funktionen für stop, reload und save-all funktionieren jedoch nicht.