Jump to content
TotalAuto

Can't schedule 5 different .au3 script to run at 5 different times every day???

Recommended Posts

TotalAuto

Howdy All

I've gone around and around in circles wasting hours trying to fix this problem to no avail so I thought I would try posting for help given there are some real smart people in this forum.

Background

I have 5 separate .au3 scripts that all do different basic tasks. For example:

1.au3 = opens Chrome browser to obtain information from a specific website then closes

2.au3 = opens an Excel workbook to run a macro then saves and closes

3.au3 = Open two seperate workbooks and transfers data from one to the other then saves and closes

4.au3 = .......etc

5.au3 = .......etc

These 5 separate scripts, doing completely different tasks, need to each run once per day at 5 different designated times within a day and then close. For example:

1.au3 = 10am

2.au3 = 12pm

3.au3 = 2pm

4.au3 = 4pm

5.au3 = 5pm

Problem

I can not get these different scripts to reliably run at their designated times. When I manually run these scripts individually by using 'Go F5' they work perfectly. If I convert these scripts to an .exe and manually run each one they work about 98% of time.

How can I schedule these different .au3 files or associated .exe files to reliably run each day at different times?

Attempts To Fix The Issue

1. I have tried converting each .au3 script into their own .exe file and use Window's Task Scheduler to run these .exe files at their designated time but the success rate  of running each .exe in full, to completion, without error is very low at about 30%. Things that commonly go wrong include a browser not opening but movement still continues on the desk top. Other times things just do not happen at all.

2. I have Windows 7 64 bit and have tried creating and running both (x86) and (x64) .exe files but again reliability problems exist;

3. I have also tried moving each .exe file to the My Documents folder as I read someone that keeping your files on your desktop ties your files to individual Windows user profiles which can cause AutoIt operating errors. Not sure if this is correct but thought I would try it anyway. It did not fix my issue.

4. I installed a program called AlwaysUp which supposedly always reliably runs in the background and will reliably execute your AutoIt script or .exe files. Still have significant reliability issues.

Therefore, can someone please provide advice on how I can get my 5 different .au3 files to run at 5 designated times through the day, every day, without fail? Overtime I will be creating more and more different .au3 files to run certain tasks throughout the day and do not want to create one large AutoIt file that continually runs and attempts to do all the different tasks itself.

Any help is very appreciated.

Thanks

Dan

 

 

Edited by TotalAuto

Share this post


Link to post
Share on other sites
Danp2

Hi Dan,

Sounds like you need to do some troubleshooting to figure out why the scripts are failing. Does one script fail more often than the others? If so, then that's probably a good place to start. You likely need to add some additional error handling to your scripts so that they can deal with some of these anomalies.

Post one of the scripts so that we can analyze it and give some feedback.

Dan

P.S. Great name BTW. ;-)

Share this post


Link to post
Share on other sites
Alan1234

I do this very same thing with about 12 scripts I want to run at different times of the day.

Add this Loop and set hours, minutes, and seconds to the times you want each script to run using 24 hour clock format.

;Start Loop/////////////////////////////////////////////////////
Local $i = 0
While 1
Do
Until @hour = 04 and @min = 58 and @sec = 55

;Your script goes here

WEnd
;End Loop//////////////////////////////////////////////////////

Then set all scripts to run.  The problem you will have is when you shut down the computer all scripts will need to be restarted the next time you start your computer.  To resolve this issue make a shortcut for each script and move them to your startup directory.

 

Edited by Alan1234

Share this post


Link to post
Share on other sites
rudi

Hello

try this one:

$Time2EndMyScript="142600" ; add some time in 24h format (military time)


While 1
    $Now = @HOUR & @MIN & @SEC
    if $Now > $Time2EndMyScript Then
    MsgBox(0,"Limit check","Time Limit reached, exiting")
    Exit
    EndIf
    Sleep(100)
WEnd

I'd like to suggest to place a "sleep(100)" to the main loop to reduce CPU load.

you might want to place a filewriteline(MyLog.txt,"Start information (time, user, computer, ...)") before the main loop starts, something similar as last line of your script to see, if it's ending in a clean way.

 

Regards, Rudi.

Edited by rudi

Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
Share on other sites
junkew
  • First of all I would add logging to your scripts so you understand better where it fails
    begin: filewrite("Log.txt", "Script 1 started at " & @Hour & @Min & @SEC)
    end: filewrite("Log.txt", "Script 1 ended at " & @Hour & @Min & @SEC)
  • If browser is not started in n seconds you probably have to improve your script to double check your browser is properly stated or kill existing ones first.
  • ...

 

 

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

  • Similar Content

    • PramodR
      By PramodR
      Hello,
      I have to execute below block of code in elevated previllage, as that particular wmic class will work only with admin previlage.
      i am getting out put when i launch autoit as administrator,  but i will not be able to launch autoit as admin in this particular case but my user have admin rights.
      is there any better way i can run those command as administrator.?
      tried below steps:
      i have tried #RequireAdmin but that creates a user prompt  Tried using Runas command but gives error as wrong username or password , stuck with that step.  
       
    • DynamicRookie
      By DynamicRookie
      Hey there!
       
      Is there a way to detect movement only for 1 specific window?

      HWnd is not really working, it still detects movement in all the windows within the region

      This is my script:
       
      ;Checksum actual HotKeySet("{f2}", 'exit_') MsgBox(0, '', '0') Beep(500, 2000) $Hwnd = WinActive('') while 1 $Checksum = PixelChecksum(211, 650, 1094, 914, 1, $Hwnd) If PixelChecksum(211, 650, 1094, 914, 1, $Hwnd) <> $Checksum Then For $i = 1 To 100 Beep(1000, 50) Next MsgBox(0, '', 'New message!', 1) EndIf WEnd Func exit_() Beep(500, 1000) Exit 0 EndFunc I just want to check whenever a message comes because the app i use doesn't give notifications properly.

      Any help is really appreciated!
    • PramodR
      By PramodR
      Can you please see whats wrong im doing in the below code? i can read few registry entry but not all for eg, i am able to get value of "Shell" Key from the registry path  but not AutoAdminLogon which has the value of "1", is there any change i have to do to read numeric values?
       Global  $shello = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","Shell" )
       ConsoleWrite("This is Hello"& $shello)
      above command returns proper value , but same command with AutoAdminLogon returns null as shown in below ? infact registry has the value of 1.
       Global  $shello = RegRead ("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","AutoAdminLogon" )
       ConsoleWrite("This is Hello"& $shello)
    • Eminence
      By Eminence
      Hello,
      I've been searching on how to select the first row in my database which includes a time column based on the latest start_time date for today's date.
      This is my current code:
      Local $iCurrentDate = _Now() Local $sqlHandle = _dbOpen($sDbPath) Local $aResult, $iRows, $iCols _SQLite_GetTable2d($sqlHandle, "SELECT start_time FROM " & $srawDb & " ORDER BY datetime(start_time) DESC LIMIT 1", $aResult, $iRows, $iCols) _ArrayDisplay($aResult) _dbClose($sDbpath) What it does is it gets the first row entry in the database however it does not select the latest start_time entry in the database, it always select the first row. I've tried changing DESC to ASC to see if that will do it but the issue still remains. Any thoughts on this? Thanks in advance.
       
      *EDIT
      The date format in the database is by MM/DD/YYYY HH:MM:SS.
    • Trisha
      By Trisha
      Hello,
      I Have clicked on save as option to save a file, while doing that I need to rename a file appending with sysdate. I have searched in google find the below one line of code:
      FileMove("C:\somefile.txt", "C:\somefile1.txt"), When I am trying to append with sysdate. It is not happening. Please help me out  with the small issue.
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.