Sign in to follow this  
Followers 0
jcaspar

Tester existence service

4 posts in this topic

:P bonjour à tous !

Je viens de réaliser un petit script autoit

il me manque le test de la présence du service

pourriez vous m'aider à résoudre ce petit problème ?

Merci d'avance pour vos conseils et votre aide :whistle:;)

demarrage avec les droits administrateurs

runasset("administrateur",@Computername,"****")

;ne rien afficher pour l'utilisateur

Break(0) ;

;supprimer le répertoire ocs-ng

DirRemove("C:\Ocs-ng", 1)

; si le service ocs inventory service existe sortir de l'appli

run("OcsAgentSetup.exe")

Func ServiceExists($szService)

RegRead("HKLM\SYSTEM\CurrentControlSet\Services\" & $szService,"OCS INVENTORY Service")

Return Not @error

EndFunc

sleep(1000)

;fenetre active "installation de ocs inventory agent"

WinWaitActive("Installation de OCS Inventory Agent 4.0.2.6")

;si la fenetre existe

If WinExists("Installation de OCS Inventory Agent 4.0.2.6") Then

; enter

Send("{ENTER}")

;attente 1000 millisecondes

sleep(1000)

;enter

Send("{ENTER}")

;attente 1000 millisecondes

sleep(1000)

;tab

Send("{tab}")

;attente 1000 millisecondes

sleep(1000)

;taper nas-dd68

Send("nas-dd68")

;enter

sleep(1000)

Send("{ENTER}")

;attente 1000 millisecondes

sleep(1000)

;enter

Send("{ENTER}")

;attente 1000 millisecondes

sleep(1000)

;enter

Send("{ENTER}")

;message Installation 60 secondes

sleep(2500)

msgBox (4096,"Installation Client OCS","Installation réussie",2)

EndIf

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

i think your needing to add a call to the function from what I see you have there after the run

je pense votre devoir ajouter un appel à la fonction de ce que je vous vois avoir là après la course

ServiceExists("service name")

C'est un forum anglais, vous obtiendra plus d'aide si on pose les questions en anglais

Edited by gafrost

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Share this post


Link to post
Share on other sites

Thanks a lot for your answer ! ;)

but my function doesn't do i what i would like ...

i would like that it test if a service exist and if

exists that the application close.

Also i have other question i would like

that the user don't see the execution process

of autoit is it possible to hide it ?

Thanks a lot for your help and tricks ! :whistle:

Jean Marc :P

Share this post


Link to post
Share on other sites

#NoTrayIcon
$szService = "service name here"
RunAsSet("administrateur", @ComputerName, "****")
;ne rien afficher pour l'utilisateur
Break(0) ;
If ServiceExists($szService) Then Exit
;supprimer le répertoire ocs-ng
DirRemove("C:\Ocs-ng", 1)

; si le service ocs inventory service existe sortir de l'appli
Run("OcsAgentSetup.exe")
Sleep(1000)
;fenetre active "installation de ocs inventory agent"
WinWaitActive("Installation de OCS Inventory Agent 4.0.2.6")
;si la fenetre existe
If WinExists("Installation de OCS Inventory Agent 4.0.2.6") Then
    ; enter
    Send("{ENTER}")
    ;attente 1000 millisecondes
    Sleep(1000)
    ;enter
    Send("{ENTER}")
    ;attente 1000 millisecondes
    Sleep(1000)
    ;tab
    Send("{tab}")
    ;attente 1000 millisecondes
    Sleep(1000)
    ;taper nas-dd68
    Send("nas-dd68")
    ;enter
    Sleep(1000)
    Send("{ENTER}")
    ;attente 1000 millisecondes
    Sleep(1000)
    ;enter
    Send("{ENTER}")
    ;attente 1000 millisecondes
    Sleep(1000)
    ;enter
    Send("{ENTER}")
    ;message Installation 60 secondes
    Sleep(2500)
    MsgBox(4096, "Installation Client OCS", "Installation réussie", 2)
EndIf

Func ServiceExists($szService)
    RegRead("HKLM\SYSTEM\CurrentControlSet\Services\" & $szService, "OCS INVENTORY Service")
    If @error Then Return 0
    Return 1
EndFunc   ;==>ServiceExists


SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

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
Sign in to follow this  
Followers 0