Jump to content

Staring a Windows Service w/ autoit 3


 Share

Recommended Posts

Hi, just a question about how to do something.

I have a program (Mcafee AntiSpyware) that runs a service (MASSRV.exe) in the background. It provides realtime protection, which I disabled and do not use. However, the service uses 20MB of RAM to sit there doing nothing, even with realtime off! I can turn it off in services manager, but then the rest of the program, like manual scans, and the main window, will not work or run.

What I want to do is make a small script to start the service when i open the software and terminate it when it is closed. I want to rename the main file (MASCon.exe) to some else, like MASCon2.exe, and put my script as MASCon.exe (I have tried renaming and the app will work with the service running.) Then, i want the script (compiled) to start the service, and then run the MASCon2.exe file, wait to finish, then stop the service.

I have tried:

* Using a RAM optimizer to save memory and leave the service on all the time and wasting memory.

* Using a script with the "Run" command (didn't work) - The service will not start by double clicking either. Only via the Services manager in Windows. :whistle:

Thanks.

Link to comment
Share on other sites

Search for +"net start" +"net stop".

Run like this

Run('net start "<service>"')
Sleep(5000) ;Figure out how to know the service is running
RunWait("<you appølication>")
Run('net stop "<service>"'))
Link to comment
Share on other sites

Thanks for the quick reply! I'll try that out and post back here if it doesn't work...It seems for the find if service is running, i could use a Processexists (something like that) function...

Search for +"net start" +"net stop".

Run like this

Run('net start "<service>"')
Sleep(5000) ;Figure out how to know the service is running
RunWait("<you appølication>")
Run('net stop "<service>"'))
Link to comment
Share on other sites

In the run statement you can add options for monitoring "net start" output. Search for $STDIN_CHILD, $STDOUT_CHILD, $STDERR_CHILD in the forum and you will find plenty of samples.

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...