Jump to content

Scheduler


Markir
 Share

Recommended Posts

Hello,

I want to code a program, that save some configuration of the registry in a file. That code works fine. Now, I want repeat it every night automatically, how can I do that?

I hope everybody understand my question, because my english is not so good.

Thank you for helping me.

Link to comment
Share on other sites

control panel -> scheduled tasks

if you want the script to do it the cpu will bounce around from 0-5% all the time but to do it with the script write the code like this (taken from my alarm program)

While 1
    If @HOUR = $Hour and @MIN <= $MinE and @MIN >= $MinS Then
        SoundPlay( $File )
        Sleep( $Wait * 1000 )
    EndIf
WEnd

change that code to what you want it to do and set the variables to the time you want it to start and the time you want it to end, i will explain better if needed

edit: here is an example that runs notepad at 8 every night

While 1
    If @HOUR = 20 and @MIN <= 0 and @MIN >= 0 Then
        Run ( "notepad" )
        Sleep( 60000 )
    EndIf
WEnd

ta-da! :lmao:

Edited by Xenogis

[font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font]

Link to comment
Share on other sites

Thank you for your second script, but there is a problem, here is my code:

While 1

If @HOUR = 21 and @MIN <= 30 and @MIN >= 30 Then

Run ( "E:\Dokumente und Einstellungen\Marc\Desktop\taskmanager.exe" )

Sleep( 10000 )

EndIf

WEnd

---------------------

It runs and after 10 second a new taskmanager.exe will be open and the first one won't be closed.

Link to comment
Share on other sites

  • Developers

Thank you for your second script, but there is a problem, here is my code:

While 1

    If @HOUR = 21 and @MIN <= 30 and @MIN >= 30 Then

        Run ( "E:\Dokumente und Einstellungen\Marc\Desktop\taskmanager.exe" )

        Sleep( 10000 )

    EndIf

WEnd

---------------------

It runs and after 10 second a new taskmanager.exe will be open and the first one won't be closed.

<{POST_SNAPBACK}>

Sleep(10000) = pause for 10 seconds so yes it will keep on running taskmanager from 21:30:00 till 21:30:59 .. so probably 5 times.

you could:

- do a runwait so the script will pause till you close taskmanager

- use sleep(60000)

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

Thank you for your second script, but there is a problem, here is my code:

While 1

    If @HOUR = 21 and @MIN <= 30 and @MIN >= 30 Then

        Run ( "E:\Dokumente und Einstellungen\Marc\Desktop\taskmanager.exe" )

        Sleep( 10000 )

    EndIf

WEnd

---------------------

It runs and after 10 second a new taskmanager.exe will be open and the first one won't be closed.

<{POST_SNAPBACK}>

This might work..

If not ProcessExists ("taskmanager.exe") then Run ( "E:\Dokumente und Einstellungen\Marc\Desktop\taskmanager.exe" )

Link to comment
Share on other sites

Probably because Task Manager is from Microsoft and they decided to avoid killing it's process.

Is it really called taskmanager.exe at your place?

Mine is taskmgr.exe

Edit:

I just started Task Manager and ran ProcessClose("taskmgr.exe") and it worked,

Edited by SlimShady
Link to comment
Share on other sites

Here is my test with another program, but it doens't work. Mey OS is Windows XP with SP2.

While 1

If @HOUR = 19 and @MIN <= 45 and @MIN >= 45 Then

Run ( "C:\Programme\Microsoft Office\OFFICE11\Excel.exe" )

sleep(60000)

ProcessClose ( "EXCEL.EXE " )

EndIf

WEnd

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...