Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to transfer parts of a WORD-document into a VFP-table. 7

Status
Not open for further replies.

german12

Programmer
Nov 12, 2001
563
DE
I have a WORD document which contains a lot of Chess games.
As an example I append a WORD document with only two games which looks like this:

Warkentin, Jurgen (2011)

Luco, Alain (2134)

Event: Fouesnant op 11th
Site: Fouesnant
Round: 8 Date: 10/28/2005
ECO: D00 Score: 1-0
1.d4 Nf6 2.Nc3 d5 3.f3 e6 4.Bg5 Be7 5.e3 c5 6.Bb5+ Nc6 7.f4 Bd7 8.Nf3 cxd4 9.exd4 h6 10.Bh4 Ne4 11.Bxe7 Qxe7 12.O-O Nxc3 13.bxc3 O-O 14.c4 dxc4 15.Bxc4 Na5 16.Bd3 Rac8 17.Qe1 b6 18.Ne5 Qd6 19.Rd1 Bc6 20.Kh1 f5 21.c4 Ba8 22.Qg3 Nc6 23.c5 bxc5 24.dxc5 Qc7 25.Bc4 Nxe5 26.Bxe6+ Nf7 27.Rd7 Qc6 28.Qg6 Kh8 29.Rxa7 Qxg2+ 30.Qxg2 Bxg2+ 31.Kxg2 Nd8 32.Bxc8

Stanek, Stanislav (2005)

Prokop, Petr (1620)

Event: Brno Dedek mem-B
Site: Brno
Round: 2 Date: ??/??/2005
ECO: D00 Score: 1-0
1.Nc3 d5 2.d4 Nf6 3.f3 e6 4.Bg5 Be7 5.e3 O-O 6.Nce2 c5 7.c3 b6 8.Ng3 Bb7 9.Bd3 Nbd7 10.f4 h6 11.Bxf6 Nxf6 12.Qf3 cxd4 13.exd4 Qc7 14.Nh3 a5 15.O-O Ba6 16.Bxa6 Rxa6 17.Rae1 b5 18.Re3 Rc6 19.Rfe1 Bd6 20.Ne2 Ne4 21.Nf2 Nd2 22.Qg4 f5 23.Qg6 Bxf4 24.Nxf4 e5 25.Nxd5 Rxg6 26.Nxc7 f4 27.Rd3 e4 28.Rxd2 e3 29.Rde2

What I mainly would like is to have the game in a VFP table, where each move has its own field:

Example for the first game (Warkentin versus Luca) (if Field-Name starts with W, it means a White moves, B means Black moves)

Fieldnames
W1 B1 W2 B2 ........etc. W32
d4 Nf6 Nc3 d5 ............. Bxc8

that means the VFP-table would have one record per game.
To see where a game starts is easy - it always starts with "1." (see bold formatted moves)

How would you do that?

Thanks in advance
Klaus

Attachment: WORD-FILE Chessgames.docx with two games





Peace worldwide - it starts here...
 
 https://files.engineering.com/getfile.aspx?folder=a0777115-fd96-4596-a7fa-7aba7946a132&file=Chessgames.docx
Klaus,

No doubt this can be done with a bit of parsing and string manipulation. But before I try to suggest some actual code, can I just pick up one point:

that means the VFP-table would have one record per game.

Given that the number of moves is highly variable (and could be very large), you don't want one field per move. If you have one record per game, then the only practical way of storing the data would be in a memo field. The alternative would be to have a table for games and another for the moves, with a one-to-many relationship between them.

On another point, the fact that the games are currently in a Word document doesn't really make any difference. Your first step would be to get them into a text file, which you would then parse in order to get the details into your table(s).

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Hi Mark,

To add to Mike's post (and again without code), this looks to me like an ideal loop situation using GETWORDCOUNT and GETWORDNUM. You would not even have to specify a parameter for a delimiter because it is already delimited with Space, which is one of the default parameters for GETWORDNUM (Tab is the other).

The use of a related table as Mike suggested seems like a must.

Steve
 
It would also help to know if this is a one-off requirement, or something that you need to do regularly.

If it's a one-off, you could start by manually going into Word, and then saving the document as a plain text file. That would make the parsing much easier. If you need to do it regularly, you can save it as a text file programmatically, using Automation.

