Sign in to follow this  
Followers 0
erikson

time (hour) script problems

7 posts in this topic

hi

i try to make a script that will run something between some hours ( between 22:00 and 8:00 )

i try something like this:

CODE
$ora = @HOUR

if 22< $ora <08 Then

run ("something")

else

MsgBox (1, "ora", "not now")

EndIf

but don`t work

some ideeas?

Share this post


Link to post
Share on other sites



Hi,

Why not run the script with scheduled task?

Otherwise you can create a loop, but you will have 100% cpu usage! So this is not such great idea...

dim $iTimehascome

$iTimehascome = 0

do
    if @HOUR >= 4 Then
        ; your code goes here
        $iTimehascome = 1
    EndIf
Until $iTimehascome = 1

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Otherwise you can create a loop, but you will have 100% cpu usage! So this is not such great idea...

Sure, if you don't have a Sleep() in a loop the script's CPU-usage will be close to 100%...

Edit : tags..

Edited by Helge

Share this post


Link to post
Share on other sites

thanx

now i thing i have another problem

if i change the computer hour .. .. its no good

so i must take the exact hour from another machine , or via internet.

can i make this?

Share this post


Link to post
Share on other sites

Sure, if you don't have a Sleep() in a loop the script's CPU-usage will be close to 100%...

Edit : tags..

You are right, this solves the problem :whistle:

Share this post


Link to post
Share on other sites

Well you can get the time from the internet


Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Share this post


Link to post
Share on other sites

Well you can get the time from the internet

i know. but how?

i must save a webpage locally, fileopen that file and search the string with hour, grab the time into a variable and so on? o or is a more simple method?

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