HMGSCRIPT RELOADED!

HMG announcements; Latest HMG-related news, releases, fixes and updates.

Moderator: Rathinagiri

User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT RELOADED!

Post by Roberto Lopez »

luisvasquezcl wrote:Estimado Roberto,
Es posible tener acceso a datos a traves de HTML/DOM o dependeremos de alguna aplicacion como php, asp, etc?.
aprovecho para quien esté interesado sobre el tema en la pagina http://www.w3schools.com hay un tutorial muy completo sobre este tema, html, dom, javascript, xml, css.
saludos,
Luis Vasquez
My idea about it right now is to use php scripts on the server side to access mysql tables, but I'm researching about that yet, so, if an easier/simpler way exist I'll explore it.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
luisvasquezcl
Posts: 1258
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Contact:

Re: HMGSCRIPT RELOADED!

Post by luisvasquezcl »

Estimado Roberto,
Lamentablemente la única fuente a la que se tiene acceso con jsp y vbs es a archivos de texto, ya sea .txt, xml; Ahora si se implementa el acceso a datos dependiendo de asp o php es reinventar la rueda, ya que estos programas te permiten acceso nativo.
Mi intención no es ser negativo sino analizar las posibilidades que nos dan las herramientas que tenemos.

Luis Vasquez.
User avatar
luisvasquezcl
Posts: 1258
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Contact:

Re: HMGSCRIPT RELOADED!

Post by luisvasquezcl »

Estimado Roberto,
Creo que la forma de conectar a hmg con internet seria de la siguiente forma:
0. Generar nuestra aplicación .exe
1. Crear ventana con hmg
2. Incrustar un objeto browser en nuestra ventana
3. Intercambiar datos con el browser :
3.1. para actualizar los datos de la pagina web
3.2. para obtener datos enviados a traves de un form.

los puntos 1 y 2 ya son posible en hmg a traves de Activex.
El punto 3 es el que nos causa problemas, y a medias, ya que a traves de activex tenemos acceso a HTML/DOM y con eso podemos enviar datos a la pagina web para que se actualize, no sé si para capturar datos, esto queda por aclarar. De esta forma el browser sólo nos presta el servicio para mostrar o capturar datos.
Esa es mi opinión, sin ánimo de criticar y al contrario, tratar de aportar y compartir aunque sea con una idea.
Cordialmente,
Luis Vásquez.
User avatar
luisvasquezcl
Posts: 1258
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Contact:

Re: HMGSCRIPT RELOADED!

Post by luisvasquezcl »

Estimado Roberto,
adjunto un demo respaldando mi mensaje anterior.
Aclaro que es posible leer el contenido de los controles de la pagina web.
En el demo viene:
- Abrir una pagina web.
- Leer un control text
- Insert texto al control text
- Insertar datos desde una dbf en una tabla una vez cargada la pagina.
Que lo disfruten.
Saludos cordiales,

Luis Vasquez
Attachments
Demo.ZIP
En el menu Navigate indica abrir la pagina html en la direccion c:/hmg/samples/activex/test_01.html, copien el ejemplo en la misma direccion o modifiquen el path del archivo .html cuando vayan a abrirlo.
(548.69 KiB) Downloaded 408 times
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT RELOADED!

Post by Roberto Lopez »

luisvasquezcl wrote:Estimado Roberto,
<...>
Ahora si se implementa el acceso a datos dependiendo de asp o php es reinventar la rueda, ya que estos programas te permiten acceso nativo.
Mi intención no es ser negativo sino analizar las posibilidades que nos dan las herramientas que tenemos.
Please read this post:

viewtopic.php?f=17&t=155

I've explained there the reasons to create HMGSCRIPT and technologies to use to achieve it.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT RELOADED!

Post by Roberto Lopez »

luisvasquezcl wrote:Estimado Roberto,
Creo que la forma de conectar a hmg con internet seria de la siguiente forma:
0. Generar nuestra aplicación .exe
1. Crear ventana con hmg
2. Incrustar un objeto browser en nuestra ventana
3. Intercambiar datos con el browser :
3.1. para actualizar los datos de la pagina web
3.2. para obtener datos enviados a traves de un form.
<...>
It could be possible, but such solution limit you to use Windows clients only and require that your HMG application be installed on the client machine.

