Jump to content

Writing a Service


Recommended Posts

Oh boy... here we go. I have written a program and need to convert it to a service. For a cute little utility (exe2service) that "converted" it and installed it as a service. The immediate concern is what to do about an "Exit" in the program. It looks like the"Exit" killed the process but the service still said it was started.

So I am pretty sure I can't use the exit function in a service and I wouldn't think I would want to stop a service from within the service so how do you politely "exit" as service?

I have searched the forum and the docs and there aren't any references  with respect to writing services with AutoIT. Can someone point me in the right direction or give me a few pointers?

Link to comment
Share on other sites

You stop a service like this:

RunWait("SC STOP bthserv");Stop
RunWait("SC CONFIG bthserv START= DISABLED");Configure to disable, manual, auto or auto delayed

Start it like this:

RunWait("SC START hidserv");Start
RunWait("SC CONFIG hidserv START= AUTO");Configure to disable, manual, auto or auto delayed

This is a cmd from windows.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

Controlling the services isn't an issue. The services mmc, SC and/or the net command are second nature. The issues is what I need to do to convert a pre-written AutoIT script to work well as a service. @JohnOne it took me a while to figure out what was going on. Thescript you pointed me to (as well as the others) are just wrappers for existing scripts that will make them "service compatible"?

I have to be doing something wrong. Before posting this question I tried to find the answer on my own by searching the forum but I didn't get any hits. I had to Google it than follow the links back in to the forum. Is it simply that the search function on the forum doesn't work well or am I not using it properly?

Link to comment
Share on other sites

Well, when i search usually i have to go to the main forum page, and search for there.

Never created a service so im not sure how to help, why do you need it to be a service? there are ways to make it run hidden, thus, similar to a service.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to comment
Share on other sites

I'd imagine it is related to >this.

@JohnOne: My need to write a service is a direct result of "this" but I and so totally lost by the first link you sent it isn't funny. I sat there and read that entire thread 10 times and have no idea what I am suppused to with that code. I thought it was a wrapper and I was supposed to insert my code in the example somewhere. Than it looked like I was supposed to simply compile my script and use the example to install it. I couldn't make heads or tails out of that thread or the example. I feel like such an idiot. In nubee terms what am I supposed to do with that first link?

Link to comment
Share on other sites

   Still searching, reading and struggling. It seems like there are two different things going on here. There seems to be "service" UDFs that will let you control services (stop, start, pause, create, delete) and there are "service" UDFs that will turn your script in to a "Service Compatible" script. Am I way off base here?

   Controling services isn't a big deal. Converting scripts to be "service compatible" looks like it is a different stroy. @JohnOne you first link sent me to _Service_UDF v4. I am not exactly sure what that UDF does. The examples don't compile, there are three or four sets of files scattered throughout the thread and nothing seems to make much sense. Is that UDF a wrapper and if so is there any clear cut thread on how to use it?

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