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

    Joined:
    Sep 26, 2008
    Messages:
    2
    Likes Received:
    0
    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
     
    #1
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    2,725
    Likes Received:
    14
    I think you want the CALL command.
     
    #2
  3. Steve Fabian

    Joined:
    May 20, 2008
    Messages:
    3,531
    Likes Received:
    4
    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
     
    #3
  4. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    7,198
    Likes Received:
    21
    luislewis wrote:

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

    Rex Conn
    JP Software
     
    #4
  5. TimButterfield

    Joined:
    May 20, 2008
    Messages:
    275
    Likes Received:
    1
    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
     
    #5
  6. luislewis

    Joined:
    Sep 26, 2008
    Messages:
    2
    Likes Received:
    0
    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
     
    #6

Share This Page