Read HTML page

Post Reply
Natter
Posts: 1241
Joined: Mon May 14, 2007 9:49 am

Read HTML page

Post by Natter »

Hi, all !

I open HTML page

Code: Select all | Expand

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
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Post by Antonio Linares »

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
Natter
Posts: 1241
Joined: Mon May 14, 2007 9:49 am

Post by Natter »

Thank, Antonio !

But I not understand how I can read content of get field ?
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Post by Antonio Linares »

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: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Post by Antonio Linares »

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: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Post by Antonio Linares »

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
Natter
Posts: 1241
Joined: Mon May 14, 2007 9:49 am

Post by Natter »

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

Post by George »

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

Regards,

George
MGA
Posts: 1258
Joined: Mon Feb 25, 2008 2:54 pm
Location: Brasil/PR/Maringá
Contact:

Post by MGA »

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
George
Posts: 726
Joined: Tue Oct 18, 2005 6:49 pm

Post by George »

SGS

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

Regards,

George
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Post by Antonio Linares »

George,

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

Antonio Linares
www.fivetechsoft.com
George
Posts: 726
Joined: Tue Oct 18, 2005 6:49 pm

Post by George »

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

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
User avatar
Antonio Linares
Site Admin
Posts: 42521
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Has thanked: 31 times
Been thanked: 76 times
Contact:

Post by Antonio Linares »

George,

good solution! :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply