Batch scripts to run popeye


We were speaking in general about popeye, and now we go to some practical things about running popeye. This page will show you the 2nd method (of 2 methods mentioned before) of how to run popeye –

Running Popeye from the batch script

The batch script is a set of commands which should work one by one, stored in one file, which is called command-file. You can use the Notepad text editor to create a command file, but save it as a Type “All files” and any name with obligate extension .bat

I’ll show you 3 examples of the scripts now. You can download and use any of them. In short words:

  • the 1st example runs popeye in a cycle: opend the cmd-window, runs popeye, waits for a problem to solve, solves, sends the result on the screen, asks if you want to solve the next problem, runs again, solves again… etc. The advantages is that the popeye-window will not close after the first solution, and you can use [PASTE] option for input of your notation.
  • the 2nd example does almost the same as the 1st one, but it doesn’t show the results on the screen, but writes the result into text file. After the end of solving process you can open this text file with any text editor (f.i. Notepad) to see your solution. The additional advantage – you won’t lose any part of your solution in case if it is too long for the cmd-window. Also, text file is more convenient for editing or copying the solution somewhere.
  • the 3rd example combines the both – the 1st and the 2nd. It gives the result to the screen and writes it into the file simultaneously. After the solution is finished – the program will run Notepad which will open your solution is edit more. In case if you stop solving process before the end of solution – the part of solution you have will be also stored in the file and shown in Notepad. But to make it working you have to download one more utility (available for download in the Example 3 section)

The important thing!! – in the examples I assume that you run py.exe file for popeye which is stored in a directory C:\PY-459\ !!! You can use your directory and your name of the program (like pywin64 or pywin32). Change all the red-colored names for your own!! Like you may have pywin64.exe file for running popeye, or a directory like C:\Program Files\Popeye\

Example 1

Download script-file in zip-archive py-script1.zip, extract the file py-script.bat on your Desktop. To extract the script click the downloaded file with the right button of your mouse – you will get the following Menu:

Choose the second option – Extract files… with the left button of your mouse. You will have to specify the directory for extract. Use Desktop like on the example below and press OK.

Now you have the file py-script on your Desktop like I have:

You don’t have to make any changes to the script if you use a directory for popeye C:\PY-459 and the name of the popeye file – py.exe. If you have any other directory or/and other name of popeye to run, you have to edit the script. To do it, click the icon for py-script1 with the right button of your mouse. You’ll see the menu, where you have to choose EDIT option:

 

Choose EDIT with the left button of your mouse. The Notepad (text file editor) will be opened with the commands inside:

This this what you have inside the Notepad:

@echo off

cd C:\PY-459

:label_start

py

set /p end=Press ENTER to continue!

if “%end%”==”” (goto label_start) else (goto :eof)

Please edit your file in Notepad, changing the directory C:\PY-459 to the one where you have your popeye and changing the name of the program you run from py to pywin32 or pywin64 or anything also you use. After editing use menu File – option SAVE. And close Notepad. Now you can simply run the script!! Use double-click with the left button of your mouse to run it as any other program. You’ll get popeye screen and the program is waiting for your input (like usually).

Here you can input your notation for solving. The 1st option is to type it here like:

after finishing your input – press [ENTER] key. You’ll get the result like this:

Your solution is on the screen, and the program is waiting for your next action. You see the phrase: Press ENTER to continue! If you press ENTER key – the program runs again and waits for the next problem input:

Not we’ll use the 2nd option for the problem input – pasting it from another source. This is for the case if you have your notation in some file. For example, I have the following notation for my problem:

BeginProblem

Stipulation h#2

Pieces White Kh4 Rf5 Rg4 Bh2 Bh1

Black Kb6 Qa4 Ra2 Bd7 Sf4

EndProblem

I can make a COPY (ctrl_c) of all these lines and PASTE it into the popeye-window. To make a PASTE in the popeye-window press the right button of your mouse inside the window and choose PASTE option from the menu:

