Musil
Posts: 19
Joined: Fri May 30, 2014 10:37 am

Path to gnubg

Fri Sep 04, 2015 10:35 am

i had to reinstall gnubg and of course set the path to gnubg.

Below just a function which will find gnubg in less then a second when its installed
when added users of GG don't have to set the path to it themselve

Public Function GetGnuBG_Path() As String
Dim WShell As Object
Dim ExePath As String
Set WShell = CreateObject("WScript.Shell")
' As the
ExePath = WShell.regread("HKEY_CLASSES_ROOT\GnuBG_sgf_file\shell\open\command\")
ExePath = Split(ExePath, """")(1)
If Dir(ExePath, vbNormal) = "gnubg.exe" Then
GetGnuBG_Path = ExePath
End If
End Function

User avatar
greedyG
Site Admin
Posts: 193
Joined: Sun Oct 24, 2010 8:32 pm

Re: Path to gnubg

Fri Sep 04, 2015 1:18 pm

very nice code thank u :)

Will implement it as soon as I get a development machine set back up.
Backgammon is a luck/skill game similar to card games like poker and gin rummy. Estimating and maximizing your winning probability is key
http://www.download-texas-holdem-poker.com

User avatar
greedyG
Site Admin
Posts: 193
Joined: Sun Oct 24, 2010 8:32 pm

Re: Path to gnubg

Fri Sep 02, 2016 4:09 pm

I finally got around to adding this code but for some reason it pulled up the path to an older version that was no longer installed. Probably would not be a problem for most users who only installed once. In any case, I did get it to work by substituting

'ExePath = WShell.regread("HKEY_CLASSES_ROOT\GnuBG_sgf_file\shell\open\command\")

with this one.. ExePath = WShell.regread("HKEY_CLASSES_ROOT\Applications\gnubg.exe\shell\open\command\")

The original one led me on a wild goose chase thinking my Dir$ was not working when actually the path it pulled up no longer exists.
But what is strange is that sgf files do open with the correct path to the current gnubg installation.


wrongpath.jpg



correctpath.jpg
Backgammon is a luck/skill game similar to card games like poker and gin rummy. Estimating and maximizing your winning probability is key
http://www.download-texas-holdem-poker.com

Return to “Questions Comments”