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

include files

Discussion in 'Support' started by luislewis, Sep 26, 2008.

  1. luislewis

    luislewis

    Messages:
    2
    Hi,
    I would like to know if it is possible to include files in a 4NT script like you can do in C++ with

    #include<iostream.h>

    something like that.

    Best Regards
    Luis Daniel A. Lewis

    P.S. I use right now Version 6.01 and I am considering to upgrade to Version 9
  2. Charles Dye

    Charles Dye Super Moderator Staff Member

    Messages:
    2,558
    I think you want the CALL command.
  3. Steve Fabian

    Steve Fabian

    Messages:
    3,531
    JP Software Forums" <neil@jpsoft.com>; "luislewis wrote:
    | Hi,
    | I would like to know if it is possible to include files in a 4NT
    | script like you can do in C++ with
    |
    | #include<iostream.h>
    |
    | something like that.

    "Include" is useful in source files that are compiled into executable
    programs. Batch programs, stored in batch files, are interpreted and
    executed one command at a time. For over 15 years (since the very first
    version of 4NT) the CALL command (as mentioned by Charles Dye) has been
    available to execute another batch program in the middle of the current one,
    and continue. The called program can contain nothing more than
    initialization of variables for the calling program if so desired, but you
    must be aware of the scope of variables, esp. if you use SETLOCAL and
    explicit or implicit ENDLOCAL.
    --
    HTH, Steve
  4. rconn

    rconn Administrator Staff Member

    Messages:
    6,710
    luislewis wrote:

    You can use the GOSUB command to call subroutine libraries in other files.

    Rex Conn
    JP Software
  5. TimButterfield

    TimButterfield

    Messages:
    249
    As has been mentioned, you can use the GOSUB command to call into another batch file. One way to use this functionality as an 'include' is to have an Init in the other batch file that sets up the aliases and functions referenced in that batch file. Take a look at my Array Simulation example in the Tips and Tricks\T&T - Scripting forum. It has an Array.btm as an include/lib that is then used by ArrayTest.btm. The URL BB codes must be turned off, but if you can't find it, here is the link to that post: http://www.jpsoft.com/forums/showthread.php?t=141
  6. luislewis

    luislewis

    Messages:
    2
    Hi Tim,
    Thanks for your answer, I have tried to used but withow any results. I will continue trying and I will get back to you.
    Thanks again.
    Best Regard.
    Daniel

Share This Page