Either way, you could then transfer the data to a table with the following steps:

1. Use FILETOSTR() to get the data into a variable.

2. Use ALINES() to copy it from the variable to an array.

3. Loop through the array, copying the key fields to your table. So, the array elements beginning with Event: would the the event name, and so on. The elements beginning with 1. would be the actual moves, which you would copy either to a memo field in the same table, or to a subsidiary table.

This is just a preliminary idea, but it should give you something to work on.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Instead of saving as txt, once you have a Word.Document, like loWord.ActiveDocument, you have several collections all giving you just the text: Paragraphs, Sentences, Words, even Characters. IIRC they will not give content of page headers and page footers, tables, forms and some other stuff, but the "main story" of the word document. But I may be wrong, you can easily see for yourself.

Main documentation about Word.Document: The whole OLE object model of Word is online there.



Chriss
 
If the Word file is a DOCX file format, then the file is actually a ZIP file that contains XML files. You could then parse the appropriate XML file to extract the contents.

Greg
 
I have to thank all of you very much for your help.
All posts have been very helpful to me.

I try to answer some remarks, to clarify what my goal is:

Agreed. If I want to see, what Black had done in the 6th. move of an opening it is possible, to focus on Field No. 6 where White (left) and Black (right) are there.
This will also reduce the columns in a table.

No problem because I have to drag and drop it anyway by myself.
Source:
Link

It is something which has to be done more than once, because I would like to deepen my knowledge of a very specific special chess-opening, and new variants of the source are constantly being added at irregular intervals.

It wouldn't be necessary to save an entire chess game either (although it would be nice to replay it, of course).
I'm mainly interested in knowing what can happen after the first few moves (eg 9 moves or so - knowledge of the opening) so that I don't have to experience any unpleasant surprises right after the game has started.

