Sign in to follow this  
Followers 0
TheCuz

Running a script at a certain time

6 posts in this topic

Uber newbie to using AuotIT and scripts....

I am trying to figure out a way to make a script so that it will check to see what time it is (on the PC), when it reaches that time (5am) it will copy files to another PC.

I have the file transfer commands down and it works fine as a compiled EXE, but now I am having trouble finding a way so that the EXE will run all of the time and check to see what time it is every couple of minutes so as not to take up to much CPU usage.

I think I am on the right track by using:

If @HOUR = 5 @MIN = 00 Then <can you use two of them like that?>

<FILE COPY COMMAND>

Sleep (60000)

<SOME HOW TELL IT TO LOOP FROM HERE>

From here I am not sure how to keep it looping so that it will check the PC time until it reaches 5am.

Any direction or help would be great.

Thankx in advance.


[font="Verdana"]People who say it cannot be done should not interrupt those who are doing it. - George Benard Shaw[/font]

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi..

i see a few posibillities to accomplish this task...

you could use the Windows Task Sheduler to run this script every day at 5 o Clock... or you could use a tool like "cron" the Unix/Linux sheduler ( ported for windows)..

..or you write something in autoit.. like:

While 1
  If (@HOUR = 5) AND (@MIN = 00) Then
     <COPY THE FILE >
   Endif
   sleep(60000)
Wend

hope i could help..

mfg Domonoky

Edited by Domonoky

Share this post


Link to post
Share on other sites

Thanks Domonoky,

I tried using the AT command, but I was running into a ton of problems. When I would type the command to copy from the command prompt, it would work fine, but then when I would have it run the batch file, it would come up a invalid drive error even thought the drive was mapped and could see the contents from the command prompt and the GUI. I mapped the drive using NET USE Z: \\<PC NAME> /USER:<ACCOUNT NAME> <PWD>, both of the machines have to be logged on as admin, but have different passwords on them. I created a account on the remote PC to be used.

I then thought it might have been permission related so I logged in a account that was on both machines and got a different error.

I also tried to make a EXE out of the script that I wrote with AutoIT, and when it was run with AT, nothing would happen.(couldn't really trouble shoot because I don't know how to get the error codes to display or be logged in a file, but maybe later)

It is something with running either the batch files or the EXE with AT that is giving me the problem. That is why I am trying to use AutoIT so that when it gets to 5am, the EXE would copy the files for me.

The BANG HEAD HERE poster on the wall is almost worn out, I hope that this works.

Thanks again for the help..... :lmao:


[font="Verdana"]People who say it cannot be done should not interrupt those who are doing it. - George Benard Shaw[/font]

Share this post


Link to post
Share on other sites

Hi..

jes the At command from windows has many problems, most of them are related to the permission thing... the problem is, the programs started by AT are under an other user.. and have no enviroment variables.. thats why i use "cron" at work..

this works nice :-)

mfg

Share this post


Link to post
Share on other sites

That's what I was thinking, but so far have not found anything on the web pertaining to that.

I'll give cron a try and see how that works, it will be nice to have another option in the pocket.

Thanks again, and BTW, it works great and have had no problems with it so far. What I am working on now is to make it so that it will look at the file size and compare the files at the different locations, if it sees that one is bigger than the other, it will copy it.


[font="Verdana"]People who say it cannot be done should not interrupt those who are doing it. - George Benard Shaw[/font]

Share this post


Link to post
Share on other sites

That's what I was thinking, but so far have not found anything on the web pertaining to that.

I'll give cron a try and see how that works, it will be nice to have another option in the pocket.

Thanks again, and BTW, it works great and have had no problems with it so far. What I am working on now is to make it so that it will look at the file size and compare the files at the different locations, if it sees that one is bigger than the other, it will copy it.

<{POST_SNAPBACK}>

Have cron run an autoit script that compares the filesizes

If FileGetSize($newfile) > FileGetSize($oldfile) then Filecopy($newfile,$location,1)


Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

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