IMHO, these limitations will impede the use of our applications in lots of new real world scenarios, and the n unacceptable.

One of the main goals of the HMGSCRIPT project is that our applications be accessible from any device connected to the Internet bundled with a JavaScript capable browser.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT RELOADED!

Post by Roberto Lopez »

luisvasquezcl wrote:Estimado Roberto,
adjunto un demo respaldando mi mensaje anterior.
Aclaro que es posible leer el contenido de los controles de la pagina web.
En el demo viene:
- Abrir una pagina web.
- Leer un control text
- Insert texto al control text
- Insertar datos desde una dbf en una tabla una vez cargada la pagina.
Que lo disfruten.
Saludos cordiales,

Luis Vasquez
I already know that this is possible :)

Many of the work I've made the lasts months, was to develop HMG desktop clients to access web servers running MySql and PHP.

I've used a different (simpler) approach, sending http requests to the server in the same way that a client web browser could do, but from HMG apps.

I've already explained this technique in this forum. You have samples of this on HBTIP folder in Harbour source distribution.

Regards,

Roberto.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
luisvasquezcl
Posts: 1258
Joined: Thu Jul 31, 2008 3:23 am
Location: Chile
Contact:

Re: HMGSCRIPT RELOADED!

Post by luisvasquezcl »

Entiendo tu punto de vista.
Tienes razón que mi solución es limitante a un sistema operativo.
Bueno, tienes una larga tarea por delante, te deseo suerte,
cordialmente,
Luis Vasquez.
User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: HMGSCRIPT RELOADED!

Post by Rathinagiri »

Many of the work I've made the lasts months, was to develop HMG desktop clients to access web servers running MySql and PHP.
Is it so? It's great. Let me try too!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: HMGSCRIPT RELOADED!

Post by Roberto Lopez »

rathinagiri wrote:
Many of the work I've made the lasts months, was to develop HMG desktop clients to access web servers running MySql and PHP.
Is it so? It's great. Let me try too!
AFAIK, we already talked about it some time ago.

The concept is pretty simple. You must send an http request to the server in the same way that a browser does.

Here is an HBTIP console sample (I guess I've already posted):

Code: Select all

/*
 * $Id: loadhtml.prg 8734 2008-06-15 21:11:36Z vszakats $
 */

// Sends a query to Google and displays the Links from the response HTML page

PROCEDURE Main
   LOCAL oHttp, cHtml, hQuery, aLink, oNode, oDoc

   oHttp:= TIpClientHttp():new( "http://www.google.de/search" )
   
   // build the Google query
   hQUery := hb_Hash()
   hb_hSetCaseMatch( hQuery, .F. )

   hQuery["q"]    := "xHarbour"
   hQuery["hl"]   := "en"
   hQuery["btnG"] := "Google+Search"

   // add query data to the TUrl object
   oHttp:oUrl:addGetForm( hQuery )

   // Connect to the HTTP server
   IF .NOT. oHttp:open()
      ? "Connection error:", oHttp:lastErrorMessage()
      QUIT
   ENDIF

   // download the Google response
   cHtml   := oHttp:readAll()
   oHttp:close()
   ? Len(cHtml), "bytes received "

   oDoc := THtmlDocument():new( cHtml )

   oDoc:writeFile( "Google.html" )

   // ":a" retrieves the first <a href="url"> text </a> tag
   oNode := oDoc:body:a
   ? oNode:getText(""), oNode:href

   // ":divs(5)" returns the 5th <div> tag
   oNode := oDoc:body:divs(5)

   // "aS" is the plural of "a" and returns all <a href="url"> tags
   aLink := oNode:aS

   FOR EACH oNode IN aLink
      ? HtmlToOem( oNode:getText("") ), oNode:href
   NEXT
RETURN

So, from the server point of view, your desktop app is the same as a client browser form.

Is really simple and there is not any secret.

Regards,

Roberto
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply