Choose a StarTeam Client Version When Opening a URL

0 Likes
over 9 years ago

StarTeam URLs

The StarTeam Cross Platform Client can generate and open starteam:\\ URLs which specify a specific object within a StarTeam project. 

These URLs can then be sent in a mail, over IM, or embedded in documents and web sites.

When installing the Cross Platform Client the option is given to make that version the default handler for all StarTeam URLs. In an environment with multiple client installations, it may be advantageous to be able to choose the StarTeam version on a per-case basis.

This can be accomplished by writing a batch script which asks the user which version to use - and passes the URL to the correct version for opening. This script is then set as the default handler for StarTeam URLs - so that it opens when a URL is clicked.

The Script

Open a text editor and enter the following script.

@echo off

:question

CHOICE /C:12q /N /D Q /T 10 /M "Choose A Version of StarTeam: 1 - StarTeam 2006   2 - StarTeam 12 - Q - Quit"

 

if %errorlevel% == 1 goto :2006 if %errorlevel% == 2 goto :12 if %errorlevel% == 3 goto :exit

echo Invalid Choice goto :question

:2006 "C:\Program Files (x86)\Borland\StarTeam SDK 2006 R2\bin\StJavaw.exe" "-f" "C:\Program Files (x86)\Borland\StarTeam Cross-Platform Client 2006 R2\StarTeamCP.stjava" -- -openurl "%1" exit

:12 "C:\Program Files (x86)\Borland\StarTeam SDK 12.0\bin\StJavaw.exe" "-f" "C:\Program Files (x86)\Borland\StarTeam Cross-Platform Client 12.0\StarTeamCP.stjava" -- -openurl "%1""

:exit exit

The above example is suitable for a system with StarTeam 2006 R2 and 12 installed. You may need to edit the options and paths to suit the versions installed on your system.

Save the file with a .bat extension (i.e. starteamurlopener.bat)

Setting The Default URL Handler

To set the batch script as the default handler for StarTeam URLs, you will need to edit the registry. A full backup should be taken of the registry beforehand and this should only be done by experienced users comfortable in editing the registry.

Open the registry editor (regedit.exe) and edit the following key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\starteam\shell\open\command]

This should be set to the location of the url opener script, including the %1 argument variable - for example:

"\"C:\\Program Files\\Borland\\starteamurlopener.bat\" \"%1\""

Alternatively you can enter the following text into a text document, save as a .reg file - and execute it:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\starteam\shell\open\command] @="\"C:\\Program Files\\Borland\\starteamurlopener.bat\" \"%1\""

Note that your file path may be different if the batch script was saved to another location.

Upon opening a StarTeam URL, you will now be prompted with a dialog, asking which version of StarTeam you would like to use:

Labels:

How To-Best Practice
Comment List
Anonymous
Related Discussions
Recommended