NoGripRacing.com

Go Back   NoGripRacing Forums > PC Racing > GTR2

Reply
 
Thread Tools
Old 13 March 14, 04:40   #1
redamo
Donated
 
redamo's Avatar
 
Join Date: Dec 2008
Location: Castle Rock CO
Default Run GTR2 from Windows 8.1 Tiles

Just something to share for anyone interested in running GTR2 from windows 8 tiles. If you run GTR2 from a single folder; ie, all mods, add-ons, etc. in one folder, then making a shortcut to GTR2.exe and pinning it to the Start Screen is all that is needed.

Personally, I keep mods in separate GTR2 folders. Before in windows 7, a manual rename from a modded GTR2 folder to GTR2 sets that one to run. Such as from GTR2-Champcar to GTR2. Not much effort, but an effort nonetheless, over and over again.

In Windows 8 each mod can be a tile and a simple click on the tile starts the desired Mod. This post outlines how to do that. You’ll create a few short scripts, so first create a folder for your scripts at the root of C: and name it “Scripts”. The following 4 Sections describes how to script a method where a Windows 8 tile will open GTR2 for a mod stored in a separate folder named differently than GTR2. My startup screen is at the end. Comments, improvements are all welcome as I am not a programmer, but wanted the automation.

1)Open Notepad and enter the following lines:

cd\
cd\windows\syswow64\windowspowershell\v1.0
Powershell C:\Scripts\Champcar_start.ps1
cd\GTR2
GTR2.exe
cd\
cd\windows\syswow64\windowspowershell\v1.0
powershell C:\Scripts\Champcar_stop.ps1
cd\
cd\Scripts
InitiateStartScreen.vbs

Save this notepad in the “Scripts” folder with a .bat extension for batch file (instead of .txt). Whenever you edit this file right click and select “Edit”. Here’s what each line above says:

Set the root directory to C:
Change directory to windows powershell location
Open the powershell file saved in scripts folder called “Champcar-start.ps1” {Section 2 below}
Change directory to GTR2 folder
Start GTR2
Set the root directory to C: {when you exit GTR2 the batch file continues here}
Change directory to windows powershell location
Open the powershell file saved in scripts folder called “Champcar-stop.ps1” {Section 2 below}
Set the root directory to C:
Change directory to Scripts folder
InitiateStartScreen.vbs {runs a vbs script that restarts the start screen – Section 3 below}

Note if your drive letter is something other than C: then substitute that letter. Also, this example is using Champcar, so if your mod is something else use your name to describe the mod.

2) In this section the powershell script that renames your Mod folder to GTR2 (ie, the start.ps1 line above) and renames it back after you exit GTR2 (the stop.ps1 line above), will be created.

To open powershell - from the start screen type powershell_ise.exe and press enter. The powershell program will open. If you get a blue screen C-prompt you are probably selecting powershell without the “_ise”, so make sure you choose powershell_ise.exe.

Also, note you may need to set the powershell’s access to unrestricted. A google search gives information on this, or comment here for added assistance. You may also need to make an adjustment to your Administrator security settings, as I had to take ownership from “TrustedInstaller”, whatever that means. I found this a bit cumbersome and heard myself commenting “What the… this is my computer, I’m the administrator, I’m the boss of my own bones, why can’t I do this”. You get through it though.

With powershell open and a blank ½ screen below the tool bar, click next to the number 1 and type the following:

Set-Location -Path C:\
Rename-Item -NewName GTR2_Track_Test -Path C:\GTR2
Rename-Item -NewName GTR2 -Path C:\GTR2_Champcar

Use the File>Save As in powershell to name this file: Champcar-Start.ps1 Again, substitute the word Champcar for the name of the mod you are creating a tile for. Also the “-Start” is made up and you can call it whatever you want, or you don’t need it. Start just says to me this script is changing the mod folder name GTR2_Champcar to GTR2 so the Champcar mod can open. The file is saved as a Powershell file and has the designated .ps1 file extension. You can open in Notepad, but I’ve always opened in Powershell to edit when setting up a second mod tile.

The powershell script says by line:

Change the path to the root directory C: (use your drive letter)
The second line sets the existing GTR2 folder name: “GTR2” to “GTR2_Track_Test”
And the last line changes the mod folder “GTR2_Champcar” to “GTR2”

Note here that “GTR2_Track_Test” is my base GTR2 folder where I place new locations into, to test drive them before placing inside one or more Car mod folders. When a car mod tile in windows 8 is selected this base GTR2 folder is renamed to GTR2_Track_Test while the car mod folder is renamed to GTR2 so it can open. After you exit GTR2 the car mod folder is renamed back to its storage name and GTR2_Test_Track is renamed back to GTR2. This is done in the “stop.ps1” powershell script which is the opposite of the “start.ps1” powershell script. Create a new powershell script file for the “stop.ps1” and enter these command lines:

Set-Location -Path C:\
Rename-Item -NewName GTR2_Champcar -Path C:\GTR2
Rename-Item -NewName GTR2 -Path C:\GTR2_Track_Test

Use the File>Save As in powershell to name this file: Champcar-Stop.ps1

3) If you stopped here, once you exit a GTR2 session you’ll wind up at the desktop. A simple vbs script automatically returns the Start Screen. Open a blank notepad file and type the following two lines:

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.SendKeys "^{ESCAPE}"

Save this notepad file as “InitiateStartScreen.vbs” Use the .vbs file extension instead of .txt

You can click on this file and your Start Screen will pop up. And that’s what it does when executing in the batch file.

4) Ok, you’re just about there. The last thing to do is create a shortcut to the batch file created in section 1. Rename it with the mod it opens, then right click the shortcut to pin it to the start screen.

Now when you click this tile this mod is opened, and once exited, the start screen returns. In between these actions the different GTR2 folder names are renamed accordingly, and automatically.

To create another mod tile copy the three files: {Mod}.bat; {Mod}-start.ps1 and {Mod}-stop.ps1 and edit the insides accordingly. Create a shortcut to this batch file and pin it to the Start Screen.


Pic of Start Screen shows the base GTR2 for testing tracks (flag tile) with F1 next to it, GT Class below and Champcar next to it. Hope to add a League group of tiles soon, along with more mod tiles.

GTR2 Win8 desktop.png

Requested improvement - script the process all in one .vbs notepad file...

Last edited by redamo; 13 March 14 at 11:28. Reason: Requested improvement
redamo is offline   Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 16:13.


Powered by vBulletin® - Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.

www.nogripracing.com 2003 - 2014
Page generated in 0.08794 seconds with 11 queries