Sign in to follow this  
Followers 0
Sme101

Help on time-based auto execute a script

9 posts in this topic

Hello,

I'm new in autoit. Aside from using the windows task scheduler, I was wondering if I can create a time-based script that will automatically run with reference to the computer's clock? For example I want the script to automatically run by 6:00am. I tried searching but the instructions are kinda advanced. Help will be greatly appreciated.

Thank you!

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

Here's another way to do pretty much the same thing. Read the Help file again, it's not that hard and 'advanced'. There's autoit tutorials here. There's help available in this forum, just post the code you're having trouble with.

Do
    Sleep(1000)
Until @HOUR = '08' And @MIN = '00'

_MyFunc()

Func _MyFunc()
     MsgBox(0,"Hello","World")
EndFunc

edit: added 'pretty much'..

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites

@somdcomputerguy

Doesn't looks like the same thing: this script will only trigger MyFunc once.

BTW, @both: 06:00 am not 08:00 am but the OP should be able to fix that.


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

And JohnOnes code will continue to trigger it each time the MsgBox is closed until @Min > 00

Although if it's a separate script it probably only needs to be called once then exit the code above.

Edited by GEOSoft

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

Hi George,

You're right. I don't know why I only considered the function to launch something lengthy, like a backup, unlikely to terminate quickly.

(In fact, yes I know precisely why I'm obsessed with backups these days, due to two new 1T disks crashing in a row, just 3 days after install. Shitty stuff.)


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites

O.ops, I thought I had added the customary "Simple example" clause

$iFlag = 0
While 1
    Sleep(1000)
    If @HOUR = '08' And @MIN = '00' Then
        $iFlag = 1
        _MyFunc()
    EndIf
    If $iFlag Then
        Do
            Sleep(100)
        Until @Min <> '00'
        $iFlag = 0
    EndIf
WEnd  
Func _MyFunc()
     MsgBox(0,"Hello","World")
EndFunc

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

In fact, yes I know precisely why I'm obsessed with backups these days, due to two new 1T disks crashing in a row, just 3 days after install. Shitty stuff.)

Western Digital green series by any chance? I'm seeing a large failure rate with those drives in the 1 to 2 TB sizes. I still have a single 1.5TB green installed that I'm keeping a close eye on until my next drive order arrives. In the meantime all I can do is keep it cloned and it's just used as a storage drive but on my system the storage drive is more critical than the drives my operating systems are on.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

No, Seagate, but same crap. We're slowly driftng off topic BTW.

@OP,

You really don"t want to use the scheduler?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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