2024-11-25, 12:34:21
Hi,
You are correct that I am missing details in order to give you a complete answer. The screenshot does not tell me much I'm afraid, a lot depends on the actual html behind it.
Either way though, for this you're going to have to use javascript.
Please make sure you are using either AntView version 1.1.460 or AntView version 2.0.459 (or later) as they have much improved VFP examples over earlier versions.
Then in the standard example put the following code in the "Html to _cliptext" button of the AntView form.
This is a very basic javascript example that gets the urls from each hyperlink on the currently rendered page.
Those you can then use in a new form and navigate to them in a new AntView control.
However.. if these pages are on a protected website then there's a chance that it is protected in a way that you need to artificially "click" on the links of interest.
If that's the case then change the line:
depending on the actual html.
If the hyperlinks have an "id" attribute you'd use the first one, if they have a "name" attribute then you can get the last one.
Then you can use ElementClickById, respectively ElementClickByName to click on the link.
If the link is set to open a new browser you can handle the new window popup from within VFP.
As this is a bit much to explain, please have a look at the "Advanced" examples folder.
Make sure to read the "Help" page from the help button in the demo's as it has a lot of explanations on how-to do things with the AntView control in VFP.
Hope this helps and if not please send me the html of that screenshot by email.
--
Wil
You are correct that I am missing details in order to give you a complete answer. The screenshot does not tell me much I'm afraid, a lot depends on the actual html behind it.
Either way though, for this you're going to have to use javascript.
Please make sure you are using either AntView version 1.1.460 or AntView version 2.0.459 (or later) as they have much improved VFP examples over earlier versions.
Then in the standard example put the following code in the "Html to _cliptext" button of the AntView form.
Code:
* enumerate all links for the current page
lcCurrentHtml = ''
lnReturn = 0
lcNewLine = CHR(13)+CHR(10)
lcScript = '() => { ' + lcNewLine
lcScript = lcScript + ' let result="";' + lcNewLine
lcScript = lcScript + ' let ele = document.getElementsByTagName("a");' + lcNewLine
lcScript = lcScript + ' for (let i = 0; i < ele.length; i++) {' + lcNewLine
lcScript = lcScript + ' result=result+ele[i].href+";";' + lcNewLine
lcScript = lcScript + ' }' + lcNewLine
lcScript = lcScript + ' return result;' + lcNewLine
lcScript = lcScript + ' }' + lcNewLine
lcData = ''
lnreturn = thisform.oAntviewDocument.RunAnonymousFunctionsync(1,0,lcScript,@lcData)
MESSAGEBOX('lnreturn is '+STR(lnreturn)+' data returned is '+lcData)
This is a very basic javascript example that gets the urls from each hyperlink on the currently rendered page.
Those you can then use in a new form and navigate to them in a new AntView control.
However.. if these pages are on a protected website then there's a chance that it is protected in a way that you need to artificially "click" on the links of interest.
If that's the case then change the line:
Code:
lcScript = lcScript + ' result=result+ele[i].href+";";' + lcNewLine
into
lcScript = lcScript + ' result=result+ele[i].id+";";' + lcNewLine
or
lcScript = lcScript + ' result=result+ele[i].name+";";' + lcNewLine
If the hyperlinks have an "id" attribute you'd use the first one, if they have a "name" attribute then you can get the last one.
Then you can use ElementClickById, respectively ElementClickByName to click on the link.
If the link is set to open a new browser you can handle the new window popup from within VFP.
As this is a bit much to explain, please have a look at the "Advanced" examples folder.
Make sure to read the "Help" page from the help button in the demo's as it has a lot of explanations on how-to do things with the AntView control in VFP.
Hope this helps and if not please send me the html of that screenshot by email.
--
Wil