Execute() not available in micromacro?

Discuss, ask for help, share ideas, give suggestions, read tutorials, and tell us about bugs you have found with MicroMacro in here.

Do not post RoM-Bot stuff here. There is a subforum for that.
Forum rules
This is a sub-forum for things specific to MicroMacro.

This is not the place to ask questions about the RoM bot, which uses MicroMacro. There is a difference.
Post Reply
Message
Author
Sgraffite
Posts: 38
Joined: Wed Jul 09, 2008 12:03 pm

Execute() not available in micromacro?

#1 Post by Sgraffite » Sat Apr 24, 2010 12:32 pm

I'd like to make a script that can run an executable, attach to the process, close the process, and repeat.

I didn't see anything in the micromacro documentation about running an executable, so I checked the lua docs. I came across the execute() method, but it appears it is not implemented in micromacro?

Is there any way to run an executable using micromacro?

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Execute() not available in micromacro?

#2 Post by Administrator » Sat Apr 24, 2010 6:22 pm

The function you are looking for is os.execute(), not just execute(). However, you might also consider using the system() function (from MicroMacro's library functions). There is only a slight difference between these. system() is better for command-line programs you will "return" a value you want.

Sgraffite
Posts: 38
Joined: Wed Jul 09, 2008 12:03 pm

Re: Execute() not available in micromacro?

#3 Post by Sgraffite » Sun Apr 25, 2010 11:09 am

Thanks, I was able to get both of those to run the application. However, both os.execute() and system() appear to wait for the application to finish before continuing on. I'd like to be able to send keystrokes and mouse events to the application after it starts up.

Is there a way to make it so that micromacro does not wait for the application to complete?

User avatar
Administrator
Site Admin
Posts: 5307
Joined: Sat Jan 05, 2008 4:21 pm

Re: Execute() not available in micromacro?

#4 Post by Administrator » Sun Apr 25, 2010 9:34 pm

Code: Select all

os.execute("START theprogram.exe");
This will not work with system(), as the whole point of that function is to wait till the program ends so that you can read it's output.

Sgraffite
Posts: 38
Joined: Wed Jul 09, 2008 12:03 pm

Re: Execute() not available in micromacro?

#5 Post by Sgraffite » Mon Apr 26, 2010 10:45 pm

Awesome, that works great :)

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest