Computer Chess Club Archives


Search

Terms

Messages

Subject: Help needed with opk.vbs script to run CM9000 in XP

Author: Keith Hyams

Date: 04:33:21 10/15/05


I think that a number of you who run The King engine in Shredder 8 will be
familiar with this script.

This is the version designed to work in Windows XP. However, in my case, it
doesn't.

I have replaced  inbetween.ini with a working version of Wb2uci .The script runs
until I exit from Chessmaster. At this point I get the error:-

Line 63 char 2 Path not found. Can any of you see from the script below the
cause of this?



' OPK - Emil Vlasak and Jan Pletanek  www.vlasak.zde.cz
' Purpose: Run King under ChessBase - automation of process

Option Explicit

'Variables, no change please

Dim fso
Dim f
Dim ts 'text stream
Dim CMPath 'path to ChessMaster
Dim CMExe 'the whole command line
Dim CBKing 'path to ChessBase King
Dim CBSoft 'what CB soft run - Fritz?
Dim LogFileName 'the log file
Dim Memtext 'file in memory
Dim OPKstr 'OPK string
Dim BigFinder 'objekt sloziteho hledace
Dim Matches
Dim Match
Dim Msg
Dim Shell  'for the Shell object

'!!! Directories and File names - please edit

CMPath="C:\Games\WinboardEngines\Chessmaster 9000\"
CMExe="""" & CMPath & "Chessmaster.exe" & """"   'no error -   """ before and
""" after
CBKing="C:\Games\WinboardEngines\Chessmaster 9000\TheKing\"
CBSoft="""C:\Games\WinboardEngines\Shredder 8\Shredder8\ChessProgram8.exe"""
'no error -   """ before and """ after

'Deleting log files
Set fso = CreateObject("Scripting.FileSystemObject")
If fso.FileExists(CMPath & "log.001" ) Then  fso.DeleteFile(CMPath & "log.00?")
If fso.FileExists(CMPath & "game.001" ) Then fso.DeleteFile(CMPath & "game.00?")

'Need to keep ChessMaster in original condition for normal use
'First phase
'So make once manualy:
'1. the backup The King.EXE  The King.bak
'2. copy your Crafty.EXE in CM directory
'Enable the following line, don't forget the  2nd phase
 fso.CopyFile CMPath & "crafty.exe", CMPath & "The King.exe", true  'true for
overwriting

'Run ChessMaster and get log file
Set Shell  = WScript.CreateObject("WScript.Shell")
Shell.Run CMExe, ,true  'true is for waiting script for application end

'2nd phase
'Enable the following line
 fso.CopyFile CMPath & "The King.bak", CMPath & "The King.exe", true  'true for
overwriting
'The ChessMaster is now in original status

'Find the highest log.00?
If fso.FileExists (CMPath & "log.001") Then LogFileName="log.001"
If fso.FileExists (CMPath & "log.002") Then LogFileName="log.002"
If fso.FileExists (CMPath & "log.003") Then LogFileName="log.003"
If fso.FileExists (CMPath & "log.004") Then LogFileName="log.004"

'Transfer OPK= from LogFileName do InBetween
'Only for experts editing
'find OKP in LogFileName

 Set ts=fso.OpenTextFile(CMPath & LogFileName)
 MemText=ts.ReadAll()
 ts.Close()

 Set BigFinder = New RegExp
 BigFinder.Pattern = "\bopk=\d+"  'finds opk=number
 BigFinder.Global = True
 BigFinder.IgnoreCase = True

 'Get the OPK=?? string
 Set Matches = BigFinder.Execute(MemText)
 For Each Match in Matches
   OPKStr=Match.Value
 Next

'replace opk in InBetween.ini
'read InBetween.ini in to memory
 Set ts=fso.OpenTextFile(CBKing & "wb2uci.eng")
 MemText=ts.ReadAll()
 ts.Close()
  'replace in memory
 BigFinder.Pattern = "\bopk=\d+"  'finds opk=number
 BigFinder.Global = False
 BigFinder.IgnoreCase = True
 MemText = BigFinder.Replace(MemText,OPKStr)

 'backup InBetween and write the new version
 fso.CopyFile CBKing & "wb2uci.eng", CBKing & "wb2uci.bak"   'backup InBetween
 Set ts=fso.CreateTextFile(CBKing & "wb2uci.eng", true) 'true for overwrite
 ts.Write(MemText)
 ts.Close

'Run Fritz
Shell.Run CBSoft,,false   'false - Script doesn't wait for Fritz and ends
immediately



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.