Jump to content
Valnurat

Check status of a service

Recommended Posts

Valnurat

How is it possible to check the status of a service?

I need to wait for a service to start before proceeding.


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites
SadBunny
#include <array.au3>
#include <service.au3>

$aServices = _ServListInstalled()

_ArrayDisplay($aServices)
$spoolerStatus = _ServGetState("Spooler")
MsgBox(64, "Spooler service status", $spoolerStatus)

$appIDSvcStatus = _ServGetState("AppIDSvc")
MsgBox(64, "AppIDSvc service status", $appIDSvcStatus)

Do
    Sleep(1000)
    $myServiceStatus = _ServGetState("myServiceName")
Until $myServiceStatus = "Running"

MsgBox(64, "Yay!", "It's aliiiiiive!")

 


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
water

In the wiki you can find a list of available UDFs: https://www.autoitscript.com/wiki/User_Defined_Functions


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Valnurat
1 hour ago, SadBunny said:
#include <array.au3>
#include <service.au3>

$aServices = _ServListInstalled()

_ArrayDisplay($aServices)
$spoolerStatus = _ServGetState("Spooler")
MsgBox(64, "Spooler service status", $spoolerStatus)

$appIDSvcStatus = _ServGetState("AppIDSvc")
MsgBox(64, "AppIDSvc service status", $appIDSvcStatus)

Do
    Sleep(1000)
    $myServiceStatus = _ServGetState("myServiceName")
Until $myServiceStatus = "Running"

MsgBox(64, "Yay!", "It's aliiiiiive!")

 

Where do I find the included service.au3?

I get an error: Can't open include file <service.au3>


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites
SadBunny

Oh, sorry, I've had that UDF for ages. Check Water's link.


Roses are FF0000, violets are 0000FF... All my base are belong to you.

Share this post


Link to post
Share on other sites
water

Check my link above ;)


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Valnurat

The UDF by Engine?


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites
water

Or:

Service (by arcker) - Build your own service with AutoIt code.
Windows Services (by engine) - Windows Services UDF.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
Valnurat

Yes, I found them before, but they don't have the function calls in the exampel from SadBunny.


Yours sincerely

Kenneth.

Share this post


Link to post
Share on other sites
jguinch

Object way :

Local $sServiceName = "RemoteRegistry"
Local $oShell = ObjCreate("shell.application")

Do
    Sleep(100)
Until $oShell.IsServiceRunning($sServiceName)
MsgBox(0, "", "Service " & $sServiceName & " is running now")

 

Share this post


Link to post
Share on other sites
Valnurat

@jguinch - It worked.

Thank you.


Yours sincerely

Kenneth.

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

  • Similar Content

    • mar3011
      By mar3011
      hello, I want to set in the inputbox field random key from the keyboard to which the function will be assigned, for example F4 function start notepad ALT + A function start notepad for one function. Thank you for any help.  
    • JuanFelipe
      By JuanFelipe
      Cambiar a español Hello friends, I need help with a problem I have, I want to know if there is any way to update a GUI already running, that is I have a GUI of a certain size and with a button I would like to enlarge it:
      example: $ form1 = GUICreate ("", 200,100,0,0)   When you press the button, the gui increases its size, and actuates the new size.
    • BogdanNicolescu
      By BogdanNicolescu
      While 1 / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / WEnd OR:

       
      HotKeySet("{ESC}", "Terminate") While 1 MouseClick("Right",674,422) MouseClick("Left",673,447) Sleep(2000) / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / MouseClick("Left",675,339) SLeep(3000) WEnd Func Terminate()     Exit 0 EndFunc  
      Sorry if i should't let this here to be found by newbies like me -.-'
    • santoshM
      By santoshM
      Dear friends i am facing a problem , i have created a window in autoit some time it is moving with the mouse curser even if iam not clicking the window 
    • sumanth1980
      By sumanth1980
      Here i am wrote a simple lines to install basic applications but when i clicked on one application/program to install it was working fine but when i cancel the program in the middle to install another program it was not working. I am not an expert in this but i want a solution for this ... Can any one help me on this....
      ORG-1.au3
×