Read HTML page

Read HTML page

Postby Natter » Sun May 18, 2008 7:29 am

Hi, all !

I open HTML page

Code: Select all  Expand view
oActiveX:=TActiveX():New( oWnd, "Shell.Explorer" )
oWnd:oClient:=oActiveX
oActiveX:Do( "Navigate2", cMyURL )


It is possible read/write controls of page (Gets, tables. Events press button/menu) from FWH
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Postby Antonio Linares » Sun May 18, 2008 8:00 am

You can manage the events that you receive from the ActiveX.

Please review fwh\samples\WebExp.prg source code
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Natter » Sun May 18, 2008 8:49 am

Thank, Antonio !

But I not understand how I can read content of get field ?
Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Postby Antonio Linares » Sun May 18, 2008 8:59 am

You need to search in Google for properties and methods documentation for "Shell.Explorer" ActiveX
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Sun May 18, 2008 9:08 am

If you have Office installed, then go to its VB editor (Macros) and open a project. There you can place a WebBrowser object and find a lot of usefull information:
Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Antonio Linares » Sun May 18, 2008 9:12 am

Once seen some of its properties, then its easier to search in Google :-)

http://msdn.microsoft.com/en-us/library ... ument.aspx

http://msdn.microsoft.com/en-us/library ... ument.aspx

I guess "document" is the property that you need to manage

http://msdn.microsoft.com/en-us/library ... tbyid.aspx
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Natter » Sun May 18, 2008 9:25 am

Natter
 
Posts: 1215
Joined: Mon May 14, 2007 9:49 am

Postby George » Tue Nov 18, 2008 1:53 am

Natter,
Did you resolve how to pass a value to a GET field into a webpage?
Can you share your experience?

Regards,

George
George
 
Posts: 725
Joined: Tue Oct 18, 2005 6:49 pm

Postby MGA » Tue Nov 18, 2008 10:18 am

DEFINE WINDOW oWndnet MDICHILD OF oWnd vscroll icon oico TITLE ".:: Internet ::. "+alltrim(cENDE)

DEFINE BUTTONBAR oBarnet size 34,34 3D OF oWndnet
DEFINE BUTTON OF oBarnet resource "B1" NOBORDER ACTION( oActiveX:Do( "GoBack" ) ) MESSAGE "Voltar" tooltip "Voltar"
DEFINE BUTTON OF oBarnet resource "B2" NOBORDER ACTION( oActiveX:Do( "GoForward" ) ) MESSAGE "Avançar" tooltip "Avançar"
DEFINE BUTTON OF oBarnet resource "STOP2" NOBORDER ACTION( oActiveX:Do( "ExecWB",23,1 ) ) MESSAGE "Parar" tooltip "Parar"
DEFINE BUTTON OF oBarnet resource "REFRESH" NOBORDER ACTION( oActiveX:Do( "ExecWB",22,1 ) ) MESSAGE "Atualizar" tooltip "Atualizar"
DEFINE BUTTON OF oBarnet resource "SAVE2" NOBORDER ACTION( oActiveX:Do( "ExecWB", 4,1 ) ) MESSAGE "Salvar como" tooltip "Salvar como"
DEFINE BUTTON OF oBarnet resource "PRINT10" NOBORDER ACTION( oActiveX:Do( "ExecWB", 7,1 ) ) MESSAGE "Imprimir" tooltip "Imprimir"
DEFINE BUTTON OF oBarnet resource "QUIT2" NOBORDER ACTION( oWndnet:End() ) MESSAGE "Fechar" tooltip "Fechar"
oBarnet:bRClicked := { || ( NIL ) }


@ 0.7,42.5 say "Endereço:" of oBarnet size 50,18 font oFontenet
@ 0.7,38.5 btnget ocamnet var cENDE of oBarnet size 300,19 font oFontenet valid (if(GetKeyState( VK_RETURN ),obotnet:setfocus(),),.t.)
@ 0.4,102 buttonbmp obotnet PROMPT SPACE(5)+"&Ir" of oBarnet bitmap "SETA" size 50,22 TEXTRIGHT font oFontenet action(grava_parametro('FWULTIMOEMAIL',alltrim(cEnde)),oWndnet:ctitle(".:: Internet ::. "+alltrim(cENDE)), oActiveX:Do( "Navigate", alltrim(cENDE) ),cPesq:=space(100),ocamne2:refresh())