This is what you will get in case of my notation shown above:

Now press [ENTER] key for the program. It will start solving. The result of it looks like:

At the end of solution the program asks again if you wish to continue: Press ENTER to continue! If you press ENTER key – the program runs again and waits for the next problem input. Otherwise, to exit, you can either input any other key – use any character and press [ENTER] after:

I use “n” character in the example above. The window will be closed after you press [ENTER] here. Another option to exit the program is simply close the window using the [x] sign at the top right corner:


Example 2

Another example is about storing the results of solving into the file. Download the script in the zip archive py-script2 Extract the file py-script on your Desktop like it was described in the Example 1. You can run this script if you use the directory C:\PY-459 for popeye and the file py.exe to run. Otherwise you have to edit the file like in Example 1 and to change the red-colored names like they’re shown here:

cd C:\PY-459

:label_start

echo Running popeye… input your problem here!

py > my-result.txt start

Notepad my-result.txt

set /p end=Press ENTER to continue!

if “%end%”==”” (goto label_start) else (goto :eof)

Change red-colored names to your own if you have different name for the directory where you have popeye (if not C:\PY-459) and the program name (if not py.exe). my-result.txt – is the name of the file where you’ll get your results. You can change it to any other name with .txt extension. Save the file after editing. Now you can run py-script2 file from your Desktop. Again, you’ll get popeye screen and the program is waiting for your input (like usually). Enter your problem manually or using PASTE option like it was shown in the Example 1. But in this case you will not see the result at the popeye screen, but at the end of solution the Notepad will be opened with the file my-result.txt where you can see your solution.


Example 3

And more complicated example (the script I use for myself): To use this script you have to download a small utility – mtee. Click mtee.zip to download. Unzip it into the directory where your popeye program is. Than download the script file in zip archive – py-script.zip Unzip it – extract the file on your desktop like it was described in the Example 1. Now you have an icon with the name py-script on your Desktop. You have edit it if you have a different parameters for popeye like it was described in the Example 1. The commands in the edit will look like:

@echo off

echo Enjoy scripting language to run POPEYE!

set my-directory=”C:\PY-459

set my-popeye=”py

set my-result=”r.txt

cd %my-directory% :label_start

echo —————————————

echo. set end=

echo *** running %my-popeye% ***

%my-popeye% | mtee %my-result%

start Notepad %my-result%

set /p end=Press ENTER to continue!

if “%end%”==”” (goto label_start) else (goto :eof)

Please do edit the file like it is described in Example 1 if you need to change to red-colored fields to your own: Instead of C:\PY-459 write your directory name where you have popeye program, instead of py write the name of popeye-program you use (pywin64, pywin32, …), instead of r.txt you can use any other file name for the result, but with the .txt extension. Save your file after edit. Now you can run the script!! How it will work?

  1. run your script from the desktop
  2. popeye program will be started and awaiting for your problem
  3. you can input your problem manually or doing copy-paste from another file to popeye-window
  4. popeye will show you the solution on the screen (like usually) but the same time it makes a copy of this solution into the file specified (my r.txt)
  5. when the solving is done, the Notepad starts and opens your solution
  6. the popeye window is waiting for the next problem to solve – just press the ENTER key to continue…

One more thing to add: in case of long-time solutions, you can stop solving using CTRL-C. The part of solution you’ve got will be also saved in your file. The solving process of the current problem stops, but you can continue with the next problem – the popeye-window will not be closed.

Of course, these scripts are only the examples – it’s possible to make a lot of different modifications of them. But this is the idea what is possible!


Please feel free to send me comment/questions(English, Russian, Latvian)! Also, I’d appreciate if you write me what kind of scripts migth be useful – I could add more examples to download. Use Leave a Reply form below or send me an email to julia@juliasfairies.com.

Good luck in using scripts! Julia

