Julia's Fairies

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 FilesPopeye

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

Subscribe
Notify of
guest

17 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Diyan Kostadinov
April 14, 2012 17:51

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 🙂

seetharaman
seetharaman
April 15, 2012 01:54

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.

seetharaman
seetharaman
April 17, 2012 08:39
Reply to  Julia

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.

Ekkehard May
June 3, 2012 17:25

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

Diyan Kostadinov
June 3, 2012 20:46
Reply to  Ekkehard May

Dear Ekkehard, I am interested of your program. Can you give me your email for contact? Or contact me at dkostadinov@abv.bg

seetharaman
seetharaman
June 8, 2012 13:17

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
June 17, 2012 17:35
Reply to  seetharaman

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

ganori80
September 11, 2012 09:14

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

seetharaman
seetharaman
September 11, 2012 16:27

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 ?

Luis Nunes
Luis Nunes
May 9, 2013 16:22

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…

seetharaman
seetharaman
April 30, 2015 14:12

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

Gurgui Dan
October 23, 2017 09:13

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

Joost
Joost
October 24, 2017 07:50
Reply to  Gurgui Dan

Erlking (ek).

Gurgui Dan
October 24, 2017 09:25
Reply to  Joost

EK
Very good.

17
0
Would love your thoughts, please comment.x
()
x