viewpoint-particle

Author Topic: Code in your Tech Database not running on my Win8.1/WB 2021 computer  (Read 756 times)

mjwillyone

  • Jr. Member
  • **
  • Posts: 50
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

  • Tech Support
  • *****
  • Posts: 4045
    • WinBatch
Re: Code in your Tech Database not running on my Win8.1/WB 2021 computer
« Reply #1 on: December 03, 2021, 07:37:34 am »
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

  • Full Member
  • ***
  • Posts: 124
Re: Code in your Tech Database not running on my Win8.1/WB 2021 computer
« Reply #2 on: December 03, 2021, 10:29:14 am »
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
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

  • Tech Support
  • *****
  • Posts: 4045
    • WinBatch
Re: Code in your Tech Database not running on my Win8.1/WB 2021 computer
« Reply #3 on: December 03, 2021, 10:37:42 am »
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
 trytime=strcat(strsub(now,1,9),a,":00")

should read
 
Code: Winbatch
 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