View Single Post
Old 28th January 2005, 20:19   #4
vbgunz
Senior Member
 
Join Date: Jun 2003
Posts: 284
Send a message via AIM to vbgunz
Hello Lobo. Yes, I am that vbgunz

Here is how I solved the IF service exist do something or do something else. The following code is for use with the services plugin. I hope this helps
code:
Section
services::IsServiceRunning 'MyService'
Pop $0
StrCmp $0 Yes 0 no_MyService_running
DetailPrint "Preparing to Stop MyService"
nsExec::ExecToLog '"C:\Program Files\rock\paper\scissor.exe" -stop'
Goto MyService_running_done

no_MyService_running:
DetailPrint "HOORAY!!! Skipped an unstarted service (MyService)"
Goto MyService_running_done
MyService_running_done:

services::IsServiceInstalled 'MyService'
Pop $0
StrCmp $0 Yes 0 no_MyService_installed
DetailPrint "Preparing to Uninstall MyService"
nsExec::ExecToLog '"C:\Program Files\rock\paper\scissor.exe" -remove'
Goto MyService_installed_done

no_MyService_installed:
DetailPrint "HOORAY!!! Skipped uninstalling a ghost service (MyService)"
Goto MyService_installed_done
MyService_installed_done:
SectionEnd

vbgunz is offline   Reply With Quote