Jump to content

Could use alitle help with this one


Recommended Posts

I run a game server which involes starting about 12 links...i am using autoit to make life much easier when it needs to be restarted.

but the problem i have is some of my .exe must be lauched with parameters.like F:\Muserver\ExDB\ExDB.exe 192.168.1.3 if i run that from windows run command it starts fine also starts fine from my short cut,,,but for the life of me i cant get it to run with the run command .

i will give source here

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <GuiStatusBar.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=f:\koda_1.7.2.0\forms\server.kxf
$Form1_1 = GUICreate("Form1", 633, 447, 195, 124)
GUISetFont(12, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("Start", 488, 352, 121, 41, $WS_GROUP)
$Progress1 = GUICtrlCreateProgress(480, 312, 129, 17)
$StatusBar1 = _GUICtrlStatusBar_Create($Form1_1)
$Ipadd = GUICtrlCreateLabel("Ipadd", 0, 16, 45, 24)
$Button2 = GUICtrlCreateButton("Save", 344, 352, 113, 41, $WS_GROUP)
$CS = GUICtrlCreateLabel("CS IP", 240, 16, 45, 24)
$Input1 = GUICtrlCreateInput(IniRead("test4.ini", "test", "IP", ""), 56, 16, 121, 28)
$Input2 = GUICtrlCreateInput(IniRead("test4.ini", "test", "IP2", ""), 296, 16, 121, 28)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Call("Stop")
            Exit
        Case $Button2
            Call("Info")
        Case $Button1
            Call ("Start")


    EndSwitch
WEnd

Func Start()
    If ProcessExists("SCFExDB.exe") Then
    MsgBox(0, "Running", "SCFExDB Already running")
Else
    Run( "SCFExDB\SCFExDB.exe")
    WinWaitActive("SCFExDB Port: 55962 - Ver 1.03.00 JAN 27 2010")
    WinSetState("SCFExDB Port: 55962 - Ver 1.03.00 JAN 27 2010", "", @SW_HIDE)
    ProgressOn("Progress Meter", "Server is Starting Please Wait", "0")
    ProgressSet(10)
EndIf
    If ProcessExists("cs.exe") Then
        MsgBox(0, "Running", "Connect Server Already Running")
    Else
        Run("connectserver\cs.exe")
        WinWaitActive("MU Connect Server © 2007-2009 S@nek[BoR]")
        WinSetState("MU Connect Server © 2007-2009 S@nek[BoR]", "", @SW_HIDE)
        ProgressSet(20)
EndIf
        If ProcessExists("ExDB.exe") Then
            MsgBox(0, "Running", "EX DB Already Running")
        Else
            Run("ExDB\ExDB.exe 192.168.1.3" )
            ProgressSet(30)




EndIf
EndFunc

Func Info()

    $TextFileName = "hosts"
$FindText = IniRead("test4.ini", "test", "IP", "")
$ReplaceText = GUICtrlRead($Input1)

$FileContents = FileRead($TextFileName)
$FileContents = StringReplace($FileContents,$FindText,$ReplaceText)
FileDelete($TextFileName)
FileWrite($TextFileName,$FileContents)
$TextFileName = "hosts"
$FindText = IniRead("test4.ini", "test", "IP2", "")
$ReplaceText = GUICtrlRead($Input2)

$FileContents = FileRead($TextFileName)
$FileContents = StringReplace($FileContents,$FindText,$ReplaceText)
FileDelete($TextFileName)
FileWrite($TextFileName,$FileContents)
IniWrite("test4.ini", "test", "IP" , GUICtrlRead($Input1))
IniWrite("test4.ini", "test", "IP2" , GUICtrlRead($Input2))


    EndFunc
Func Stop()
    ProcessClose("SCFExDB.exe")
    ProcessClose("cs.exe")
    ProcessClose("ExDB.exe")
    EndFunc

problem lies here Run("ExDB\ExDB.exe 192.168.1.3" ) it runs but doesnt see the ini files thats in the same folder it lies in

Link to comment
Share on other sites

Did you try to start with ShellExecute?

Only for more info ShellExecute can start .exe and .lnk files (lnk = short cut)

Im not shure about this (dont use run alot so i dont know if itl help) did you try to enter second parametar to run comand?

TCP server and client - Learning about TCP servers and clients connection
Au3 oIrrlicht - Irrlicht project
Au3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related)



460px-Thief-4-temp-banner.jpg
There are those that believe that the perfect heist lies in the preparation.
Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost.

 
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...