Set Winboard Username Permanently?

Discussions about the WinBoard protocol. Here you can also report bugs and request new features.

Moderators: hgm, Andres Valverde

Set Winboard Username Permanently?

Postby Charles Browne » 03 Mar 2010, 17:43

The below is in reference to humans playing games against the computer.


On the enter username in Winboard. Would it be possible for the set username to have an option, maybe a check mark to set the name permanently until changed again? Maybe the check mark wouldn't be necessary, maybe just set permanently until a new name is entered or if the name is removed from the username field, upon opening Winboard again the name would revert to the computer setting.

The problem for me is that when I was using Windows Me winboard would not pick up any username from the computer so whenever using Winboard, Winboard reverted to setting my name as - user

So in this username section of winboard.c

Code: Select all
 /*DisplayError("Error getting user name", GetLastError());*/
strcpy(buf, "User");


I would type something like

Code: Select all
/*DisplayError("Error getting user name", GetLastError());*/
strcpy(buf, "cwb");


Instead of "user" I would put the username I wanted, in the above example "cwb"

And I had client for microsoft disabled in my network settings in Windows Me and doing this caused Winboard to not pick up the OS username data (which it was unable to anyway) but to revert to the - /*DisplayError("Error getting user name", GetLastError());*/ - setting, which I had changed to reflect the name I wanted listed.

The above was a work around when using Windows Me, but it does not work with XP. So now each time I go to play a game I have to reenter the name in the username field. Be great if that entered name in the username field could be stored somehow.


I do not think I am being narcissistic, just rather see the name wanted as the correct name listed for the game.
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Set Winboard Username Permanently?

Postby H.G.Muller » 03 Mar 2010, 17:51

In the "how-to" setion of this forum I put a post describing how one can make volatile options survive in the settings file. This seems a perfect solution for your current problem. Just rename winboard.ini to second.ini, and create a winboard.ini file that contains the lines:

Code: Select all
/userName="Charles Brown"
/saveSettingsFile="second.ini"
/settingsFile="second.ini"


That should do it.
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Set Winboard Username Permanently?

Postby Charles Browne » 03 Mar 2010, 18:41

Using Winboard 4.4.3.20100118

When opening Winboard get:

unrecognized argument /saveSettingsFile


Did this:

1). renamed existing winboard.ini file to second.ini file

2). made a new winboard.ini file by opening Winboard

3). closed Winboard, then removed everything in the newly made Winboard.ini file and put this in the file:

Code: Select all
/userName="Charles Brown"
/saveSettingsFile="second.ini"
/settingsFile="second.ini"


Closed winboard.ini file, saving changes.

Open Winboard, got the above mentioned error.


I'll reread your how-to post later on tonight.
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Set Winboard Username Permanently?

Postby Charles Browne » 03 Mar 2010, 19:49

Even this from the Winboard help file isn't exactly clear. Looks straightforward and clear but it isn't.

I'll scratch my head on it later.


Settings

When WinBoard starts up, it reads option settings from a file named WinBoard.ini in its installation directory (the directory containing WinBoard.exe). Options in this file have the same format as command line options, except that they do not all have to be on a single line. You can put a comment in a settings file by preceding it with a semicolon (;).

The WinBoard.ini file is read before the command line is processed, so any options you give on the command line override options in the file.

If WinBoard encounters a /settingsFile filename or @filename option while reading settings (whether from the command line or a file), it reads more settings from the given file before reading the next option.

The Save Settings Now menu command writes the current values of most options to a file. In addition, settings are saved automatically when WinBoard exits if Save Settings on Exit is checked. The settings are written to the last file named in a /settingsFile command, if any; otherwise to WinBoard.ini. The @ option does not affect which file settings are saved to.

Warning: Because Save Settings overwrites the last settings file (usually WinBoard.ini) and only saves a subset of WinBoard's options. You should not add settings of more options to such a file with a text editor. If you do this, your additional options will be lost on the next Save Settings. You can change the values of existing settings freely, using Notepad or any plain text editor. Be careful not to do this while WinBoard is running, however, unless you know that Save Settings on Exit is off. Otherwise all your changes will be overwritten and lost when WinBoard exits.

Notice that tournament managers, like PSWBTM, usually call WinBoard with the option not to save settings on exit, so that the entire tournament uses the same settings. So it does make sense to edit ‘volatile’ options, such as /variant, into the settings file.
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Set Winboard Username Permanently?

Postby Charles Browne » 03 Mar 2010, 21:05

0k,

Two ini files I have

second.ini = the original ini file renamed

and

winboard.ini = the newly made ini file



If only this is put in the winboard.ini file

Code: Select all
/userName="Charles Brown"
/settingsFile="second.ini"




And I open Winboard, and check "additional options" field and type this in the field:

/ini second


Then it works, but when Winboard is closed and the next time it is opened if the additional option details above aren't inputted, then the winboard.ini file is overwritten with the data from the second.ini file


So unless I am missing something, the additional option details need to be inputted each time or else the file named winboard.ini will be overwritten.
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Set Winboard Username Permanently?

Postby Charles Browne » 03 Mar 2010, 21:13

If the winboard.ini file is set to read only it looks to work!
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30

Re: Set Winboard Username Permanently?

Postby H.G.Muller » 03 Mar 2010, 21:24

OK, I see this does not work in WinBoard.4.4.x: it sets the flename after succesfully parsing an ini file to the name of that ini file. So all ini files mentioned within it are lost, because their names are written at the end.

The development version (e.g. master-20100221 from GNU Savannah) does this differently. I guess the trick I described only works for this version. :-(
User avatar
H.G.Muller
 
Posts: 3453
Joined: 16 Nov 2005, 12:02
Location: Diemen, NL

Re: Set Winboard Username Permanently?

Postby Charles Browne » 03 Mar 2010, 21:39

H.G.Muller wrote:The development version (e.g. master-20100221 from GNU Savannah) does this differently. I guess the trick I described only works for this version. :-(


ok, I will try that one tomorrow, it is late here now.

What I wrote about the winboard.ini file being set to read only and working was correct BUT if other changes are made, such as changing the location of the saved games PGN file, then the changes are not saved to the second.ini file.

To have it work correctly the winboard.ini file IS NOT set to read only and the necessary data needs to be inputted into the additional options field each time that Winboard is opened.
Charles Browne
 
Posts: 209
Joined: 26 May 2008, 00:30


Return to WinBoard development and bugfixing

Who is online

Users browsing this forum: No registered users and 16 guests