dorochet Posted August 27, 2007 Share Posted August 27, 2007 Hello, I am new to autoit and programming in general. I have made an autoit script, which I want to be run once an hour. I am having trouble figuring out the syntax to do this, can anyone help? Thank you! Link to comment Share on other sites More sharing options...
Achilles Posted August 27, 2007 Share Posted August 27, 2007 (edited) Hello, I am new to autoit and programming in general. I have made an autoit script, which I want to be run once an hour. I am having trouble figuring out the syntax to do this, can anyone help? Thank you!I suppose you could make another script to run it, it would look something like this: $hour = @Hour;Grab the current hour as a variable $min = @Min;Grap the current minute as a variable ShellExecute('put the other script's full path here');Run your hourly script first While 1;Keep on repeating If $hour < @Hour then;If the saved hour is less then the current hour check the next statement If $min < @Min then;If the saved minute is less then the current minute check the next statement ShellExeCute('put the other script's full path here');Run the script $hour = @Hour;Re grab the hour $min = @Min;Re grab the minute EndIf EndIf Sleep(200);Wait a bit to check in order to keep CPU usage down WEnd I haven't tested this because I don't want to wait an hour but it should work. Edited August 27, 2007 by Piano_Man My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
dorochet Posted August 27, 2007 Author Share Posted August 27, 2007 ok so here is the code I am using-----------------------------------------------------------------------------------------$hour = @Hour;Grab the current hour as a variable$min = @Min;Grap the current minute as a variableShellExecute(C:\scripts\galacticatest.ahk);Run your hourly script firstWhile 1;Keep on repeating If $hour < @Hour then;If the saved hour is less then the current hour check the next statement If $min < @Min then;If the saved minute is less then the current minute check the next statement ShellExeCute(C:\scripts\galacticatest.ahk);Run the script $hour = @Hour;Re grab the hour $min = @Min;Re grab the minute EndIf EndIf Sleep(200);Wait a bit to check in order to keep CPU usage downWEnd------------------------------------------------------------------------------------------When I run this script I get the following error---------------Error at Line 4.Line Text: \scripts\galacticatest.ahkError: The leftmost character above is illegal in an expression.The program will exit.---------------Any thoughts? Link to comment Share on other sites More sharing options...
GreenHouse Posted August 27, 2007 Share Posted August 27, 2007 When I run this script I get the following error --------------- Error at Line 4. Line Text: \scripts\galacticatest.ahk Error: The leftmost character above is illegal in an expression. The program will exit. --------------- Any thoughts? I have some... You forgot to add the quotes "". ShellExeCute("C:\scripts\galacticatest.ahk") Cheers... Link to comment Share on other sites More sharing options...
dorochet Posted August 27, 2007 Author Share Posted August 27, 2007 I have some... You forgot to add the quotes "". ShellExeCute("C:\scripts\galacticatest.ahk") Cheers... Silly mistake, thank you Link to comment Share on other sites More sharing options...
GreenHouse Posted August 27, 2007 Share Posted August 27, 2007 Silly mistake, thank youHey no problem at all.... I'm new too and I am still making a plenty of those myself... haha just gotta be casual about it... be allright...Have a good night.- Pas Link to comment Share on other sites More sharing options...
Fossil Rock Posted August 27, 2007 Share Posted August 27, 2007 ShellExecute(C:\scripts\galacticatest.ahk);Run your hourly script firstThat's funny .... wanting to run an AutoHotKey script with AutoIt. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
SadBunny Posted August 27, 2007 Share Posted August 27, 2007 Two other approaches would be:1) Just schedule the thing in your windows task scheduler.2) If you don't want the hassle of having two different autoit scripts, the one running the other, you might just wait an hour in the main loop and then do the hourly stuff:While 1 $ti = TimerInit() While TimerDiff($ti) < 60 * 60 * 1000 ; <- 60*60*1000 = amount of miliseconds in one hour Sleep(1000) ; <- wait for a second WEnd ; Do The Hourly StuffWEnd Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now