Code in your Tech Database not running on my Win8.1/WB 2021 computer

Started by mjwillyone, December 03, 2021, 05:40:56 AM

Previous topic - Next topic

mjwillyone

Hello,

I get an error when I ran the Alarm Clock code from your tech support page:  https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsrch.web+WinBatch/Time~-~Timer~and~Date~Functions+TechHome/WinBatch/Time~-~Timer~and~Date~Functions

I was attempting to learn more about time coding/functions.

I have attached an image of the error


td

Which article are you referring to? Perhaps you have a copy&paste issue like the one you had adding the URL to your post?
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

jmburton2001

I've done a LOT of work with time over the years and it's actually fairly simple. Just like Tony, I have no idea what you're referencing here but I do see by your error that you have a "bad value".

Working from your error and the variables (trytime, now, x) it contains, the following code works famously.

Code (winbatch) Select
now = TimeYmdHms( )
Display (5, "5 second display", "Do something for 5 seconds")
trytime = TimeYmdHms( )
x = TimeDiffSecs(trytime, now)
Message ("Seconds Passed",x)


A good place to start is to search for "Time Functions" in the Consolidated WIL Help file. There are plenty of examples as well as explanations of the various time functions.  ;)

td

Just a guess but the OP may have been referring to the following article:

https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Time~-~Timer~and~Date~Functions+Alarm~Clock~Script.txt

If so it dates back 20 years or so and it does have a minor coding error. The line
 
Code (winbatch) Select
trytime=strcat(strsub(now,1,9),a,":00")

should read
 
Code (winbatch) Select
trytime=strcat(strsub(now,1,11),a,":00")

It is a trivial thing to find and correct once the script is executed in a WBS debugger.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade