.
Results 1 to 5 of 5

Thread: TrainzUtil in TRS19

  1. #1
    Join Date
    Jun 2011
    Location
    Binghamton, NY, USA
    Posts
    538
     

    Default TrainzUtil in TRS19

    I have a technical question about the operation of TrainzUtil under TRS19. I hope I am in the right place.

    It's my understanding that TrainzUtil is an interface for external tools to request information from Trainz (among other things) in a controlled way.

    In TRS19 settings, I have advanced debug tools enabled, so I think I have properly enabled the use of TrainzUtil. If I open a command line window and go to the path where TU is installed, I expect to be able to issue commands to it.

    So, I enter a command like "@tuquery.txt > turesponse.txt", where tuquery.txt contains a series of STATUS commands, with the KUIDs all enclosed in double quotes. In response, I get the message "TANE.EXE is not running." Interesting, because this is TRS19. Puzzling, because it's also my understanding that TrainzUtil should be "standalone", in a sense. In other versions of Trainz, I don't have to start anything else running, I only have to issue the command to TrainzUtil.

    If I double-click my TRS19 icon on the desktop so that the Launcher is displayed, then return to the command line window and repeat the above command, it works fine.

    So... what am I not understanding and/or what am I doing wrong? I will be most happy to be told I am missing something basic here.

    Thanks and Regards,
    Mike

    EDIT: I see now, on the TrainzUtil page, that the T:ANE message should be fixed in SP3, and that it does state that the main TRS19 exe also needs to be running to use TrainzUtil. So I guess, in my application, I'm going to have to tell the user to perform a manual step, rather than being able to do things in a fully automatic way.
    Last edited by ModelerMJ; September 3rd, 2021 at 07:30 PM.
    606026 / TRS19 114800 / TRS22 SP1 119451
    W11 Pro 64 21H2 / i7-11800H 2.3GHz, 64GB DDR4, NVidia GeForce RTX 1060 6GB

  2. #2
    Join Date
    Nov 2006
    Location
    Australia, QLD, Pimpama
    Posts
    9,673
    Blog Entries
    30
     

    Default

    TrainzUtil is now a command in the Launcher Developer dropdown menu. I managed to get a batch file working but not piped into a text file. But this command in a command prompt window did work:

    C:\Users\Paul>"e:\n3v games\trs19 trainz plus\trs19\trainzutil" @"d:/@working/batch.txt" > D:\@working\report.txt

    The quotes appear to be necessary for the Trainzutil part but not the Windows pipe bit.

    The TS19 Launcher must be running though. I'm sure this has been the case since TANE.

    Paul


  3. #3
    Join Date
    Jun 2011
    Location
    Binghamton, NY, USA
    Posts
    538
     

    Default

    Thanks for the info. The pipe is just a temporary thing for now to get me through a development phase. I’m working in C# and in the final case I will be using the Process object to run TrainzUtil and reading the result from the default output stream. But there still remains the need for Trainz itself to be running in those 2 cases. Having said that, I have some ideas about how to handle that now.

    Much appreciated.

    Regards,
    Mike
    606026 / TRS19 114800 / TRS22 SP1 119451
    W11 Pro 64 21H2 / i7-11800H 2.3GHz, 64GB DDR4, NVidia GeForce RTX 1060 6GB

  4. #4
    Join Date
    Nov 2006
    Location
    Australia, QLD, Pimpama
    Posts
    9,673
    Blog Entries
    30
     

    Default

    Be prepared to do some parsing of the output file as TrainzUtil echoes back the command itself plus some extra stuff at the start of each line of output. For example, in my test I asked to print out the config of a test asset and this is what I got - I deleted a few lines to reduce the size.

    Code:
    ; <NULL> : @d:/@working/batch.txt  ; <NULL> : printconfig "<kuid:186372:890014>" ">" "d:\@working\report.txt"
        ; <NULL> : + Start of <kuid:186372:890014> dump
        ; <NULL> : ?
        ; <NULL> : kuid                                    <kuid:186372:890014>
        ; <NULL> : kind                                    "scenery"
        ; <NULL> : category-class                          "XVG"
        ; <NULL> : category-era                            "2010s"
        ; <NULL> : category-region                         "00"
        ; <NULL> : description                             "Paint test"
        ; <NULL> : 
        ; <NULL> : mesh-table
        ; <NULL> : {
        ; <NULL> :   default
        ; <NULL> :   {
        ; <NULL> :     mesh                                "mini-carriage.im"
        ; <NULL> :     auto-create                         1
        ; <NULL> :   }
        ; <NULL> : }
        ; <NULL> : username                                "AAA PC Paint test"
        ; <NULL> : trainz-build                            3.7
        ; <NULL> : 
        ...
    
    
        ; <NULL> : }
        ; <NULL> : + End of <kuid:186372:890014> dump
      ; <NULL> : status "<kuid:186372:890014>" ">>" "d:\@working\report.txt"
        + <kuid:186372:890014> : eIabdpLmfouXcY : SY;SCEN : AAA PC Paint test
    OK (0 Errors, 0 Warnings)
    While typing out this post it occurred to me that you could probably extract elements of a config if that was of interest.

    Paul


  5. #5
    Join Date
    Jun 2011
    Location
    Binghamton, NY, USA
    Posts
    538
     

    Default

    Thanks again. I’m actually already parsing the return file and indeed it does require some filtering. I have also written a fairly capable config.txt parser that can drill down to all the various levels, although I can see it’s going to need more work to deal with all the NULLs being returned.

    This has been very informative and I do appreciate your time. If you’re interested, the project that involves this work is being described and discussed here:

    https://forums.auran.com/trainz/show...ions-of-Trainz

    Regards,
    Mike
    Last edited by ModelerMJ; September 5th, 2021 at 07:57 AM.
    606026 / TRS19 114800 / TRS22 SP1 119451
    W11 Pro 64 21H2 / i7-11800H 2.3GHz, 64GB DDR4, NVidia GeForce RTX 1060 6GB

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •