Sign in to follow this  
Followers 0
Rad

Run() doesnt work like Start>Run

7 posts in this topic

#1 ·  Posted (edited)

Im making a server launcher for a game, except if i launch the game or the server with Run("C:\ ...") the game closes shortly after it opens, and the server doesnt load the file "default.cfg" (which is in the same dir as the server)

The server is a dos program which I need to launch with parameters such as -l 50 and -r Password

I tried ShellExecute() and it does the same thing

However, if I go to start > run > and type in the same directory as in Run() it works =|

I either need a suggestion as to why this is happening, or a way to simulate the Start>Run without being totally noticeable (I have it right now where it clicks start, then run, types it in and sends it, but it looks so lame)

I also tried Run("cmd") which opens the DOS window, but then the dir is my documents and i dont know how to use it (I never used dos before)

EDIT~When I was typing this I thought of trying to run it in the same directory as the server, and the server worked. Is there a way to make it work without requiring it to be in the same directory? Or would this be part of the actual game security?

Edited by Rad

Share this post


Link to post
Share on other sites



You may have to excuse me as I really tired but I'm trying to get into helping people on here instead of being the one getting help so here it goes...

Whats your autoit run command? It sounds like you could just get away with a dos .bat file instead of an autoit script. Whether or not depends on if you only need to launch the program with arguments or if you need to do more...

I almost thought someone said that the start - run command can also pull things off the registry... for instance where I work uses novell and if you type nalwin32 it launches something that is buried in c:/program files. I might be wrong but at least it might be an explanation.

Why can't you use FileChangeDir (or whatever it is)? When you say you ran it in the same directory as the server what do you mean?

Andrew


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

From the help file

Remarks

To run DOS (console) commands, try Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE)



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

"someone" is correct. You need to set @WorkingDir to the game's directory, either by

setting it in the second parameter in Run or by using the suggested FileChangeDir.

Share this post


Link to post
Share on other sites

Oh ok thanks a bunch guys the working directory thing worked fine =)

Didnt really understand what 'someone' meant (you need to change your name ;))

Also bigdod, ive seen that a few times but I never even thought of using it :lmao:

Works great =)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Ok, now that works... I want to run the GAME with some parameters. It seems easy enough, but I dont know how to put it as parameters... Heres the instructions:

Start Game with the command prompt:

Start, run, cmd, cd "C:\Program Files\Game", Game.exe GameMod.etx

This runs "Game.exe" with a file inside that directory called "Gamemod.etx". I tried several combinations but none seem to apply the mod...

EDIT: After testing the instructions it didnt work, so I changed it to this and it did... But still no luck using it with au3:

Start, run, "C:\Program Files\Game\Game.exe" "GameMod.etx"

Heres what I was trying:

ShellExecute($Directory & "\game.exe", "GameMod.etx", $directory) (Directory is "C:\Program Files\Games")

EDIT~Actually the server parameters dont work either ><! It starts up just fine it just TOTALLY IGNORES all my parameters ;)

-p 20190 -m 120 -t 10 -r 20 -f 6 -e 100 -j 0 -C 12 -T 5 -N "Default Server Name"

They work if I put them into Run... with the directory & name in front in quotes, though...

Edited by Rad

Share this post


Link to post
Share on other sites

Sorry about another post but this is a pretty important update for this...

I found a way where I just create a temporary shortcut with the target parameters which works fine, but if I use

Run($Directory & "\temp_server.lnk") (which is where I created the shortcut)

It says it cannot execute external program...

But if I manually open it it works fine

If I use ShellExecute then it seems to work, except it doesnt appear... it doesnt crash either though =|

I really am not liking how difficult these parameters are to set up ;)

Share this post


Link to post
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
Sign in to follow this  
Followers 0