1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Issue with 4NT

Discussion in 'Support' started by Atom 2, Feb 4, 2010.

  1. Atom 2

    Joined:
    Feb 4, 2010
    Messages:
    4
    Likes Received:
    0
    Hello Forum,
    I am having an issue with 4NT (version 6.01.245U) running on WIN XP SP3. Great product, love it, but the following small batch file (simplied for posting reasons) drives me mad, can't get it to work as expected. The idea is to have a timeout for the loop.

    Code:
    set datetime=%@agedate[%@eval[%@makeage[%_date,%_time] + 600000000]]
    set my_date=%@instr[0,10,%datetime%]
    set my_time=%@instr[11,8,%datetime%]
    do until datetime %my_date% %my_time%
      echos .
      delay 1
    enddo
    4NT always issues a warning that the syntax of the line preceding the enddo (e.g. "delay 1") is incorrect. If I delete that line, it complains about the syntax of "echos ." Error message currently reads as follows:

    .path+name_of_file [8] Syntax: DELAY [/B /M] [seconds]

    It appears to me that the loop is being started (noticeable by the "." being printed on screen and the delay of 1 second), but then, for some obscure reason, it is not able to continue and attributes that to the last statement within the body of the loop.

    I am either blind or it is a bug ...

    Any input greatly appreciated.

    Best regards,

    Klaus
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,307
    Likes Received:
    39
    In 4NT v6, DO UNTIL DATETIME didn't support variables, only a literal (verbatim) date and time. Support for variables in this syntax was added in version 7....
     
  3. Atom 2

    Joined:
    Feb 4, 2010
    Messages:
    4
    Likes Received:
    0
    Charles,
    many thanks for your answer - that explains the issue I was having (and I can also confirm that DO UNTIL DATETIME works with verbatim date and time).

    The error message was very misleading and the help file didn't provide a great deal of help for the DO UNTIL DATETIME command either.

    After a quick thought I have come up with a workaround that should do for the moment as follows - albeit it is not as clear as the original idea:

    Code:
    set endtime=%@eval[%@makeage[%_date,%_time] + 600000000]
    do until %@makeage[%_date,%_time] gt %endtime
        echos .
        delay 2
    enddo
    
    NOTE: The +600000000 actually represents starttime plus 60 seconds (i.e. 1 minute) as makeage works with "age" which is "is the time elapsed since 1601-01-01 00:00:00 (local time) as a multiple of 100 ns" as per the help file.

    Regards,

    Klaus
     
  4. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Charles Dye wrote:
    | ---Quote (Originally by Atom 2)---
    | Hello Forum,
    | I am having an issue with 4NT (version 6.01.245U) running on WIN XP
    | SP3. Great product, love it, but the following small batch file
    | (simplied for posting reasons) drives me mad, can't get it to work
    | as expected. The idea is to have a timeout for the loop.
    |
    | do until datetime %my_date% %my_time%
    | ---End Quote---
    | In 4NT v6, DO UNTIL DATETIME didn't support variables, only a
    | literal (verbatim) date and time. Support for variables in this
    | syntax was added in version 7....

    Regardless, the other potential issue is the DO requires ISO date and
    24-hour time, while you used default (system) format. On my system they are
    the same, but is it on yours?
    --
    Steve
     
  5. Atom 2

    Joined:
    Feb 4, 2010
    Messages:
    4
    Likes Received:
    0
    I was abel to read those requirements from the help file and checked them prior to my initial post. And yes, my default system format is 24-hour time. A 12-hour time format (with am/pm suffix) is only common in English speaking countries like the UK or the US but is only rarely used in German speaking countries like Austria.

    Nevertheless thanks for your thoughts,

    Klaus
     
  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,307
    Likes Received:
    39
    It is an odd limitation and very peculiar behavior, I must agree.

    But it's very very unlikely that Rex will have any interest in revisiting version 6. I'd strongly recommend investigating an update to the current release version 11.
     
  7. samintz

    samintz Scott Mintz

    Joined:
    May 20, 2008
    Messages:
    1,190
    Likes Received:
    11
    Although I haven't tried it, a form of dynamic programming might be
    possible. As I said, I have no idea if this works or not...

    set datetime=%@agedate[%@eval[%@makeage[%_date,%_time] + 100000000]]
    set my_date=%@instr[0,10,%datetime]
    set my_time=%@instr[11,8,%datetime]
    set do_line=do until datetime %my_date %my_time
    %do_line
    echos .
    delay 1
    enddo

    -Scott

    Atom 2 <> wrote on 02/04/2010 11:24:52 AM:


    idea:

     
  8. Atom 2

    Joined:
    Feb 4, 2010
    Messages:
    4
    Likes Received:
    0
    Hi Scott,
    your suggestion works as well - so there are now a few options to deal with the issue.

    Regards,

    Klaus
     

Share This Page