Jump to content

Scheduled Task


Recommended Posts

I need to run 'Task Scheduled Task Wizard'. But I'm not sure how to write the run cammand. I need to schedule some scripts I wrote. If there is an easier way to do this or if you know of any scripts like the one I am trying to write it would help out. Any Ideas?

Thanks

Link to comment
Share on other sites

I need to run 'Task Scheduled Task Wizard'. But I'm not sure how to write the run cammand. I need to schedule some scripts I wrote. If there is an easier way to do this or if you know of any scripts like the one I am trying to write it would help out. Any Ideas?

Thanks

If you need to run some of your tasks at scheduled times you could compile them and just use the windows task scheduler.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

thats what I have been doing but is there anyway to automate task scheduler I need to schedual task on a buch of comps rather often. Then all would have to do is add a file with a bunch of strings for the times I want it to set it up as.

I have this command so far but it just opens the control panel.

Run(@SystemDir & "\rundll32.exe" & " Shell32.dll,Control_RunDLL")
Link to comment
Share on other sites

you could use the run @comspec function, and use each of these lines in dos one at as time.

AT /DELETE /YES (deletes all previos schedules entered in dos)

at 19:00 /interactive /every:m,t,w,th,f,s,su c:\batches\OnightQ.exe

at 02:30 /interactive /every:su c:\batches\230am.bat

at 04:00 /interactive /every:m,t,w,th,f,s,su c:\batches\4am.bat

This is from a batch file we use at work

Link to comment
Share on other sites

you could use the run @comspec function, and use each of these lines in dos one at as time.

AT /DELETE /YES (deletes all previos schedules entered in dos)

at 19:00 /interactive /every:m,t,w,th,f,s,su c:\batches\OnightQ.exe

at 02:30 /interactive /every:su c:\batches\230am.bat

at 04:00 /interactive /every:m,t,w,th,f,s,su c:\batches\4am.bat

This is from a batch file we use at work

Thanks, but I'd prefer not to use dos.

Edited by skafreak_510
Link to comment
Share on other sites

this might help

Run("mmc Services.msc -k netsvcs", @SystemDir)
    WinWaitActive("Services")
    Sleep(300)
    Send("{TAB}")
    Sleep(300)
    Send("Task Scheduler")
    Sleep(300)
    Send("{ENTER}")
    Sleep(300)
    Send("!e")
    Sleep(300)
    Send("A")
    Sleep(300)
    Send("!A")
    Sleep(300)
    Send("!S")
    Sleep(2000)
    MsgBox(64,"Finished Set-up"," If all settings are satisfactory...   " & @CRLF & " Please press  *OK*   ")
    While 3
        If Not WinExists("Task Scheduler Properties") Then ExitLoop
        Sleep(100)
    WEnd
    Sleep(100)
    WinClose("Services")

8)

NEWHeader1.png

Link to comment
Share on other sites

I could not find a way to directly create a scheduled task...

I could not find a way to directly open the Scheduled Task Wizard...

What I could put together was this:

Run("explorer ::{D6277990-4C6A-11CF-8D87-00AA0060F5BF}")
WinWait("Scheduled Tasks")
WinActivate("Scheduled Tasks")
WinWaitActive("Scheduled Tasks")
Send("{HOME}{ENTER}")

WinWait("Scheduled Task Wizard")
WinActivate("Scheduled Task Wizard")
WinWaitActive("Scheduled Task Wizard")
Send("!n")
Hope it helps...

Edit: I tested on XP with a scheduled task named aaa.

"Add Sheduled Task" seems to always stay on top...

...so the {HOME} should always reach it.

Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

I could not find a way to directly create a scheduled task...

I could not find a way to directly open the Scheduled Task Wizard...

What I could put together was this:

Run("explorer ::{D6277990-4C6A-11CF-8D87-00AA0060F5BF}")
WinWait("Scheduled Tasks")
WinActivate("Scheduled Tasks")
WinWaitActive("Scheduled Tasks")
Send("{HOME}{ENTER}")

WinWait("Scheduled Task Wizard")
WinActivate("Scheduled Task Wizard")
WinWaitActive("Scheduled Task Wizard")
Send("!n")
Hope it helps...

Edit: I tested on XP with a scheduled task named aaa.

"Add Sheduled Task" seems to always stay on top...

...so the {HOME} should always reach it.

Thanks that helped a lot I will post my script in "Scripts & Scraps" when I finish.
Link to comment
Share on other sites

Thanks, but I'd prefer not to use dos.

Out of curiosity, could you please elaborate as to why you prefer actual window automation over a set of DOS calls? Relying on opening windows and sending keystrokes is nowhere near as dependable.

You can hide the console window that appears if that's the problem.

Link to comment
Share on other sites

Here are a couple of ideas:

1. Microsoft has a Resource Kit utility that will allow you to schedule tasks. See this page:

http://www.windowsitpro.com/Article/Articl...5148/45148.html

The FTP URL in the article for downloading the utility is still good.

2. You can also use VBScript-WMI to schedule jobs. Here is a page with sample scripts:

http://www.activexperts.com/activmonitor/w...taskscheduling/

An issue with creating a task using the sample VBScript is that you cannot edit it using the Scheduled Tasks Control Panel (though you can delete it from there). It looks like the scripts mimic the AT command.

Edited by bluebearr
BlueBearrOddly enough, this is what I do for fun.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...