BrowserSetElement Problem

Questions and information about creating Internet aware NeoBook applications. Including PHP, HTML, FTP, HTTP, Email, etc.

Moderator: Neosoft Support

Locked
gusgusl
Posts: 263
Joined: Fri Mar 12, 2010 12:44 pm

BrowserSetElement Problem

Post by gusgusl »

uso lo siguiente para introducir un texto en una pagina que tiene un campo de texto, la idea es hacerlo desde Neobook
Use the following to introduce a text in a page that has a text field, the idea is to do it from Neobook

FocusObject "WebBrowser6"
BrowserSetElement "WebBrowser6" "ctl00$ContentPlaceHolder1$TBCelular" "[Numero]"

pero lo que necesito es que se actualize el campo de texto cada vez que ingreso un nuevo valor
But what I need is to update the text field every time I enter a new value

this is de code of page in the webbrowser

<input name="ctl00$ContentPlaceHolder1$TBCelular" type="text" value="097065764" maxlength="9" id="ctl00_ContentPlaceHolder1_TBCelular" tabindex="2" autocomplete="off" onkeyup="setearLeyenda(event)" onkeypress="javascript:return ValidNum(event);" style="border-color:Gray;border-width:3px;border-style:solid;font-size:40px;font-weight:bold;height:42px;width:250px;">
Neosoft Support
NeoSoft Team
Posts: 5628
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA
Contact:

Re: BrowserSetElement Problem

Post by Neosoft Support »

Do you want to update a NeoBook variable from the browser?

You can do something like this:

window.external.nbSetVar( '[FirstName]', mainform.FirstName.value );

In NeoBook's help file go to the WebBrowser object section and look for "two-way communication."
NeoSoft Support
gusgusl
Posts: 263
Joined: Fri Mar 12, 2010 12:44 pm

Re: BrowserSetElement Problem

Post by gusgusl »

What I need is to update the "text field" that is on the web page with the value entered from Neobook using the command "Set elements"
The problem is the following:
I need to interact with a web page to make recharges to cell phones, when entering the number in the corresponding field in the web page the "text field" detects each number entered and shows the logo of the telephone company based on the first 3 Numbers entered
If I do from the page directly there is no problem but if I do from Neobook sending a number to a number using "Set elements" for some reason does not detect the phone company and does not allow me to continue with the process, so I need to update that "field Text "of the page in some way


lo que necesito es actualizar el "campo de texto" que esta en la pagina web con el valor ingresado desde Neobook mediante el comando "Set elements"
El problema es el siguiente:
Necesito interactuar con una pagina web para hacer recargas a celulares,al momento de ingresar el numero en el campo correspondiente en la pagina web el "campo de texto" detecta cada numero ingresado y muestra el logo de la compañia telefonica en base a los 3 primeros numeros ingresados.
Si lo hago desde la pagina directamente no hay problema pero si lo hago desde Neobook enviandole numero a numero mediante "Set elements" por alguna razon no detecta la compañia telefonica y no me permite seguir con el proceso,por eso necesito actualizar ese "campo de texto" de la pagina de alguna manera
User avatar
virger
Posts: 540
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: BrowserSetElement Problem

Post by virger »

Quiza te pueda ayudar. Intenta esto.

Code: Select all

