how to run a external program?
how to run a external program?
like title, how do i run a cmdline program from the bot?
Re: how to run a external program?
You can use system(cmd) or os.execute(cmd) like I did in my "login" script. http://www.solarstrike.net/phpBB3/viewt ... gin#p48107 You can check that out to see how I used os.execute to start the game client.
- Please consider making a small donation to me to support my continued contributions to the bot and this forum. Thank you. Donate
- I check all posts before reading PMs. So if you want a fast reply, don't PM me but post a topic instead. PM me for private or personal topics only.
- How to: copy and paste in micromacro
________________________
Quote:- “They say hard work never hurt anybody, but I figure, why take the chance.”
- Ronald Reagan
Re: how to run a external program?
Code: Select all
function MemClean(sleeptime)
if sleeptime == nil or sleeptime == "" then sleeptime = 5000 end
os.execute("start 'ramrush.exe' -AutoOptimize")
yrest(sleeptime)
os.execute("TASKKILL /IM ramrush.exe /F")
end
Re: how to run a external program?
Notice in Rock's example he uses getExecutionPath().
from rombot the getExecutionPath() is the rom folder, you can test from commandline.
if you add that print to your userfunction you can find out for sure where it is looking for the file to start.
Code: Select all
client = string.lower(client)
local path = getExecutionPath().."/"..client
-- fix spaces
path = string.gsub(path," ","\" \"")
local a,b,c = os.execute("START "..path.." NoCheckVersion")
if not a then
error("Trouble executing shortcut. Values returned were: "..(a or "nil")..", "..(b or "nil")..", "..(c or "nil"))
end
Code: Select all
Command> print(getExecutionPath())
C:/micromacro/scripts/rom
Remember no matter you do in life to always have a little fun while you are at it
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
wiki here http://www.solarstrike.net/wiki/index.php?title=Manual
Re: how to run a external program?
thanx lisa, that did the trick ^^
Code: Select all
function MemClean(sleeptime)
if sleeptime == nil or sleeptime == "" then sleeptime = 50000 end
os.execute("start "..getExecutionPath().."/ramrush.exe -AutoOptimize")
yrest(sleeptime)
os.execute("TASKKILL /IM ramrush.exe /F")
end
Who is online
Users browsing this forum: No registered users and 6 guests