Simple Openkore manager
Posted: 06 Oct 2014, 01:38
Place it same folder as start.exe. It will detect every folder with config.txt
I create this simple manager (with Autoit) to manage my bot folder, but i haven't test for other window except windowXP
so i include my source code here so everyone can improve it.
so not sure why i got this "Could not upload attachment to ./files/153_9776a32dcf40847dd05b1c3c9feef33b."
so i upload it here.
here is the virustotalresult, i admit there is some positive here but it just false positive, some of anti-virus detected autoit is one of virus.
you all can view it here.
so for whom not trust my .exe, u may install autoit to your pc and compile it yourself.
P/s: need some feedback to improve this. ty.
[edited]
i forgot you can getRecFileListToArray.au3 from here
here the sourcecode :
Code: Select all
#NoTrayIcon
#RequireAdmin
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Icon=src\build\openkore.ico
#AutoIt3Wrapper_Outfile=OpenKore Manager.exe
#AutoIt3Wrapper_Res_Description=Manage Openkore folder
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#include <GUIListBox.au3>
#include <GuiStatusBar.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <array.au3>
#include <Misc.au3>
#include <WinAPI.au3>
#include <RecFileListToArray.au3>
Global $aReturnList[1] = [0]
Opt("TrayMenuMode", 3)
$trayExit = TrayCreateItem("Exit")
TraySetIcon(@ScriptDir & "\src\build\openkore.ico", -1)
If _Singleton("OPKRMGRv3", 1) = 0 Then
MsgBox(16, "Openkore Manager", "Error: Launcher is already running!")
Exit
EndIf
If Not FileExists(@ScriptDir & "\OpenKore.exe") And Not FileExists(@ScriptDir & "\start.exe") Then
MsgBox(16, "ERROR!", "Please run inside OpenKore folder!", 10)
Exit
ElseIf FileExists(@ScriptDir & "\OpenKore.exe") Then
$bot = @ScriptDir & "\OpenKore.exe"
$exe = "OpenKore.exe"
ElseIf FileExists(@ScriptDir & "\start.exe") Then
$bot = @ScriptDir & "\start.exe"
$exe = "start.exe"
EndIf
#Region ### START Koda GUI section ###
$OpenKoreMGR = GUICreate("OpenKore Manager", 594, 253, -1, -1)
GUISetIcon(@ScriptDir & "\src\build\openkore.ico", -1)
GUISetFont(8, 400, 0, "Courier")
$List = GUICtrlCreateList("", 0, 0, 593, 162)
GUICtrlSetFont(-1, 11, 400, 0, "Tahoma")
$aFolderList = _RecFileListToArray(@ScriptDir, "*|*.svn-base", 0, 1, 0, 2)
For $x = 1 To $aFolderList[0]
If StringInStr($aFolderList[$x], '\config.txt') Then
$folderName = StringRegExpReplace($aFolderList[$x], '\\[^\\]*$', '')
$folderName = StringRegExpReplace($folderName, '.*\\', '')
$setList = StringSplit($aFolderList[$x], '\config.txt', $STR_ENTIRESPLIT)[1]
$setList = StringSplit($setList, @ScriptDir & "\", $STR_ENTIRESPLIT)[2]
GUICtrlSetData($List, $setList)
_GUICtrlListBox_SetSel($List, $setList - 1)
EndIf
Next
$statusBar = _GUICtrlStatusBar_Create($OpenKoreMGR)
Dim $statusBar_PartsWidth[1] = [-1]
_GUICtrlStatusBar_SetParts($statusBar, $statusBar_PartsWidth)
_GUICtrlStatusBar_SetText($statusBar, "Config: ", 0)
$start = GUICtrlCreateButton("Start Bot!", 8, 168, 91, 25)
$close = GUICtrlCreateButton("Close All", 104, 168, 91, 25)
$Label1 = GUICtrlCreateLabel("Edit setting: ", 208, 171, 116, 17, $SS_CENTERIMAGE)
$edittxt = GUICtrlCreateButton("Open setting", 480, 168, 107, 21, BitOR($BS_CENTER,$BS_VCENTER))
$Combo = GUICtrlCreateCombo("", 328, 168, 145, 25, BitOR($CBS_DROPDOWNLIST,$CBS_AUTOHSCROLL))
GUICtrlSetData(-1, "arrowcraft.txt|avoid.txt|chat_resp.txt|config.txt|consolecolors.txt|items_control.txt|macros.txt|mon_control.txt|overallAuth.txt|pickupitems.txt|poseidon.txt|priority.txt|responses.txt|routeweights.txt|shop.txt|sys.txt|timeouts.txt")
GUICtrlSetFont(-1, 8, 400, 0, "Verdana")
TraySetState(2) ;hide
GUISetState(@SW_SHOW, $OpenKoreMGR)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $GUI_EVENT_MINIMIZE
GUISetState(@SW_HIDE, $OpenKoreMGR)
TraySetState(1) ;show
Case $start
$folder = GUICtrlRead($List)
If $folder = "" Then
ConsoleWrite("Please select one from list..." & @CRLF)
_GUICtrlStatusBar_SetText($statusBar, "Config: " & "Please select one from list...", 0)
Else
$param = "--control=" & '"' & $folder & '"'
$launch = ShellExecute($bot, $param);Run($start & $param, "", @SW_SHOW)
ConsoleWrite("Start Openkore " & $param & @CRLF)
_GUICtrlStatusBar_SetText($statusBar, "Config: " & $folder, 0)
EndIf
Case $close
$getplist = ProcessList($exe)
If Not ProcessExists($exe) Then _GUICtrlStatusBar_SetText($statusBar, "Config: " & "Cant find any " & $exe & " in ProcessList.", 0)
For $i = 1 To $getplist[0][0]
ProcessClose($getplist[$i][1])
ConsoleWrite("Close bot - PID : " & $getplist[$i][1] & @CRLF)
Next
Do
ProcessClose($exe)
Until Not ProcessExists($exe)
Case $edittxt
$rCombo = GUICtrlRead($Combo)
If GUICtrlRead($List) = "" Then
ConsoleWrite("Please select one from list..." & @CRLF)
_GUICtrlStatusBar_SetText($statusBar, "Config: " & "Please select one from list...", 0)
ElseIf $rCombo = "" Then
$warnOpen = MsgBox(4, "Openkore Manager", "Do you open this folder?")
If $warnOpen = 6 Then ShellExecute(@ScriptDir & "/" & GUICtrlRead($List))
Else
$edit = ShellExecute(@ScriptDir & "/" & GUICtrlRead($List) & "/" & $rCombo)
EndIf
EndSwitch
$tMsg = TrayGetMsg()
Switch $tMsg
Case $TRAY_EVENT_PRIMARYDOUBLE
GUISetState(@SW_SHOW, $OpenKoreMGR)
TraySetState(2)
Case $trayExit
Exit
EndSwitch
WEnd