NBW Publication Source File
(C)2016 NeoSoft Corp.
Title=WEB vs. NeoBook
Author=GdoSan/Apr-2017
Language=US
NeoBookVer=5,80
ScreenColors=16777216
ScreenWidth=470
ScreenHeight=350
BkndColor=0
ScreenAutoSize=Yes
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=31
BiDiMode=0
UseUpdateTimer=Yes
ReturnTime=60
ShapeTransColor=536870912
SplashProps=3
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Setup
SetupColors=16711680|0|65535
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
ReqExLevel=1
CustomFontName=Arial
CustomFontSize=9
CustomFontStyle=0
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Cancel
L_YES=Yes
L_NO=No
L_CLOSE=Close
L_ERRORTITLE=Error
L_FINDTITLE=Find
L_FINDPROMPT=Find &What
L_FINDFIRST=&Find First
L_FINDNEXT=Find &Next
L_FINDERROR=Search text not found.
L_PWORDTITLE=Password required
L_PWORDMSG=Before continuing, you must first|enter the correct password.
L_PWORDPROMPT=&Password:
L_PWORDERROR=That's not the right password!
L_MEDIAERROR=In order to play this type of file you must install|the appropriate multimedia hardware and/or|software.
L_INTERNETERROR=Unable to locate Internet Browser software.
L_ABORTFUNCTION=Do you want to cancel this function?
L_EXTRACTERROR=This file could not be extracted and cannot be played.
L_INSTDIRPROMPT=Please enter the drive and directory where you would like this program to be installed. To accept the default drive and directory, simply press Enter.
L_INSTFOLDERPROMPT=Do you wish to create a program folder?
L_INSTRUNPROMPT=Do you want to run
L_INSTDISKPROMPT=Please insert disk #
L_INSTDISKERROR=That's not the correct disk, try again.
L_INSTGENERROR=The installation has terminated.
L_INSTEXITPROMPT=Do you really want to cancel the installation?
L_INSTWINTITLE=Setup
L_INSTPROGTITLE=Extracting Files...
L_SENDEMAIL=Sending Mail...
L_MAILSERVER=Please enter the name of your outgoing email server:
L_COPY=Copy to Clipboard
L_SELECTALL=Select All
L_DONWLOADFILE=Downloading: %s
L_PLEASEWAIT=Please wait...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Open
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Exit
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=New Page
PageStyle=0
PageColor=16777215
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
ObjectType=3
Name=BtCreateWeb
X=172
Y=9
W=121
H=30
Anchor=0
Text=Create Web
Align=2
ImageStyle=0
ObjAction=BrowserLoadFromStr "Web" "<div align='center'>|<b><i><u>FROM COSTA RICA</u></i></b>|<hr>|<input|name='ctl00$ContentPlaceHolder1$TBCelular'|type='text'|value='097065764'|maxlength='9'|id='ctl00_ContentPlaceHolder1_TBCelular'|tabindex='2'|autocomplete='off'|onkeyup='setearLeyenda(event)'|onkeypress='javascript:return ValidNum(event);'|style='border-color:Gray;border-width:3px;border-style:solid;font-size:30px;font-weight:bold;height:42px;width:250px;'>|<hr>|<font size='+2'>|PURA VIDA|</font>|</div>"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=2
ObjectType=14
Name=Web
X=3
Y=91
W=459
H=179
Anchor=0
VarName=[WebStatus]
TitleVarName=[WebTitle]
URLVarName=[WebAddr]
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=3
ObjectType=9
Name=EnCel
X=162
Y=52
W=140
H=30
Anchor=0
VarName=[vCel]
Align=1
EditNumber=Yes
EditLen=9
ObjAction=..strlen "[vCel]" "[Ln]"¶..if "[Ln]" "=" "9"¶..    BrowserSetElement "Web" "ctl00$ContentPlaceHolder1$TBCelular" "[vcel]"¶..endif¶¶BrowserSetElement "Web" "ctl00$ContentPlaceHolder1$TBCelular" "[vcel]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=14743784
FillPattern=0
Font=Arial
FontSize=14
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=4
ObjectType=3
Name=BtGet
X=20
Y=52
W=105
H=30
Anchor=0
Text=Get Number
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=BrowserGetElement "Web" "ctl00$ContentPlaceHolder1$TBCelular" "[vNum]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=14408667
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=5
ObjectType=3
Name=BtSend
X=338
Y=51
W=104
H=30
Anchor=0
Text=Send Number
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=BrowserSetElement "Web" "ctl00$ContentPlaceHolder1$TBCelular" "[vcel]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=14408667
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=6
ObjectType=8
Name=Inf
X=72
Y=284
W=321
H=48
Anchor=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\colortbl\red0\green0\blue0;\red255\green0\blue0;\red0\green128\blue0;\red0\green0\blue255;\red255\green255\blue0;\red255\green0\blue255;\red128\green0\blue128;\red128\green0\blue0;\red0\green255\blue0;\red0\green255\blue255;\red0\green128\blue128;\red0\green0\blue128;\red255\green255\blue255;\red192\green192\blue192;\red128\green128\blue128;\red0\green0\blue0;\red0\green0\blue0;}\paperw12240\paperh15840\margl1440\margr1440\margt1440\margb1440\margh720\margf720{\*\pnseclvl1\pnucrm\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl2\pnucltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl3\pndec\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{.}}}¶{\*\pnseclvl4\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb}{\pntxta{)}}}¶{\*\pnseclvl5\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl6\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl7\pnlcrm\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl8\pnlcltr\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶{\*\pnseclvl9\pndec\pnstart1\pnhang\pnindent720{\pntxtb{(}}{\pntxta{)}}}¶\endnhere\sectdefaultcl{\pard{\qc\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs24\cf0\b\ul The Actual Number\par¶\qc\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs28\cf0 [vNum]}}¶}
HMargin=0
VMargin=0
LineColor=0
LineWidth=0
LineStyle=0
FillColor=12632256
FillPattern=1
TabOrder=7
Gracias Por Leerme
COSTA RICA
PURA VIDA
User avatar
virger
Posts: 540
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: BrowserSetElement Problem