17 Responses to Batch scripts to run popeye

  1. Wow… All it’s works! Thank you Julia for this so good step by step explanation, which is very useful even for not so good “computer specialists” like me 🙂

  2. Seetharamanseetharaman says:

    You are a very good teacher. I think your explanation will help computer dummies like me. Thanks. I will try and see if I can manage Popeye now. So far I have been having the difficulties you described in your first post.

    Recently I tried to download and instal APwin which is supposedly a convenient interface for Popeye. But I was unsuccessful :(. Unfortunately none of my computer friends know chess, so I dont know if they will be able to help.

    Perhaps one such lesson for installing APWIN will be useful.

  3. JuliaJulia says:

    Thanks for your comment! Good luck in managing popeye! I don’t use APWIN myself, but I’ve installed it to know how it looks. Yes, some difficulties might happen during the installation. I’ll try to write about APWIN’s installation. But I’d also suggest you to use Ankona (www.ankona.ch) – it is free, just have to sign in, and it also uses popeye for solving. I believe, I can answer any question about Ankona as I use it for a year. Julia.

    • Seetharamanseetharaman says:

      I think you are lucky to be able to use Ankona. I could not even register !! The server gave error message and rejected my three email addresses whenever I tried a second time with same email.

      • JuliaJulia says:

        I have sent an email to you – let’s try to check together what’s going on. I believe I can help you, I know how Ankona works pretty good. Send me screenshots of the screens you’ve got, step by step! Thanks! julia.

  4. Ekkehard May says:

    Hello,
    today i found this article about “Popeye” by accident.
    Maybe my program “Chessdiagrammer” could be interesting for you. It has build in interfaces to the solving engines “Popeye” and “Chest” so it is very simple to solve orthodox and fairy chess problems. If you have any questions, please don’t hesitate to ask me.
    Kindest regards, Ekkehard

  5. Seetharamanseetharaman says:

    I have already used the old version for making diagrams with fairy pieces. It was very useful. It seems that the latest version can solve fairy problems using Popeye. Though I downloaded it, it does not solve. Perhaps only the Professional version has that facility.

    • Ekkehard May says:

      Hello dear problemists,

      yes, it’s true, in Chessdiagrammer the fairy mode is only available in the professional version. In the freeware version, you can solve orthotox problems with Chest or with Popeye.
      The actual professional version 7.2 Build 1427 offers a very simple dialog for defining options and/or conditions for Popeye, that makes it very easy to handle the 177 conditions and 32 options [Popeye version 4.61]

      Feel free to download and test the program. You have a 30-day-trial-period, where you can test all functions of the professional version.

      Kindest regards, Ekkehard

  6. ganori80ganori80 says:

    Hi,
    I don’t know if you know my graphical multiplatform interface for popeye: Scacchi Painter 2
    You can find this software for free at accademiadelproblema.org (forum -> scacchipainter)
    It is written in .NET and is compatible with Windows, Linux with Mono, OsX with Mono
    Best Regards
    Gabriele

  7. Seetharamanseetharaman says:

    Thanks ganori, I downloaded it. I could open the graphic interface and set up a diagram. But it is not solving. What did I do wrong ?

  8. Luis Nunes says:

    Hi Julia!
    Do you know if Popeye could interpret FEN notation? Or if there’s a script wich can conver FEN to Popeye?

    I ask because found this file ( https://sites.google.com/site/edusadier/theartofdirectmateintwomoves/MateenDos.zip?attredirects=0 ) with so many mate in 2, and would like to solve them in Popeye…

    • JuliaJulia says:

      As I know, Popeye itself doesn’t interpret FEN. I believe that some composers might have written such converting scripts for themselves. Myself I use http://www.ankona.ch where FEN record is one of the options to create a diagram, and after Popeye engine is used for solving. But FEN works only for orthodox problems there!

  9. seetharaman says:

    I have been using Olive .. the GUI interface to Popeye for quite some time. It works great! Thanks Dmitri.

  10. Gurgui Dan says:

    For ViceKing what command use you?
    Viceking is Fe+Vi
    Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *

You can add images to your comment by clicking here.