Sign in to follow this  
Followers 0
Markir

Scheduler

14 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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]

Share this post


Link to post
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.

Share this post


Link to post
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}>

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)


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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" )

Share this post


Link to post
Share on other sites

OK, I use sleep(60000), but how can I can I close the taskmanager.exe after the 60 seconds?

Share this post


Link to post
Share on other sites

OK, I use sleep(60000), but how can I can I close the taskmanager.exe after the 60 seconds?

<{POST_SNAPBACK}>

ProcessClose ( "taskmanager.exe " )

Share this post


Link to post
Share on other sites

Hello golfjrr

this doenst work. The taskmanager.exe programm is still open

Share this post


Link to post
Share on other sites

Hello,

can anybody say me, why this doesn't work?

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites

my EXE is taskmgr.exe

<{POST_SNAPBACK}>

Mine too but I was just quoting the example he gave. I dunno if it is different for different operting systems. It worked fine for me when I used the proper name for my machine.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Has nobody an idea?

Share this post


Link to post
Share on other sites

Hi..

yes it seems so that the ProcessClose() function does not work correctly with some microsoftprogramms.

but i think you could use "PSkill.exe" from PStools from sysinternal (www.sysinternals.com)

mfg Domonoky

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