Post by virger »

Esta variante te permite escribir/leer de Nb a Web y viceversa.
Intentalo y me cuentas si te sirvio.
Gracias por Leerme.

Code: Select all

NBW Publication Source File
(C)2016 NeoSoft Corp.
Title=WEB vs. NeoBook
Author=GdoSan/Apr-2017
Language=US
NeoBookVer=5,80
ScreenColors=16777216
ScreenWidth=470
ScreenHeight=350
BkndColor=0
ScreenAutoSize=Yes
LinkColor=16711680
WindowStyle=0
WindowOrder=0
WindowPos=0
WindowProps=31
BiDiMode=0
UseUpdateTimer=Yes
ReturnTime=60
ShapeTransColor=536870912
SplashProps=3
CompileType=0
MediaType=0
FilesIncluded=1
FontsIncluded=2
CopyExternalFiles=No
SetupMedia=3
SetupInstDir=C:\MyProgram
SetupTitle=Setup
SetupColors=16711680|0|65535
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
ReqExLevel=1
CustomFontName=Arial
CustomFontSize=9
CustomFontStyle=0
CustomCharset=1
CacheSize=30
ExtractOp=132
L_OK=OK
L_CANCEL=Cancel
L_YES=Yes
L_NO=No
L_CLOSE=Close
L_ERRORTITLE=Error
L_FINDTITLE=Find
L_FINDPROMPT=Find &What
L_FINDFIRST=&Find First
L_FINDNEXT=Find &Next
L_FINDERROR=Search text not found.
L_PWORDTITLE=Password required
L_PWORDMSG=Before continuing, you must first|enter the correct password.
L_PWORDPROMPT=&Password:
L_PWORDERROR=That's not the right password!
L_MEDIAERROR=In order to play this type of file you must install|the appropriate multimedia hardware and/or|software.
L_INTERNETERROR=Unable to locate Internet Browser software.
L_ABORTFUNCTION=Do you want to cancel this function?
L_EXTRACTERROR=This file could not be extracted and cannot be played.
L_INSTDIRPROMPT=Please enter the drive and directory where you would like this program to be installed. To accept the default drive and directory, simply press Enter.
L_INSTFOLDERPROMPT=Do you wish to create a program folder?
L_INSTRUNPROMPT=Do you want to run
L_INSTDISKPROMPT=Please insert disk #
L_INSTDISKERROR=That's not the correct disk, try again.
L_INSTGENERROR=The installation has terminated.
L_INSTEXITPROMPT=Do you really want to cancel the installation?
L_INSTWINTITLE=Setup
L_INSTPROGTITLE=Extracting Files...
L_SENDEMAIL=Sending Mail...
L_MAILSERVER=Please enter the name of your outgoing email server:
L_COPY=Copy to Clipboard
L_SELECTALL=Select All
L_DONWLOADFILE=Downloading: %s
L_PLEASEWAIT=Please wait...
TrayMenuBegin
MenuName=TrayOpen
MenuText=Open
MenuState=3
MenuKey=0
MenuAction=SetVar "[WindowState]" "Normal"
MenuName=TrayExit
MenuText=Exit
MenuState=3
MenuKey=0
MenuAction=Exit "" ""
MenuEnd
MasterPage
NewPage=New Page
PageStyle=0
PageColor=16777215
PageGradient1=16711680
PageGradient2=255
PageGradientDir=1
WallpaperStyle=0
ObjectType=3
Name=BtCreateWeb
X=172
Y=3
W=120
H=30
Anchor=0
Text=Create Web
Align=2
ImageStyle=0
ObjAction=BrowserLoadFromStr "Web" "<div align='center'>|<b><i><u>FROM COSTA RICA</u></i></b>|<hr>|<input|name='ctl00$ContentPlaceHolder1$TBCelular'|type='text'|value='097065764'|maxlength='9'|id='ctl00_ContentPlaceHolder1_TBCelular'|tabindex='2'|autocomplete='off'|onkeyup='setearLeyenda(event)'|onkeypress='javascript:return ValidNum(event);'|style='border-color:Gray;border-width:3px;border-style:solid;font-size:30px;font-weight:bold;height:42px;width:250px;'>|<hr>|<font size='+2'>|PURA VIDA|</font>|</div>"¶TimerStart "Tm" "200"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=11
FontStyle=2
FontCharset=1
TextColor=0
TabOrder=2
ObjectType=14
Name=Web
X=5
Y=79
W=459
H=179
Anchor=0
VarName=[WebStatus]
TitleVarName=[WebTitle]
URLVarName=[WebAddr]
LineColor=0
LineWidth=1
LineStyle=0
FillColor=12632256
FillPattern=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=3
ObjectType=9
Name=EnCel
X=162
Y=40
W=140
H=30
Anchor=0
VarName=[vCel]
Align=1
EditNumber=Yes
EditLen=9
ObjAction=..strlen "[vCel]" "[Ln]"¶..if "[Ln]" "=" "9"¶..    BrowserSetElement "Web" "ctl00$ContentPlaceHolder1$TBCelular" "[vcel]"¶..endif¶¶BrowserSetElement "Web" "ctl00$ContentPlaceHolder1$TBCelular" "[vcel]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=14743784
FillPattern=0
Font=Arial
FontSize=14
FontStyle=0
FontCharset=1
TextColor=0
TabOrder=4
ObjectType=3
Name=BtGet
X=20
Y=40
W=105
H=30
Anchor=0
Text=Get Number
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=BrowserGetElement "Web" "ctl00$ContentPlaceHolder1$TBCelular" "[vNum]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=14408667
FillPattern=0
Font=Arial
FontSize=11
FontStyle=2
FontCharset=1
TextColor=0
TabOrder=5
ObjectType=3
Name=BtSend
X=338
Y=39
W=105
H=30
Anchor=0
Text=Send Number
Align=2
ImageStyle=0
XPTheme=Yes
ObjAction=BrowserSetElement "Web" "ctl00$ContentPlaceHolder1$TBCelular" "[vcel]"
LineColor=0
LineWidth=1
LineStyle=0
FillColor=14408667
FillPattern=0
Font=Arial
FontSize=11
FontStyle=2
FontCharset=1
TextColor=0
TabOrder=6
ObjectType=8
Name=Inf
X=72
Y=266
W=321
H=77
Anchor=0
Font=Arial
FontSize=10
FontStyle=0
FontCharset=1
TextColor=0
Text={\rtf1\ansi\deff0\deftab254{\fonttbl{\f0\fnil\fcharset1 Arial;}}{\pard{\qc\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs24\cf0\b\ul The Actual Number\par\qc\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs28\cf0 [vNum]\par\qc\li0\fi0\ri0\sb0\sl\sa0 \plain\f0\fs32\cf0 [wCel]}}}
HMargin=0
VMargin=0
LineColor=0
LineWidth=0
LineStyle=0
FillColor=12632256
FillPattern=1
TabOrder=7
ObjectType=15
Name=Tm
X=411
Y=279
W=32
H=32
Anchor=0
AutoStart=No
Interval=200
ObjAction=BrowserGetElement "Web" "ctl00$ContentPlaceHolder1$TBCelular" "[wCel]"
COSTA RICA
PURA VIDA
gusgusl
Posts: 263
Joined: Fri Mar 12, 2010 12:44 pm