I would like to have it in a table, not in memo-fields.
I think it would be easier to filter some elements from a table (e.g. the 7.th move which Black had done in most cases ) and not searching in memo-fields for that , and which could be the point for the result (1:0, remis or 0:1
That also will not blow up the file and a direct look on a table seems better to me.

Mark: [URL unfurl="true" said:
http://stevenblack.com/articles/text-and-string-ha...[/URL]]
Thank you, Mark - I did not know that article by Steven Black - very useful source for me.

Chriss: [URL unfurl="true" said:
https://docs.microsoft.com/en-us/office/vba/api/wo...[/URL]]
Thanks for that link, Chriss, however to use that knowledge in this case there is more Office-VBA-knowledge required.
As I mentioned above it is no problem to generate a plain-text-file from the resource.
Therefore I would try it with a *.txt - file.

I hope I have clarified better, what I want.
In any case, I would be grateful for any further information.

Klaus












Peace worldwide - it starts here...
 
No, Klaus,

that site is not only about VBA, it's about office automation, these objects are available in automation to VFP.
We already had the start of all automation, didn't we?

Code:
oWord = CreateObject("Word.Application")
Now it's only one more step up to reading in the content of a word document, and that step is first loading it into word.
oWord.Documents.Open(fullpathtowordfile) would do that.

And then oWord.ActiveDocument is that document.

And since you want to read out documents repeatedly, you better do it that way, not manually.

Chriss
 
Hi Klaus,

klaus said:
I think it would be easier to filter some elements from a table (e.g. the 7.th move which Black had done in most cases ) and not searching in memo-fields for that

I'm not sure about this. There are several functions for fast searching in strings/memo fields: AT, ATLINE and OCCURS.

Below the code for searching phone numbers in a memo field (cursor with 50'000 records - 50'000 * 5 lines in memo fields). The third column in the result pane (Filtered Data) tells you at which line of the memo field the searched string is found (1st occurrence) and the fourth column tells you the number of occurrences of the searched string in that memo field.

Code:
goForm = CREATEOBJECT("clsMainForm")
goForm.Visible = .T.
goForm.SHOW()

Read EVENTS

CLOSE ALL

CLEAR ALL 

RETURN 

**********		

Define CLASS clsMainForm AS FORM

		Caption = "Phonenumbers"
		AutoCenter = .T.
		BorderStyle = 3
		Width = 600
		MinWidth = 600
		MaxWidth = 600
		Height = 600
		MinHeight = 600
		MinButton = .F.
		MaxButton = .F.
		Themes = .F.
		ShowTips = .T.

	ADD Object "lblFound" as "Label" with ;
		Visible = .T. , ;
		Autosize = .T. , ;
		Left = 12, ;
		Top = ThisForm.Height - 24, ;
		Caption = "Names found ", ;
		Anchor = 6
					
	ADD Object "lblPhoneNumbers" as "Label" with ;
		Visible = .T. , ;
		Autosize = .T. , ;
		Left = 12, ;
		Top = ThisForm.Height - 48, ;
		Caption = "Enter digits to search for ", ;
		Anchor = 6
					
	ADD object "txtPSearch" as "TextBox" WITH ;
		Visible = .T. , ;
		Left = 162, ;
		Top = ThisForm.Height - 48, ;
		Height = 21, ;
		Width = 168, ;
		Anchor = 6
		
	ADD object "cmdSearch" as "CommandButton" WITH ;
		Visible = .T. , ;
		Caption = "Search", ;
		Left = 360, ;
		Top = ThisForm.Height - 48, ;
		Height = 36, ;
		Anchor = 6
		
		PROCEDURE cmdSearch.Click()
			LOCAL lcPHNumber
			
			lcPHNumber = ALLTRIM(ThisForm.txtPSearch.Value)
		
			SELECT *, CAST(0 as Integer) as iLine, CAST(0 as Integer) as iOccurs FROM csrPhoneNumbers ;
					WHERE AT(lcPHNumber, mPhoneNumber) # 0 ;
					INTO CURSOR tmpPHNumbers READWRITE 

			SELECT tmpPHNumbers
			
			UPDATE tmpPHNumbers SET iLine = ATLINE(lcPHNumber, mPhoneNumber), iOccurs = OCCURS(lcPHNumber, mPhoneNumber)
			
			LOCATE 

			IF _Tally > 0
			
				ThisForm.lblFound.Caption = "Names found : " + ALLTRIM(TRANSFORM(_Tally, "9,999,999"))
			
				WITH ThisForm.pgfMain
					.Page2.Enabled = .T.
					.ActivePage = 2
					.Page2.Click()

				ENDWITH 
			ELSE 
			
				ThisForm.pgfMain.Page2.grdPhoneNumbers.Visible = .F.
				
				= MESSAGEBOX("No data found!", 48, "Search Phonenumbers", 2500)
				
				WITH ThisForm.pgfMain
					.ActivePage = 1
					.Page1.Click()
					
				ENDWITH 			
			ENDIF 
		ENDPROC 

	Add OBJECT cmdExit AS COMMANDBUTTON WITH;
		Caption = "Exit", ;
		Backcolor = RGB(192,192,192), ;
		Left = ThisForm.Width - 120, ;
		Top = ThisForm.Height - 48, ;
		Height = 36, ;
		Anchor = 4 + 8

		PROCEDURE cmdExit.CLICK
			ThisForm.Release()
			CLEAR Events
			
		ENDPROC              

	ADD OBJECT pgfMain AS PageFrame WITH;
	    PAGECOUNT = 2, ;
	    LEFT = 12, ;
    	TOP = 12, ;
	    WIDTH = THISFORM.WIDTH - 24, ;
    	HEIGHT = THISFORM.HEIGHT - 78, ;
    	Anchor = 15
    
		PROCEDURE pgfMain.Init()
			LOCAL loPage as Object
				
			FOR i = 1 TO This.PageCount
				loPage = This.Pages(i)
				loPage.AddObject("grdPhoneNumbers","grdBase")
				loPage.Caption = ICASE(i = 1, "Original Data","Filtered Data" )

			ENDFOR 
			
			This.Page2.Enabled = .F.
			This.Page1.Click()
			
		ENDPROC 
		
		PROCEDURE pgfMain.Page1.Click()
			LOCAL loPage 
			
			loPage = Thisform.pgfMain.Page1
			
			WITH loPage.grdPhoneNumbers
				.ColumnCount = -1
				.RecordSource = "csrPhoneNumbers"
				
				.Column1.Header1.Caption = "Name"
				.Column1.Width = 240
				
				WITH .Column2
		    		.Header1.Caption = "PhoneNumbers"
		    		.NewObject("edtComments","edtPHNumbers")
					.edtComments.Visible = .T.
					.CurrentControl = "edtComments" 
					.Width = 240
					.Sparse = .F.
					
				ENDWITH 
			ENDWITH
		ENDPROC 

		PROCEDURE pgfMain.Page2.Click()
			LOCAL loPage 
			
			loPage = ThisForm.pgfMain.Page2

			WITH loPage.grdPhoneNumbers
				.Visible = .T.
				.ColumnCount = -1
				.RecordSource = "tmpPHNumbers"
				
				.Column1.Header1.Caption = "Name"
				.Column1.Width = 216
					
				WITH .Column2
		    		.Header1.Caption = "PhoneNumbers"
		    		.NewObject("edtComments","edtPHNumbers")
					.edtComments.Visible = .T.
					.CurrentControl = "edtComments" 
					.Width = 216
					.Sparse = .F.
						
				ENDWITH 
				
				WITH .Column3
					.Header1.Caption = "Line"
					.Width = 36
					.FontBold = .T.

				ENDWITH 

				WITH .Column4
					.Header1.Caption = "N"
					.Width = 36
					.FontBold = .T.

				ENDWITH 
			ENDWITH 
		ENDPROC 
		
	PROCEDURE Load()
		CREATE CURSOR csrPhoneNumbers (cName C(25), mPhoneNumber M)
		
		FOR i = 1 TO 50000
				INSERT INTO csrPhoneNumbers (cName, mPhoneNumber) VALUES ("T" + SYS(2015), "+352 - " + ALLTRIM(STR(100000000 * RAND())) + " - Home")
		ENDFOR
		
		UPDATE csrPhoneNumbers SET mPhoneNumber = mPhoneNumber + CHR(13) + "+32 - " + ALLTRIM(STR(100000000 * RAND())) + " - Office"
		UPDATE csrPhoneNumbers SET mPhoneNumber = mPhoneNumber + CHR(13) + "+49 - " + ALLTRIM(STR(100000000 * RAND())) + " - Cellphone"
		UPDATE csrPhoneNumbers SET mPhoneNumber = mPhoneNumber + CHR(13) + "+33 - " + ALLTRIM(STR(100000000 * RAND()))
		UPDATE csrPhoneNumbers SET mPhoneNumber = mPhoneNumber + CHR(13) + "+44 - " + ALLTRIM(STR(100000000 * RAND()))

		LOCATE 
		
	ENDPROC 
	
	PROCEDURE Destroy()
		This.cmdExit.Click()
		
	ENDPROC 
	
      
ENDDEFINE

*****

DEFINE CLASS grdBase AS Grid

		Top = 12
		Left = 12
		Height = 600 - 84 - (4 * 12)
		Width = 600 - (4 * 12)
		BackColor = RGB(0, 240, 240)
		RowHeight = 90
		AllowRowSizing = .F.
		HeaderHeight = 21
		AllowHeaderSizing = .F.
		DeleteMark = .F.
		ReadOnly = .T.
		Anchor = 15
		Visible = .T.
		
ENDDEFINE 

***** 

DEFINE CLASS edtPHNumbers as EditBox
		BackColor = RGB(0, 240, 240)
		DisabledBackColor = RGB(0, 240, 240)
		IntegralHeight = .T.
		
ENDDEFINE 

*****

hth

MarK
 
There's a simpler argumentation for separate moves still being as easy to search, even if you specifically want to search X as the 7th move. That's simply WHERE moveno=7 and move=X instead of WHERE move7=X.
And it allows you to look for move patterns independent on move number, too. Because you can simply search for move=X and then determine the movenumber moveno and then read further moves from there and see how long streaks match with other games.

Don't think of just one search case and let it determine your storage schema, that's a bad idea. You can always do any search simpler in a normalized structure. Searching for a specific move in any move number, like at which move number the players castle in average is as easy as SELECT AVG(moveno) FROM moves where move='0-0' or '0-0-0' and to determine that specifically for the queen or king side of the board simply one filter for one of 0-0 or 0-0-0. Try to do the same with your data schema. Just to look for games which have '0-0' you have to make a clause like WHERE b5='0-0' or w5='0-0' or b5='0-0' or ... - well, how long of conditions do you want to write out or generate? It's really really not the best format of data.

I don't ever saw anybody being happy with a choice other than a normalized data schema unless they made that a data store that was intentionally storing things redundant in several ways, for example as a datawarehouse in the typical dimension tables, star schema. But that would be fed from a normalized database as the source.

Once you have a moves table with gameid, moveno, move, player (1/2, white/black) you can always also generate a table like w1,b1,w2,b2, etc. from that data. So go for norms, Klaus. Even though we once earlier talked about new NoSQL databases storing data in unusual non-normalized schemas (within threads that likely are deleted now), it's not the major idea to break off of normalized data structures to enhance database performance, it always comes with a price of neglecting relationships other than one you focus on, like in your case single games.

Chriss
 

Hi Mark, I tested your programm - and yes - it convinced me about its high-speed to search in memo-fields.
Thank you for this demonstration.



Steve - I also tested your hint concerning GETWORDCOUNT and GETWORDNUM.
Yes - for the pure game-moves this could be a good solution. But that means obviously to keep the move area separately from other information as there are Name,Prename,Dates etc. GETWORDNUM splits too much in that area.
Thanks
I am very amazed how many new things I learn because of my question.

Klaus


Peace worldwide - it starts here...
 
Chriss:
I got several hints, therefore I am unsure how to proceed.


I tried that, and of course it worked, because FILETOSTR had no problem to create a string from a textfile.
However: The WORD-Datei was created by dragging and droping the game fromm an internet-page into WORD - as a manual process, as I do not know how to automate that.
But - instead to save the document into WORD, I avoid that saving process into a plain text file, when I copy the contents from the net direct into a textfile.

I tried FILETOSTR() with a WORD file, but the result is encrypted.
So in this case the automation with WORD is not yet a help for my goal (of course in other cases it would be a good help, as WORD and VFP can communicate well)

Greg, as described above this could be useful if a Word-Document is a direct source, but in this case I get the information from the Internet.

I hope I haven't made any mistakes in thinking.
As long as I don't get the data I need from the chess games directly on my computer, and as long as I want to work with FILETOSTR(), a WORD file isn't of much use, since I have to convert it to a text file after all.

Regards
Klaus









Peace worldwide - it starts here...
 
The WORD-Datei was created by dragging and droping the game fromm an internet-page into WORD - as a manual process, as I do not know how to automate that.

I didn't know the data originally came from a web page. Instead of dragging and dropping from the web page into Word, have you considered saving the web page as an HTML file, which should be quite easy to do?

You could then open the HTML in Word, and programmatically save it as a text file. Or - depending on the structure of the HTML - read that file straight into VFP via FILETOSTR().

If you would like to post a link to the original web page, we can judge how easy it will be to parse it into VFP variables. (I think you posted the link once before in an earlier thread, but I can't see it just now.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
You could try this:

Code:
oInet = CREATEOBJECT("inetctls.inet.1")
lcGames = oInet.OpenURL("[URL unfurl="true"]http://www.chess-games.org.uk/index.htm")[/URL]
    && of course you should substitute the actual URL here

This will give you the contents of the original web page in a VFP variable.

What you do next depends on the format and layout of the HTML code.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Klaus said:
I tried FILETOSTR() with a WORD file, but the result is encrypted.
So in this case the automation with WORD is not yet a help for my goal

Klaus, you contradict yourself here, word automation of course is NOT done by filetostr() of a world file, but as I said you start with oWord = CreateObjecz("Word.Application"), let that word instance you control programmatically load a word file (as it's not just a text file, but a binary file - not encrypted, just binary, and much more than just the words, too.)

But overall I agree with Mike, if your start is a webpage and you copy that into a doc, then copying to a text file instead, i.e. using notepad or notepad++ instead of Word, means a much easier outset to start from, but then as Mike also suggests, you can even skip the step of manually copying the game data into any other window finally storing it to a file, you can grad the HTML by browser automation or as Mike demonstrates a simpler internet control OLE object. You can also use one API call like URLDownloadToFile, which would not at all load this into any control/canvas, browser interface but directly to a file.

And sure, this has still a lot more than just the moves, it has all surrounding HTML. But you surely can find the parts you actually want and since HTML is a textual file, while it may use UTF-8 encoding and not the ANSI codepage of VFP, the letters and numbers and many more simple characters are a common base and you likely won't even need to do a conversion of any kind and not even use any OLE control or automation, just text processing.

And for that, MarK (mjcmkrsr) has pointed out a good article of Steven Black. What's not in that article, unfortunately, is STREXTRACT. It's one of the most useful functions for extraction of partial strings delimited by given brackets, not only single character brackets like ( and ) but the typical brackets HTML tags are, like '<p>' and '</p>'.

There are pros and cons to the aspect of parsing the actual HTML or what a HTML interpreter makes of it into a document object model. So you still have multiple choices.



Chriss
 
We could also put all the technological ideas aside.

If you come across games as you browse the web fro them on sites discussing games, there's actually no big benefit of automating the process of getting the games if you first always discover them yourself anyway, read about them, see a discussion about the rating to entertainment value such a game has and then decide manually, it's not much time saved to select the moves out of the browser instead of extracting them by code, is it?

Even if you know a site you want to grab "all their games", how easy is it to go through all the URLs of games? If you need to manually feed in the URLs to a program you write that then can extract the games, that's just defering the simple task to just copy out the game manually. So it only pays it you know a URL pattern or the site actually offers an API to automate it. And in such a case you likely also get at much simpler to consume data than just the display of games, i.e. CSV data of games.

Chriss
 
Klaus, Not to detract from anything that Chris has said ...

I gave you some code (above) to download the HTML direct from the web page into a VFP variable. I don't know what that HTML will look like. It might be too complicated to parse out the data that you want (I suspect it has a lot of JavaScript in it.)

So here is some code that should download the HTML, then load it into Word, and for Word to save it as plain text. Based on the DOCX in your first post in this thread, that text file should be easy to understand and to parse.

Code:
* Download HTML from web page to a variable
oInet = CREATEOBJECT("inetctls.inet.1")
lcGames = oInet.OpenURL("[URL unfurl="true"]http://chess-games.org/index.htm")[/URL]
    && substitute the actual URL here

* Save the HTML to a new file 
lcFile = FORCEPATH("games.htm", SYS(2023))
STRTOFILE(lcGames, lcFile)

* Open the HTML file in Word
oWord = CREATEOBJECT("word.application")
oDoc = oWord.Documents.Open(lcFile)

* Tell Word to save the file as plain text
lcFile_1 = FORCEEXT(lcFile, "txt")
oDoc.SaveAs2(lcFile_1, 2)
   && The second parameter is 2 to indicate a text file

* Read that text file into a variable
lcGames = FILETOSTR(lcFile_1)

* Clean up
oWord.Quit
RELEASE oWord

I haven't tested this code very carefully, so can't guarantee it 100%, but it should give you a possible line of attack. I'm happy to try to develop this further if I can see an actual web page which shows the games.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Mike and Chriss, again I have to thank you.


Here is a link for the first game in my example.
That links can be reached by typing some chess-moves and in a big database this came out.



which looks like this (photo below)

Warkentin_2022-08-26_183516_oq9xyv.jpg


That allows you to play/repeat the game with the buttons below the chessboard.

I am interested to get the data of the game (move 1 to 32 plus result (1-0). (on the right side)
What I did, when I started this thread I copied it into WORD at first, and of course it could be copied in Notepad etc.

It is also possible to save this web-site as a *.htm-file - and (lucky) I found the game when I edited the html.version

Moves_warkentin_Screenshot_2022-08-26_185759_jsnpg7.jpg


This screenshot is not good readable, it would be nice if you could follow these steps on your pc. This web-page is normally only reachable with a password to get far as I can as a registered user. (17 € p.year)

Mike: I will try to run your code tomorrow again - at the moment I have an Ole-dispatch error, because the html-adress is not to be found in Internet. Will try it tomorrow to overcome this.

Regards
Klaus




Peace worldwide - it starts here...
 
Looks okay to parse it out, moves are numbered as half-moves. The move 3 you selected here (Nc3) is found in the screenshot of the website as first half move of the second move.

The HTML does not use an easy to match pattern, but you could extract the HTML including the tag starting with '<a href="javascript:chess_game.SetMove' which is common for all moves and ending in '</a>', as any link. Once you have that, find just the text of the half move between the innermost '> and '<'. So a StrExtract on the result of a StrExtract could be used here.



Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top