AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

how to pause windows scheduled tasks?

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
jak



Joined: 28 Feb 2006
Posts: 159

PostPosted: Fri Jul 24, 2009 2:48 am    Post subject: how to pause windows scheduled tasks? Reply with quote

There are directions here on how to go to the scheduled tasks folder in winXP and on the menu click "advanced>pause scheduled tasks".

How can I automate that in autohotkey? (ie, is there a single line I can send to the command prompt?)

I want to pause/unpause my scheduled tasks when playing games or watching movies... I searched the forum but didnt see a command line or script that could be run with a hotkey... wondering if its possible with autohotkey to create that...

thanks!
Back to top
View user's profile Send private message
TLM



Joined: 21 Aug 2006
Posts: 2926
Location: The Shell

PostPosted: Fri Jul 24, 2009 8:20 am    Post subject: Reply with quote

Not sure if you can pause from here but Scheduled Tasks can be run from compsec.

Code:
Run %comspec% /k SCHTASKS


If you cant do it from there pause it directly, run from the built in class.

Code:
Run ::{d6277990-4c6a-11cf-8d87-00aa0060f5bf},,
WinWait, Scheduled Tasks ahk_class CabinetWClass,
msgbox, Scheduled Tasks are open!`n`nNow add pause command.

Once you get it perfected you can (I think) add a Hide to the 3rd parameter of Run (sorry I dont use Scheduled Tasks).

hth
_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 3113
Location: MN, USA

PostPosted: Fri Jul 24, 2009 3:29 pm    Post subject: Reply with quote

You may also start and stop the service itself.
Code:
;stop
Run, %comspec% /c net stop "Task Scheduler",,Hide
;start
Run, %comspec% /c net start "Task Scheduler",,Hide
Back to top
View user's profile Send private message Visit poster's website
jak



Joined: 28 Feb 2006
Posts: 159

PostPosted: Fri Jul 24, 2009 4:21 pm    Post subject: Reply with quote

thanks guys.

too bad I cant send

Code:
Run, %comspec% /c net pause "Task Scheduler",,Hide
Back to top
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 3113
Location: MN, USA

PostPosted: Fri Jul 24, 2009 5:37 pm    Post subject: Reply with quote

It looks like the SC command can pause and continue a service, though I've never tried it.
Back to top
View user's profile Send private message Visit poster's website
TLM



Joined: 21 Aug 2006
Posts: 2926
Location: The Shell

PostPosted: Fri Jul 24, 2009 5:51 pm    Post subject: Reply with quote

jaco0646 wrote:
You may also start and stop the service itself.
Code:
;stop
Run, %comspec% /c net stop "Task Scheduler",,Hide
;start
Run, %comspec% /c net start "Task Scheduler",,Hide


omg another one overlooked! I will be sllllooowwwly crawling through MS commands now Wink

Thanks for that one jaco0646

jaco0646 wrote:
It looks like the SC command can pause and continue a service, though I've never tried it.
Shocked Shocked GOLD I SAY GHOOOLLLD!

_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
jak



Joined: 28 Feb 2006
Posts: 159

PostPosted: Fri Jul 24, 2009 6:26 pm    Post subject: Reply with quote

This script is working well. I modelled it on the "disable screen saver" script that I found on the forums here.

Save the following to an ".ahk" file. Run that file when you want to pause your windows scheduled tasks. A system tray icon will appear while the tasks are paused. To unpause, just right click that icon and exit the ahk script.

Thats similar to how the 'disable screen saver' ahk script works. Of course you can modify this to work on a hotkey instead, if you want. (I prefer it as a separate script cuz I use a command line "launchy" style program to launch it).

Code:
;Pause Scheduled Tasks.ahk

#Persistent
Menu, Tray, Icon, shell32.dll, 110
Menu, Tray, Tip, Scheduled Tasks Paused!!!
OnExit, ContinueTasks
;pause
Run, %comspec% /c net pause "Task Scheduler",,Hide
Return


ContinueTasks:
;continue
Run, %comspec% /c net continue "Task Scheduler",,Hide
ExitApp
Return


Last edited by jak on Fri Jul 24, 2009 7:40 pm; edited 1 time in total
Back to top
View user's profile Send private message
TLM



Joined: 21 Aug 2006
Posts: 2926
Location: The Shell

PostPosted: Fri Jul 24, 2009 7:35 pm    Post subject: Reply with quote

Nice work jak!
_________________
paradigm.shift:=(•_•)┌П┐RTFM||^.*∞
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group