Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

 
Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
Old 28th January 2005, 08:21   #1
vbgunz
Senior Member
 
Join Date: Jun 2003
Posts: 284
Send a message via AIM to vbgunz
How to start stop uninstall services BASED on IF services are started, stopped, etc?

I need to communicate with services and communication is very dependent on the services current state. e.g. There is no point in trying to start a started service. No point in trying to stop a stopped service. No point in trying to uninstall a nonexistent service...

I've been pulling my hair trying hard on this. I've download the services.dll by sunjammer I believe. I've downloaded the NSIS service lib and worked with that. Both choices are no go. Sunjammers solution works with MessageBoxes BUT how do I use that to my advantage? How do I say IF service is installed GOTO Is service running? IF service is running please stop it. IF service is installed but not running please uninstall.

Man, I tried clear errors, IfErrors and a bunch of other stuff and cant quite get any thing to work. This is something I tried in so many different variations but give me no cigar
code:
Section
ClearErrors
services::IsServiceRunning 'MyService'
Pop $0
IfErrors skip1
DetailPrint "one sleeping... Stopping MyService"
nsExec::ExecToLog '"C:\Program Files\rock\paper\scissor.exe" -stop'
Sleep 9000
skip1:

ClearErrors
services::IsServiceInstalled 'MyService'
Pop $0
IfErrors skip2
DetailPrint "one sleeping... Removing MyService"
nsExec::ExecToLog '"C:\Program Files\rock\paper\scissor.exe" -remove'
Sleep 9000
skip2:

ClearErrors
services::IsServiceRunning 'MyService'
Pop $0
IfErrors 0 skip3
DetailPrint "Second sleeping... Stopping MyService"
nsExec::ExecToLog '"C:\Program Files\rock\paper\scissor.exe" -stop'
Sleep 9000
skip3:

ClearErrors
services::IsServiceInstalled 'MyService'
Pop $0
IfErrors 0 skip4
DetailPrint "Second sleeping... Removing MyService"
nsExec::ExecToLog '"C:\Program Files\rock\paper\scissor.exe" -remove'
Sleep 9000
skip4:
SectionEnd


Any body have any ideas? I much rather work with the plugin by sunjammer than work with the other script. I could in no way get the other script to work. I couldn't even get an error out of it Can someone please help. Thanks!
vbgunz is offline   Reply With Quote
 
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump