Take command exiting... - Protocols

This is a discussion on Take command exiting... - Protocols ; With out trying to get too depp in it - I am processing an array that is populated with mulitple kermit command files, for the sake of complexity lets say 10 command files are in the array, if there is ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Take command exiting...

  1. Take command exiting...

    With out trying to get too depp in it - I am processing an array that
    is populated with mulitple kermit command files, for the sake of
    complexity lets say 10 command files are in the array, if there is a
    problem with command file # 5 and it is not processing corectly, is
    there a way to fail #5 command file and resume on #6 command file?

    example of code :
    assign \%v \ffiles(*.ksc)
    declare \&b[\%v]
    for \%j 1 \%v 1 {
    take \&b[\%j]
    }

    This may have been answered somewhere else and not seen it.

    Thank you in advance for your help.
    Malone


  2. Re: Take command exiting...

    On 2005-11-30, malone wrote:
    : With out trying to get too depp in it - I am processing an array that
    : is populated with mulitple kermit command files, for the sake of
    : complexity lets say 10 command files are in the array, if there is a
    : problem with command file # 5 and it is not processing corectly, is
    : there a way to fail #5 command file and resume on #6 command file?
    :
    : example of code :
    : assign \%v \ffiles(*.ksc)
    : declare \&b[\%v]
    : for \%j 1 \%v 1 {
    : take \&b[\%j]
    : }
    :
    Sure. When it detects that it has a problem, just have it give an END
    command.

    - Frank

  3. Re: Take command exiting...

    That is just it, if it does not detect a problem or if it runs into a
    condition that was not previously available it continues with the input
    / output dialog. I do not want to ctrl-C out of the script of about 100
    command files to open command file #5 insert an end and then call the
    initiating script again.

    I know I could fix the problem and call only those files that were not
    called earlier but I would prefer to only bypass the command file that
    had the problem and continue processing the other 100 command files.

    What exactly is the Input cancellation command? and is that a way that
    I can cancel the input dialog and enter an end?


  4. Re: Take command exiting...

    malone wrote:
    > That is just it, if it does not detect a problem or if it runs into a
    > condition that was not previously available it continues with the input
    > / output dialog. I do not want to ctrl-C out of the script of about 100
    > command files to open command file #5 insert an end and then call the
    > initiating script again.
    >
    > I know I could fix the problem and call only those files that were not
    > called earlier but I would prefer to only bypass the command file that
    > had the problem and continue processing the other 100 command files.
    >
    > What exactly is the Input cancellation command? and is that a way that
    > I can cancel the input dialog and enter an end?



    What are you doing in the 'command files'.

    It seems you need to make them more robust. I.e., every 'output'
    command should be followed by an 'input' with a time out that checks
    for the expected response and that followed by an 'if failure ...' . If
    you simply want to stop that command file, but continue the higher
    level script, this could just be 'if failure end' or 'if failure end 0
    message to print'. Other commands like send and get should also be
    tested with 'if failure' or 'if success'.

    Here's a piece of script as an example. These use 'end 1' because I
    want this to signal failure to a caller, but you could use 'end 0' to
    signal success. Of course, if you don't test success/failure/status in
    the caller, it doesn't matter :-)

    set host /pty ssh -e none -l \v(userid) \m(rhost).\m(rdomain)
    if fail end 1 Unable to connect to \m(rhost).
    input 30 assword:
    if fail end 1 No password prompt.
    output \m(pswd1)\13
    input 20 \m(rhost)
    if fail end 1 No shell prompt.
    input 5 %
    if fail end 1 No shell prompt.
    output kermit -Y\13
    input 20 C-Kermit>
    if fail end 1 No Kermit prompt.
    output set receive pathnames relative\13
    set send pathnames relative
    input 20 C-Kermit>
    if fail end 1 No Kermit prompt.
    output set file collision update\13
    input 20 C-Kermit>
    if fail end 1 No Kermit prompt.
    output server\13
    input 20 SERVE...
    if fail end 1 Not in server mode.
    input 2 \10
    if fail end 1 How can this be?
    ....

    In your case, you may need to test for something more complex than
    another prompt or look for something with input that signals failure,
    e.g.

    input 5 error
    if success end

    Or you may need to test some environment variable or \v(exitstatus).

    --
    Mark Sapiro msapiro at value net The highway is for gamblers,
    San Francisco Bay Area, California better use your sense - B. Dylan


  5. Re: Take command exiting...

    Ok I understand what you are saying. I will have to try that.

    another question:
    is there a way to monitor keyboard activity during a script?

    i know it monitors the ctrl-C but can i monitor other keys like 'A' or
    'V' maybe using the \v(kbchar) or kbhit ?

    thanks again..
    Malone


  6. Re: Take command exiting...

    On 2005-12-01, malone wrote:
    : Ok I understand what you are saying. I will have to try that.
    :
    : another question:
    : is there a way to monitor keyboard activity during a script?
    :
    : i know it monitors the ctrl-C but can i monitor other keys like 'A' or
    : 'V' maybe using the \v(kbchar) or kbhit ?
    :
    Off the top of my head:

    IF KBHIT
    SET INPUT CANCELLATION ON ; lets you interrupt INPUT from the keyboard
    SET PAUSE CANCELLATION ON ; lets you interrupt PAUSE/SLEEP from the keyboard
    Ctrl-C can be trapped by a macro called ON_CTRLC

    Any command that times out, like PAUSE, SLEEP, or INPUT, can be interrupted by
    a keystroke if the corresponding SET xxx CANCELATION is ON, and the character
    that was typed is available in \v(kbhit). Let's see, what else...

    Commands like ASK and GETC and GETOK can be told to time out. So, for
    example, you can do something like this:

    set ask-timer 10
    getc \%c "Press any key within 10 seconds to quit:"
    set ask-timer 0
    echo
    if asktimeout {
    echo Continuing...
    } else {
    echo You typed: \%c
    end
    }

    - Frank

  7. Re: Take command exiting...

    I forgot about the Ask command
    Thank you I believe that will help me alot.

    Malone


+ Reply to Thread