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

Two Issues With TIMER Command In V14

Discussion in 'Support' started by BitPusher, Aug 27, 2012.

  1. BitPusher

    Joined:
    Jan 9, 2009
    Messages:
    40
    Likes Received:
    0
    I just had a chance to upgrade my TCMD V13 to V14 and have run into two problems with the TIMER command. Running On:

    TCC 14.01.33 Windows XP [Version 5.1.2600]
    TCC Build 33 Windows XP Build 2600 Service Pack 3
    Registered to Carl Johnson - 1 System License

    Issue 1:
    Since at least TCMD V9, it was possible to redirect the TIMER command output to NUL so that nothing was displayed. In V14 this causes the following error:
    TIMER ON /1 > NUL
    C:\BP\z.btm [189] Usage : ON BREAK [command]

    Yes, I know there is a /Q option For the TIMER command, but I have over 100 TIMER commands that need to be changed. I can't see any reason why this still can't be made to work since "> NUL" is obviously an invalid command.


    Issue 2:
    Since I got the error with the redirection to NUL, I first thought I would brute force find and "fix" all the TIMER commands by adding /Q and removing the redirection to NUL. Fortunately, I tried this first on the abiove failing command and got this error:
    TIMER ON /Q /1
    Timer 1 on: 13:34:32
    C:\BP\z.btm [189] Usage : ON BREAK [command]

    In my opinion these two issues are bugs, but after my Issue 2 result it seems the only fix at the present time is to revert back to V13.

    Carl Johnson
     
  2. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,075
    Likes Received:
    30
    The options (/1, et c.) belong BEFORE "ON" (the help file should be amended). As you have it, TCC thinks you're trying to time the execution of the ON command.
     
  3. BitPusher

    Joined:
    Jan 9, 2009
    Messages:
    40
    Likes Received:
    0
    Thanks for the reply Vince.

    Is it really a documentation error or a bug?

    Why can't I still redirect the output to NUL? The redirection documentation states in part:
    "Redirection always applies to a specific command, and lasts only for the duration of that command. When the command is finished, the assignments for standard input, standard output, and standard error revert to whatever they were before the command."

    I've got too many .BTMs that need to be changed, and before I spend the time to do that I'm going to wait until this bug and/or documentation is "officially" fixed. I don't plan on doing this excercise twice.

    In the meanwhile I've reverted back to V13.

    Carl

    P.S. I hate it when stuff that has be working for years gets "broken".

    Added by Edit Post:
    After reverting to TCMD V13, B063 I Tried the command TIMER ON /Q /1 and it works just like the documentation states, unlike V14.
     
  4. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,358
    Likes Received:
    39
    Redirection works fine here:

    Code:
    C:\>ver /r
    
    TCC  14.01.33   Windows XP [Version 5.1.2600]
    TCC Build 33   Windows XP Build 2600  Service Pack 3
    Registered to Charles Dye - 5 System License
    
    C:\>timer /1 on > nul
    
    C:\>timer /1 off > nul
     
    C:\>
    
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    8,075
    Likes Received:
    30
    I think it's a documentation omission (don't know about old syntax no longer being tolerated).

    ">" redirects standard output, not standard error messages (as you were getting).
     
  6. BitPusher

    Joined:
    Jan 9, 2009
    Messages:
    40
    Likes Received:
    0
    I think this is a parser bug that got introduced when the [command] option was added to theTIMER command in V14.

    @Charles - Your redirection command is different than the one I used - yours has the parameters in the order Vince showed.

    For 4NT V6
    I still have 4NT V6 ASCII installed because of the FILEREAD,etc. changes that were made after that version and the Help for the TIMER
    command reads in part:
    TIMER [ON | OFF] [/1 /2 /3 /S]

    For V13
    TIMER [ ON | OFF | /Q /S /1 /2 /3 ]
    The TIMER command accepts its parameters in any order...

    For V14
    TIMER [ ON | OFF | /Q /S /1 /2 /3 ] [command]
    The TIMER command accepts its parameters in any order...

    Notice in all those cases the parameters are listed in the order I specified them. Since this has been working with the parameters in the order I specified them since at least 2005 its going to be hard to convince me that this isn't a bug that was introduced in V14 until at least I see the Help updated to reflect that fact. No way I'm going to spend time changing/testing BTMs until I know for sure how this is supposed to work and not some kind of work-around. In the meanwhile V13 is working fine.

    Carl
     
  7. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    10,036
    Likes Received:
    84
    This doesn't have anything to do with redirection; it's the order of your arguments. In v14, TIMER now accepts a command line to execute, so it cannot look for an "ON" or "OFF" or /1 /2 /3 anywhere in the line. It wants the switch arguments (/1 /2 /3 /Q /S) at the beginning of the line, and the optional ON or OFF following them.

    So if you enter the command as:

    TIMER /1 ON > NUL

    it will work in v13 and v14. However, in your example, you don't even need the ON or /1, since that's what TIMER defaults to anyway.

    I can add a kludge to TIMER to check for an ON / OFF as the first argument on the line, but there's no way I could have TIMER accept a mix of switches and ON / OFFs (i.e., "TIMER /1 ON /Q" cannot work).
     
  8. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,520
    Likes Received:
    4
    Backward compatibility has always always been important for JPsoft command processors. Obviously the new feature in V14, being able to time command, breaks this. My suggestion is to use syntax similar to the "single-line DO": make it a command group enclosed in parentheses
    timer [ ON | OFF | /S ] [/Q] [/1 | /2 | /3] [(command group)]
    This change would make it possible to use the old method of parsing the command line up to, but not including, the left parenthesis ( and thus restore backward compatibility. Only the few batch files and aliases created for V14 would be affected. The documentation would need to change, e.g., to:
    "The TIMER command accepts its parameters in any order, except the optional (command group) must be last.

    PS: Note the changed use of optionality and alternate selection in the command prototype above. IMHO it better describes the actual syntax of the command - which are mutually exclusive and which can be used together.
     
  9. BitPusher

    Joined:
    Jan 9, 2009
    Messages:
    40
    Likes Received:
    0
    Thanks for the replies.

    @Steve
    I like you idea best because it preserves backward compatibility.

    @Rex
    1. The reason I specified the timer number is because in some .BTMs I'm using all 3 timers and its clearer to me to see the timer number in the TIMER command. I rarely use "defaults" because they have a bad habit of getting changed.
    2. I like Steves idea better than your "kludge" idea.
    3. If the existing V14 behavior is to be kept:
    A. The fact that the old syntax may not work anymore should have been in the Release Notes.
    B. The Help file needs updated to describe EXACTLY how the parameters need to be specified for trouble free operation.

    Carl
     
  10. BitPusher

    Joined:
    Jan 9, 2009
    Messages:
    40
    Likes Received:
    0
    I had another thought. Add a new parameter /CMD similar to the START command /PGM parameter. That should prevent any positional parameter problems.

    This could be an optional parameter needed only if the command to be executed was named ON or OFF.

    Carl
     
  11. BitPusher

    Joined:
    Jan 9, 2009
    Messages:
    40
    Likes Received:
    0
    I can confirm this problem was resolved in TCMD V14.02, Build 036. Thanks Rex.

    As time permits I'm going to start updating the 93 .BTMs that have the word "timer" in them to reflect the new TIMER command documentation even though the "old" way I specified them seems to work ok now. I'll just bring up each of the .BTMs in my text editor, do a F TIMER ALL WORD, PF5 my way through each file for the word TIMER and makes changes as necessary.

    Carl
     

Share This Page