@ 0.7,113 say "Pesquisa:" of oBarnet size 50,18 font oFontenet
@ 0.7,91 btnget ocamne2 var cPesq of oBarnet size 213,19 font oFontenet valid (if(GetKeyState( VK_RETURN ),obotpes:setfocus(),),.t.)
@ 0.4,157.6 buttonbmp obotpes PROMPT SPACE(5)+"&Ir" of oBarnet bitmap "GOOGLE" size 50,22 TEXTRIGHT font oFontenet action(oWndnet:ctitle(".:: Internet - Pesquisa ::. "+alltrim(cPesq)),if(empty(cPesq),msg("Nenhuma palavra foi digitada!"),GoogleSearch(AllTrim(STRTRAN(cPesq," ","+")),@cENDE,ocamnet)))


oActiveX := TActiveX():New( oWndnet, "Shell.Explorer" )
oActiveX:SetProp( "StatusBar", .t. )
oWndnet:oClient := oActiveX

ACTIVATE WINDOW oWndnet MAXIMIZED on init(ocamnet:setfocus(),oActiveX:Do( "Navigate", alltrim(cSite) ));
valid(oActiveX:end(),.t.)
return(.t.)

******************************************
Function GoogleSearch(cAlgo,cENDE,ocamnet)
******************************************
local hE, cVar1, cVar3,cLink

cVar1 := "http://www.google.com/search?q="
cVar3 := "&ie=UTF-8&oe=UTF-8&hl=pt&btnG=B%C3%BAsqueda+en+Google&lr="
cLink := cVar1+cAlgo+cVar3
oActiveX:Do( "Navigate", cLink)
cEnde := space(100)
ocamnet:refresh()
SysRefresh()
return nil

:)
ubiratanmga@gmail.com

FWH24.04
BCC7.3
HARBOUR3.2
xMate
Pelles´C
TDolphin
MGA
 
Posts: 1252
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá

Postby George » Tue Nov 18, 2008 3:45 pm

SGS

Thanks for sharing with us your code.
May you indicate the variables that are using your code?

Regards,

George
George
 
Posts: 725
Joined: Tue Oct 18, 2005 6:49 pm

Postby Antonio Linares » Tue Nov 18, 2008 7:37 pm

George,

Do you mean to fill a GET or to supply a value as a parameter ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby George » Tue Nov 18, 2008 8:29 pm

Antonio,

I mean to fill a GET with a value and click a button.
By example:
1) Go to www.whitepages.com
2) Go to the tab "Reverse Lookup" (to search Name and Address by the phone number)
3) Fill "Phone Number" GET field
4) Click on Search Button.

Last night I got a solution to this.
This is the code:

Code: Select all  Expand view
FUNCTION SearchNameByPhone(cPhone)
local oWnd, oActiveX, cMyUrl

cMyUrl := "www.whitepages.com/search/ReversePhone?full_phone="
cMyUrl := cMyUrl + alltrim(cPhone)

      DEFINE WINDOW oWnd TITLE "Verifying Customer's Phone Number" ;
         FROM 5, 220 TO 725, 900 pixel

      oActiveX = TActiveX():New( oWnd, "Shell.Explorer.2" )
      oWnd:oClient = oActiveX

      oActiveX:Do( "Navigate", cMyURL )
      sysrefresh()

      ACTIVATE WINDOW oWnd

      sysrefresh()

RETURN (.T.)




Regards,

George
George
 
Posts: 725
Joined: Tue Oct 18, 2005 6:49 pm

Postby Antonio Linares » Tue Nov 18, 2008 9:02 pm

George,

good solution! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42080
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 69 guests