# Trainz/AM&C/Setting up PEVtools

Back to the Top
* Trainz Asset Maintenance and Creation Content Manager skills tutorials for Trainz
* TOC | Beginnings | Fun | AM&C | Creation | InBook Refs | ORP Refs:  • Index • Containers • Kinds • Tags | Appendixes  • Vers
Glossary :
HKeys-CM :
HKeys-DVR :
HKeys-SUR :
HKeys-WIN :
Mouse use :
Notations :

## Acquiring and Installing PEVs tools

For the foreseeable future, PEV's tools will be maintained by the community on one website or another as they are invaluable. Peter V. is a real programmer situated on the opposite (or Sydney) side of Australia from N3V/Auran's small town location on the Gold Coast near Brisbane, but ceased hosting his tools on his own website in mid-2013 when the task was taken over by Trainz fan Shane Turner on his help site here.
* Locate PEVs tools on Shane's site and their accompanying manuals where given.
* Download the tools (zip files), and quit out of any Trainz you may be running.
** As always when quitting Trainz, Hit [CTRL][SHFT][ESC] to bring up file manager to watch until the TADdaemon module exits before doing anything else.
** Once the TADdaemon closes it is safe to reboot or otherwise mess with Trainz directories (backup the folder, duplicate the local folder, or other maintenance)
** Set a system Restore point, label it as Pre-PEVtools installation then reboot.
* The next thing you want to do is figure out where to put the PEVtools. Generally, they should be installed in the Windows PATH; which can be changed to include the new tools directory from the Windows Environment settings. You can also just add them to a folder already in the Path.
** To see your current path, type ⊞ Win+R and enter CMD↵ Enter to enter pseudo-DOS mode. Type 'PATH'[ENTER] and the display will list the current path loaded during Windows boot up.
** If the list already includes a Tools directory, well and good—in the next step, move the PEVtools zip files to that folder.
** If not, suggest creating a tools folder off the root so the pathspec added is short. Either x:\Tools or x:\PEVsoft are recommended; where 'x' is a drive letter of a hard disk or SSD drive. Tip: Putting the Tools folder on the same drive as where you have most Trainz installs is a good idea. From time to time, you may want to manually edit the PEVtools ini files, and having them easy to navigate to, has time saving benefits.
** Each of the PEVtools will create a subfolder for itself in the particular Tools folder you set up. This is actually something of a pain, so when installing, just override the path with the subfolder name (e.g. instead of PM2IM, use \Tools or PevSoft as the place to expand the zip folder. Each tool has it's own INI file which will be automatically initialized the first time you run the application. It will know where it's being initialized from (it creates the correct path in the tool launchers it installs in Trainz), so having them in separate subfolders is purely a waste of resources. Tip: In case you have to reinstall, we do recommend keeping the zip files. Move them into a PEVtoolZips subfolder once your tidying up.
* Open your downloads folder, and
** highlight the PEVtools zip files. If the items are separated, use ⇧ ShiftLMBclick to select the biggest group.
** next holding the [CTRL] key down, LMBclick the other less well grouped PEVtool zip files.
** Once they are all highlighted, use ⊞ Win+E to open a new Window with a navigable folder. Navigate to and open up your target tools folder. ALT+Tab ↹ should return you to the downloads folder as the active Window, with the group of zip files already highlighted.
** Now type CTRL+X to begin the moving the files process...
** Type ALT+Tab ↹ to return to the Tools folder as the active Window, LMBclick on it's open surface, then type CTRL+V to complete the move of the files. Tip: (This method works with all Windows versions and across differing Drive letters; in other words, always. OR... Drag and drop if you know How!) Editor's note: Each of PEV's tools will ask if you have TS2009, TS2010, TS2012 and TANE, then store the information in an .ini file in a sub-directory specific to that tool (e.g. Images2TGA.ini, QuickShadows.ini, MeshViewer2.ini, etc.). Consequently some power users prefer to install PEVs tools in an easy to reach common directory with a brief name and include the folder in the path (Very DOS era, but PEVs tools are handy used in a batch file and the ability is in all Windows versions still.) See PEVtools for some useful tricks and methods with batch files beyond the basic auto-install.

### Installing

* Before running any of the PEVtools, make a text file (Notepad or Notepad++, etc.) with the full path of each of your Trainz versions (TS2009--TANE). You'll avoid confusion this way, and can just cut and paste the values when prompted as the PEVtools initialize.
* In Windows VISTA and newer Windows versions including Windows 10... in succession Right Click-Hold to Launch,(drag toRUN AS ADMINISTRATOR dropdown, and release to launch) each of PEVs tools in succession.
** From here it's a rather repetitious boring process for each PEVtool... paste in the Trainz folder names set off above in the text file until all the PEVtools are initialized.
* Once your tools are initialized in each of the TRAINZ versions you have installed, you will be able to look for the resultant batch file (*.bat) tools under the path the Version-path root folder \bin sub-directory the path ...\bin\CMPData\tools\OpenWith folder will each contain a set of PEVtools installed in each version of Trainz.
* These batch files can be improved.
** The freeware utility FNR.EXE can be added to the batch files which convert PM mesh files to IM files (at this point for you, PM2IM.bat). Add the following line: "C:\PEVSoft\fnr.exe" --cl --dir %1% --fileMask "*.txt" --excludeFileMask "*.dll, *.exe" --includeSubDirectories --find ".pm" --replace ".im" . This line will stop you from forgetting to update and change the extensions in many a config.txt file. Google that name ('FNR.EXE' and download it. Add it to the PEVtools folder) If you put your tools on a different path, such as F:\Tools (like one of my computers)—make sure to make all the paths in the batch files and especially that of FNR match and point to the same folder.
** The batch family from Peter can also be improved by merging a few of the batch files.
*** Highly recommended is creating a Images2TGA+PM2IM.bat file (You've got PM2IM open now, so Click on Images2TGA and copy it. rename as indicated, then open it for edit. Copy the changed PM2IM lines after the Images2TGA line and you have a great time saver. Tip: This editor uses this file 90% of the time when fixing or updating assets.
*** What about Traincars? How about making a "All-In-Sequence.bat" and "All-but-Traincar_Viewer.bat"? (NOTE: Assets older than v2.5 won't work with Traincar viewer—at least not until you edit the TBV past v2.5 and add a mesh-table container. The Viewer will directly open mesh files so they can be viewed whilst making fixes and to create thumbnails. More on that below.)
* This process could be done in each Trainz install, but if you run several versions of Trainz like some of us, to install PEV tools in each, just copy the files to the off-version, including overwriting them. (i.e. Use the same Highlight, CTRL+C (Copy), Alt-Tab switch or navigate method used for moving the zip files from your downloads folder, with the same Paste down using CTRL+V for each Trainz tools folder ‌(and as next discussed also the ..\UserData\editing folder(s).)
* The batch files can also be often be more usefully used outside Trainz CM by copying these into the ...UserData\editing folder. • In this location one can open the asset for editing, then drag and drop the folder into the PEVsoft batch tool. Easy-Peazey and fast as grease lightning too!
* Now to tidy up. Above we went to lengths to recommend installing PEVtools in the path. Since there are some occasions where you want to run PEVtools directly, now is the time to add the folder into the environment PATH variable where Windows can find it.
** Type ⊞ Win > Control panel > Settings > System and select the 'Advanced' Tab.
** Click on the button near the bottom (New Windows versions may just use hyperlinks) that says 'Environment' and highlight the Path variable then click edit.
** The value field will be already highlighted. Capture it with CTRL+C and paste it (CTRL+V) into that already open text editor (or open it again) so you can see it clearly. Paste it down a second time, to keep one as a backup, just in case! (Editor's will be duplicated below)
** Like my 'PEVSoft' tools directory, add your Tools folder to the Windows path of the second copied to the editor.
** Highlight the revised line, and ALT+Tab ↹ to the Advanced Tab's API and CTRL+V to paste it in as the new Path. Click OKAY then OKAY and OKAY to close the System Properties. PEV's tools are now fully installed.

#### Editor's Path specification (Environment variable 'Path')
## Some fine points

Windows can set associations with file types either through Folder Options in the menuing or by using a RMBh option. The former method limits one to one application per type, the second can be finessed to know of several applications which can open said file type, then present the short list when asked to 'open with' but defaulting to a preferred application by using RMBh.
* This multiplicity is especially useful for image (graphics) files, and most of the file types commonly accessed during the process of updating or fixing a faulty asset.
* We recommend the following parallel associations, and will walk you through the process below for the PEVtools:
** jpg, png, and tga file types should be associated with multiple graphics applications capable of handling the data type. Assuming only Windows and freeware tools, GIMP, XN-View, PAINT.NET, IrfanView, and Windows Paint.exe & Picture and Fax Viewer should be associated with all but the TGA files.
** The TGA files should be associated with the non-Windows applications, because Windows doesn't process TGA formatted files.
** The Trainz Mesh data types PM and IM, should be associated with Quickshadows, PM2IM, surprisingly Images2TGA and last but not least, as the default, Mesh Viewer2.exe.

### Setting file associations

Setting a file association is simplest when there is a file type you need to manipulate, use, or process.
* Navigate to a file folder with a data file you want to set an association for. Use ⊞ WinE to open an explorer Window if necessary. • Tip: For this exercise, it would be easiest to open an asset (say a Built-in building or industry) for editing in Content Manager. Such a file folder will have a file of each type needed. • Tip: Trainz keeps a backup, and restoring the status quo ante is easy using revert (restore) CTRL+R in the CM main view, after selecting the asset. This makes things so the edit never happened. (Handy if you mess up a repair, N'est pas!?))
* SHFT+CTRL+E will open a file for edit, and also opens an Window displaying that folder as the active window. You can leave Content Manager running and use ALT+Tab ↹ to keep switching between active windows when and if necessary.
* LMB-click on the target file to select it. (Mesh files will have either an IM or PM extension. If your chosen asset has only PM files, there are two solutions:
** Navigate up one level to the \editing folder. Given that you copied the PEVtools batch files to the editing folder as instructed above, when you go up one level the asset folder will already be highlighted. Drag the folder icon over the PM2IM.bat or Images2TGA+PM2IM.bat utilities and let go the mouse button. The batch will convert the PMs to IM files. Tip: Both mesh files and texture files are technically copyrighted intellectual properties under international laws. PM2IM has a setting to replace the PM with an IM, or just convert and have both versions. Respect for the CC, suggests the latter setting would be best, and it give one a backup option if the IM file creation comes out corrupted, although that is very unlikely.
** The alternative is to run PM2IM during the open with operations after associating the other apps desired to open the files. Note, in some versions, the file will not have native TGA files—but compressed combined TGA plus texture.txt files with a .texture extension, so also running the Images2TGA+PM2IM utility tool or Images2TGA.exe will be necessary while you initialize your set ups. Using the first option will give you practice and more importantly, provide the files needed for associating to the graphics programs below. Hint: Flip a coin unless one or the other catches your fancy first.This view shows an IM file selected, the RMBh+drag with the second level drop down showing already listed programs for the file extension (file type) and the Windows 7 'Choose default program' button to launch a Browse, select App, and make it default. Other Windows OS may differ slightly.
* Using RMBh+drag on the file the Windows drop down menu should show a line which says Open (indicating the default application, which may be undefined as yet) and a bit lower, an 'Open With' bar. When you let the drag down highlight hoover on that bar and release the RMB button, an API will open listing a number of Windows applications. With externally installed applications such as the graphics programs above or PEVtools, when they aren't a default application, they likely will not be listed in the quick list, so the Browse button must be used.
* Once browsing, Navigate normally to the PEVtools/Tools folder. If you followed the above instructions as meant, all the PEVtool exe files will be in that folder with their respective INI files. • Timesaver: When you get to the graphics applications, you will need the paths to the applications exe files. If shortcuts are installed on your desktop, ALT+↵ Enter opens the shortcut properties API. Copy and paste the path into Notepad or another text editor for each, so you won't have to guess when you are trying to get somewhere ASAP!
* In this process, we want to associate each possible tool with the extension in succession as the default application. So you need not redo the association, save the app you want to be the default as the last one to associate.
* LMB click on the application you 'least want' to be the default application.
** For the TGA Image files, suggest the order: GIMP, PAINT.NET, and end with IrfanView as the default.
** For the PM Mesh files: PM2IM, Quickshadows, and end with Mesh Viewer2 as default.
** For the IM Mesh files: Images2TGA, PM2IM, Quickshadows and end with Mesh Viewer2 as default. • Why?: Images2TGA in direct mode has a feature allowing a process known as 'Texture stripping' which is needed to fix a small percentage of assets which have trouble opening the TGA file when specified correctly in a texture.txt file.
*** These files may contain non-ANSI alphabet characters used in non-English alphabets; which are illegal in Trainz; and which need to be converted to ANSI text names.
*** The PM files are being ignored, save for being archived, so stripping these is not necessary. • By opening the Mesh files with Images2TGA, in direct load mode and first selecting 'Convert IMs' in the options, these mesh files are updated to contain Trainz-legal string names matching those already converted and found now in the texture.txt files.
* In succession, associate each applications program (Tools) with the extension.
* Each application will give you a look at it's behavior, options and results when run directly sans a batch file launching.
* End with the program best used as the default.

## PEVtools batch files

* Batch file examples are in the {{TL|Trainz/AM%26C/PEVtools#Using_PEVtools_in_batch_files_outside_CM|Using PEVtools in batch files outside CM section]] in the PEVtools use article.

## Notes, Footnotes & References

Config.txt files are endemic and ever present in Trainz assets, for no asset can be defined without this type of Computer Science container. The keyword-value_of_key pairing must always be kept in mind in editing or creating Trainz content. The TrainzBaseSpec contains values and containers which are most common in asset defining config.txt files.

### Notes

* ↑ The Windows Path environment variable is the list of folders that Windows searches for executable files (*.com, *.exe, *.bat, *.cmd and a few others less common)

### References

* Trainz printed or pdf file Manuals, applicable version - usually in the ..\extras or ..\extras\manuals folder
* TrainzOnline Wiki Config.txt file page and various other pages
* TrainzOnline Wiki: Content Creator's Guide pages (various)
* Various CCG and Auran websites