Jump to content

Auto run vs. Manual run


Recommended Posts

I'm stumped!

When I run this compiled program automatically as a scheduled run at 14:30 it fails. When I manually start the program it runs fine. Pertinent information: It checks the system time and day of week. Based on this result it adjusts (looking for an FTP file that is available Monday - Friday (after 2 -2:30 pm). Normally it looks for today's file. If I run the program before 2:00 pm Tues - Friday it looks for yesterday's file. On Saturday and Sunday it goes back to Friday's file and on Monday morning it looks back to Friday's file. As you can see in the automatic run even though it correctly knows the time ($DTArray[1]) and day of week ($DTArray[3]) it fails the Select. In the manual run it works fine.

Any thoughts on why it fails?

Thanks for your help!!!

-Tom

CDP Log - Auto Run.txt

CDP Log - Manual Run.txt

Code Snippet.txt

Link to comment
Share on other sites

One thing I noticed, the line below has a problem. If the hour = 14 then it will not run the case, so your example was correct as far as your code goes, there was no case selected. It should read <= 14 to catch the time when it's 1400-1459 because right now it won't.

Case (($DTArray[3] > 2) And ($DTArray[3] < 7) And ($DTArray[1] < 14))

As for the rest, it looks ok, but I haven't delved into it too deeply yet.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

How are you running it automatically? Are you using Task Scheduler? If so, are you using the current logon credentials to run it or are you using another accounts credentials? Another question: are you launching it from a shortcut or from a different location (wondering if there might be a problem with a variable like @scriptdir).

The reason why I'm asking is that it should run the same whether it is started automatically or manually. It seems to me that it may be factors outside the program that are affecting it.

Clearly, the problem ultimately lies in the fact that none of the 5 cases are met with being run automatically. You might want to do some testing with the Case Else statement to display the values of $DTArray[3] and $DTArray[1]. It may give some clues as to what is going on.

#include <ByteMe.au3>

Link to comment
Share on other sites

AHA! I bet that is it! Every time I have run it manually it has been after 15:00 - so it works. It is failing at 14:30 because, normally Case 1 should be selected and $DTArray[1] is = 14 not > 14.

Thank you! Thank you!

-Tom

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...