Re: BrowserSetElement Problem

Post by gusgusl »

Hola, gracias por el ejemplo
Si bien funciona enviando los numeros al campo de texto de la web sigue sin reconocer el numero a que compañia corresponde
Como lo dije antes, el campo de texto al reconocer que se ingresa el tercer numero automaticamente pone el nombre de la compañia telefonica en pantalla

Ejemplo:
Si ingreso ....098......Automaticamente muestra el logo de la compañia ANCEL
Si ingreso ....096......Automaticamente muestra el logo de la compañia CLARO

lo cual no esta sucediendo al enviarle los numeros desde Neobook
Me da la sensacion como que hace falta actualizar ese campo de texto en la web cada vez que se envie un numero, se puede hacer eso?

Hi, thanks for the example.
Although it works sending the numbers to the text field of the web still does not recognize the number to which company corresponds
As I said before, the text field when recognizing that the third number is entered automatically puts the name of the telephone company on the screen

Example:
If you enter .... 098 ...... Automatically displays the logo of the company ANCEL
If you enter .... 096 ...... Automatically shows the CLARO logo

Which is not happening when sending the numbers from Neobook
It gives me the feeling that it is necessary to update that text field on the web every time a number is sent, can that be done?
User avatar
bunker
Posts: 141
Joined: Sat Sep 29, 2007 4:00 pm

