Sign in to follow this  
Followers 0
Foofy

Start/Stop Services and using it

3 posts in this topic

#1 ·  Posted (edited)

Hi everyone, this is my first post here :)

Today as I cleaned a bit my computer, I saw that iTunes created 3 services which always started on boot. Since my computer isn't a high end nor a recent one, I decided to stop these services and start them only when needed : while using iTunes.

So I share it here and hope it will be useful to others. (The start/stop services code wasn't quit easy to find :( )

1) Start a service

$sSvcName = 'ServiceName'
RunWait(@ComSpec & " /c " & 'sc start "' & $sSvcName & '"', "", @SW_HIDE)

2) Stop a service

$sSvcName = 'ServiceName'
RunWait(@ComSpec & " /c " & 'sc stop "' & $sSvcName & '"', "", @SW_HIDE)

3) And using it on iTunes

TrayTip('Starting iTunes...','', 5)
$sSvcName = 'Apple Mobile Device'
RunWait(@ComSpec & " /c " & 'sc start "' & $sSvcName & '"', "", @SW_HIDE)
$sSvcName = 'iPod Service'
RunWait(@ComSpec & " /c " & 'sc start "' & $sSvcName & '"', "", @SW_HIDE)
$sSvcName = 'Bonjour Service'
RunWait(@ComSpec & " /c " & 'sc start "' & $sSvcName & '"', "", @SW_HIDE)

Sleep(500)
TraySetState(2)
RunWait(@ScriptDir&'\iTunes.exe')

$sSvcName = 'Apple Mobile Device'
RunWait(@ComSpec & " /c " & 'sc stop "' & $sSvcName & '"', "", @SW_HIDE)
$sSvcName = 'iPod Service'
RunWait(@ComSpec & " /c " & 'sc stop "' & $sSvcName & '"', "", @SW_HIDE)
$sSvcName = 'Bonjour Service'
RunWait(@ComSpec & " /c " & 'sc stop "' & $sSvcName & '"', "", @SW_HIDE)

Save this script in C:\Program Files\iTunes !

Remember : Before using this script, stop the following services and set their startup on manual : (run -> services.msc)

Apple Mobile Device

iPod Service

Bonjour Service

Now, start this autoit script instead of iTunes.exe :)

It works perfectly on my iTunes 9.0.3.15

-Foofy

Edited by Foofy

Share this post


Link to post
Share on other sites



Good script Footy, thanks. This may come in handy if I every have to use it. It can sit in the startup directory.

For future reference scripts like this go in the Example Scripts section however I think you need at least 10 posts to post there anyway.


Post your code because code says more then your words can. SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y. Use Opt("MustDeclareVars", 1)[topic="84960"]Brett F's Learning To Script with AutoIt V3[/topic][topic="21048"]Valuater's AutoIt 1-2-3, Class... is now in Session[/topic]Contribution: [topic="87994"]Get SVN Rev Number[/topic], [topic="93527"]Control Handle under mouse[/topic], [topic="91966"]A Presentation using AutoIt[/topic], [topic="112756"]Log ConsoleWrite output in Scite[/topic]

Share this post


Link to post
Share on other sites

Thank you Big Help

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