Trainz/AM&C/Setting up PEVtools

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.
 * 1) Locate PEVs tools on Shane's site and their accompanying manuals where given.
 * 2) Download the tools (zip files), and quit out of any Trainz you may be running.
 * 3) 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.
 * 4) 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)
 * 5) Set a system Restore point, label it as Pre-PEVtools installation then reboot.
 * 6) 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.
 * 7) To see your current path, type  and enter CMD to enter pseudo-DOS mode. Type 'PATH'[ENTER] and the display will list the current path loaded during Windows boot up.
 * 8) If the list already includes a Tools directory, well and good&mdash;in the next step, move the PEVtools zip files to that folder.
 * 9) 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.
 * 10) 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  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.
 * 11) Open your downloads folder, and
 * 12) highlight the PEVtools zip files. If the items are separated, use  to select the biggest group.
 * 13) next holding the [CTRL] key down,  the other less well grouped PEVtool zip files.
 * 14) Once they are all highlighted, use  to open a new Window with a navigable folder. Navigate to and open up your target tools folder.  should return you to the downloads folder as the active Window, with the group of zip files already highlighted.
 * 15) Now type  to begin the moving the files process...
 * 16) Type  to return to the Tools folder as the active Window,  on it's open surface, then type  to complete the move of the files.

Installing

 * 1) 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.
 * 2) In Windows VISTA and newer Windows versions including Windows 10... in succession Right Click-Hold to Launch,(RUN AS ADMINISTRATOR dropdown, and release to launch) each of PEVs tools in succession.
 * 3) 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.
 * 4) 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.
 * 5) These batch files can be improved.
 * 6) 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)&mdash;make sure to make all the paths in the batch files and especially that of FNR match and point to the same folder.
 * 7) The batch family from Peter can also be improved by merging a few of the batch files.
 * 8) 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.
 * 9) 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&mdash;at least not until you edit the TBV past v2.5 and add a . The Viewer will directly open mesh files so they can be viewed whilst making fixes and to create thumbnails. More on that below.)
 * 10) 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,  (Copy), Alt-Tab switch or navigate method used for moving the zip files from your downloads folder, with the same Paste down using  for each Trainz tools folder     (and as next discussed also the ..\UserData\editing folder(s).)
 * 11) 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!
 * 12) 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.
 * 13) Type  >  >  >  and select the 'Advanced' Tab.
 * 14) Click on the button near the bottom (New Windows versions may just use hyperlinks) that says  and highlight the Path variable then click.
 * 15) The value field will be already highlighted. Capture it with  and paste it  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)
 * 16) Like my 'PEVSoft' tools directory, add your Tools folder to the Windows path of the second copied to the editor.
 * 17) Highlight the revised line, and  to the Advanced Tab's API and  to paste it in as the new Path. Click  then  and  to close the System Properties. PEV's tools are now fully installed.

%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;C:\PEVSoft;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Program Files\Skype\Phone\
 * 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 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.
 * 1) 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.
 * 2) We recommend the following parallel associations, and will walk you through the process below for the PEVtools:
 * 3) 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.
 * 4) The TGA files should be associated with the non-Windows applications, because Windows doesn't process TGA formatted files.
 * 5) The  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.
 * 1) Navigate to a file folder with a data file you want to set an association for. Use  to open an explorer Window if necessary.  )
 * 2)  will open a file for edit, and also opens an Window displaying that folder as the . You can leave Content Manager running and use  to keep switching between active windows when and if necessary.
 * 3) 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:
 * 4) 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.
 * 5) 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&mdash;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. [[file:Trainz WinSkills--file association drop down menu for IM files.png|thumb|300px|alt=Windows Open With image|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.]]
 * 6) Using  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  button must be used.
 * 7) 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.
 * 8) 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.
 * 9) LMB click on the application you 'least want' to be the default application.
 * 10) For the TGA Image files, suggest the order: GIMP, PAINT.NET, and end with IrfanView as the default.
 * 11) For the PM Mesh files: PM2IM, Quickshadows, and end with Mesh Viewer2 as default.
 * 12) For the IM Mesh files: Images2TGA, PM2IM, Quickshadows and end with Mesh Viewer2 as default.
 * 13) 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.
 * 14) 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.
 * 15) In succession, associate each applications program (Tools) with the extension.
 * 16) Each application will give you a look at it's behavior, options and results when run directly sans a batch file launching.
 * 17) 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 {{TA|PEVtools}} use article.

Notes, Footnotes & References
{{#if:||