Wednesday, March 19, 2008

Tip: Change cut directory at "runtime"

As promised earlier I'll give you a few more tips on the things you can do with the XRKB.ini file.
One of the nice features is that you can make changes to the XRKB.ini file while Socrates are running. (I don't know if this is recommended usage by the Cincom Socrates team).

At my team we use the Cut command a lot; we cut .XRA knowledge modules to various folders depended on which branch of the project we're currently working on and we cut to running instances of our application.

The cut command remembers the location of where you did the last cut, so if you did a cut to c:\MyProjects\MyCuts\ the next time you cut a knowledge module, Socrates will suggest the c:\MyProjects\MyCuts\ folder as your cut location.

An investigation of the XRKB.ini file reveals this entry:

If we combine this information with the knowledge that we can make changes to the XRKB.ini file while Socrates is running, it opens up for a more dynamically way of controlling where to cut knowledge modules without navigating to the destination folder each time.

Let's create two copies of XRKB.INI; name them cut_to_projects_XRKB.ini and cut_to_current_branch_XRKB.ini, and place them at the same location as the original XRKB.ini. If you have installed Socrates with default settings it would be in C:\Program Files\Cincom\Socrates. (I recommend that you keep a backup copy of your XRKB.ini file somewhere safe.)

In the cut_to_projects_XRKB.ini file, change the lastCut entry to:

Similary for the cut_to_current_branch_XRKB.ini file, change the lastCut entry to:

Keep all other entries in the .ini files the same.

Now we just need a way to dynamically switch between the two new files. Create two .bat files; name them cut_to_projects.bat and cut_to_current_branch.bat.

copy "C:\Program Files\Cincom\Socrates\cut_to_projects_XRKB.ini" "C:\Program Files\Cincom\Socrates\XRKB.INI"

copy "C:\Program Files\Cincom\Socrates\cut_to_current_branch_XRKB.ini" "C:\Program Files\Cincom\Socrates\XRKB.INI"

These simple one-liners will copy one of the new .ini files into the original (or current) XRKB.ini file, where Socrates will pull the information of the wanted cut directory from. So before you want to cut a .XRA knowledge module the next time, just run the .bat file that will change your cut directory to the desired.

Bonus tip: You should not use the mouse to point-and-click to the cut command, instead use the built-in short-cut commands: Alt+F | U | RETURN

1 comment:

Anonymous said...

Seems a little complex Riis, why not just choose your new cut location from standard windows browse folder feature.......