Re: BrowserSetElement Problem

Post by bunker »

Buenas parece que te falta llamar a la funcion"setearLeyenda" que el input lo hace en el evento "onkeyup"

Saludos
gusgusl
Posts: 263
Joined: Fri Mar 12, 2010 12:44 pm

Re: BrowserSetElement Problem

Post by gusgusl »

tendrias idea de como llamar a esa funcion "Setear leyenda" porque no entiendo como hacerlo
User avatar
bunker
Posts: 141
Joined: Sat Sep 29, 2007 4:00 pm

Re: BrowserSetElement Problem

Post by bunker »

Es difícil determinar si va a funcionar o no en tu caso pues no tengo el código de que es lo que hace la función setearLeyenda pero hice un ejemplo, el html tiene un campo y las funciones que aparecen en tu primer post.

Para probarlo debes cambiar los nombres de los campos (y textos), luego puedes probar primero con los 2 botones setelement y evento para ver si cambian los logos.

Existe la posibilidad que la función valide (según el parámetro event) que se trate del evento keyup, para tal caso hice una prueba (tercer boton) para simular dicho evento.

Luego me cuentas

:arrow: https://drive.google.com/open?id=0B9V9R ... 2JPSlcwa0U

Saludos
User avatar
virger
Posts: 540
Joined: Mon Sep 18, 2006 12:21 pm
Location: Costa Rica, America Central

Re: BrowserSetElement Problem

Post by virger »

Bueno, tengo visitas y no puedo sacar tiempo para "mi pasatiempo", asi que te dejo este demo, espero te ayude, sigue las instrucciones, mandame notas de cuanto te sirvio si es que te sirve, o alguna dudila a este email virger@hotmail.com.

Gracias por Leerme
Es un zip con 'todo'
https://www.mediafire.com/?0p3j1zsby9rv5ib
COSTA RICA
PURA VIDA
Locked