Error Winole/1007 Argument Error READYSTATE(Dos error -2147417848)

HMG en Español

Moderator: Rathinagiri

Post Reply
User avatar
Ismach
Posts: 166
Joined: Wed Nov 28, 2012 5:55 pm
DBs Used: DBF, mySQL, Mariadb, postgreSQL, Oracle, Db2, Interbase, Firebird, and SQLite
Location: Buenos Aires - Argentina

Error Winole/1007 Argument Error READYSTATE(Dos error -2147417848)

Post by Ismach »

Estimados
Tengo un programita que escribe sobre un campo de una pagina y me esta dando el error al comprobar READYSTATE
El error que me tira es:

Error Winole/1007 Argument Error READYSTATE(Dos error -2147417848)
Called from TOLEAUTO:READYSTATE(0)


codigo:

Code: Select all

    
    Local codUser    := "gretadmin"
    ie := CreateObject("InternetExplorer.Application")
    ie:navigate2( "https://gea-magnea.dev.agip/colosal_adminportal/gretadev/" )
    ie:Visible := TRUE
    ie:Top     := 0
    ie:Left    := 0
    ie:FullScreen := TRUE
    Do While ie:ReadyState <> 4 
         DoEvents()
    ENDDO
    ShowWindow( ie:hwnd, SW_SHOWMAXIMIZED )

    ie:Document:Forms(0):all("idvacum"):Value := codUser
    ie:Document:Title := "conectado a gretadev como  -->  [ " + codUser + "  ]"
    inkey(2)
    ie:Document:Forms[0]:submit()

supongo que la pagina se demora al cargar y es por ello que da el error, como puedo hacer un "sleep" o cual es el similar a inkey(3)
creo que habia una funcion similar a inkey() para hmg alguien lo sabe? o si alguien sabe como resuelvo esto ? por favor
me da una mano
Gracias
Saludos
User avatar
danielmaximiliano
Posts: 2646
Joined: Fri Apr 09, 2010 4:53 pm
Location: Argentina
Contact:

Re: Error Winole/1007 Argument Error READYSTATE(Dos error -2147417848)

Post by danielmaximiliano »

Hola Ismach :
ejemplo sacado de C:\harbour\contrib\hbwin\tests\ole.prg

Code: Select all

STATIC PROCEDURE Exm_IExplorer2()

   LOCAL oIE

   IF ( oIE := win_oleCreateObject( "InternetExplorer.Application" ) ) != NIL
      oIE:__hSink := __axRegisterHandler( oIE:__hObj, {| ... | QOut( ... ) } )
      oIE:Visible := .T.
      oIE:Navigate( "https://harbour.github.io" )
      WHILE oIE:ReadyState != 4
         hb_idleSleep( 0 )
      ENDDO
   ELSE
      ? "Error. Internet Explorer not available.", win_oleErrorText()
   ENDIF

   RETURN
*´¨)
¸.·´¸.·*´¨) ¸.·*¨)
(¸.·´. (¸.·` *
.·`. Harbour/HMG : It's magic !
(¸.·``··*

Saludos / Regards
DaNiElMaXiMiLiAnO

Whatsapp. := +54901169026142
Telegram Name := DaNiElMaXiMiLiAnO
User avatar
Ismach
Posts: 166
Joined: Wed Nov 28, 2012 5:55 pm
DBs Used: DBF, mySQL, Mariadb, postgreSQL, Oracle, Db2, Interbase, Firebird, and SQLite
Location: Buenos Aires - Argentina

Re: Error Winole/1007 Argument Error READYSTATE(Dos error -2147417848)

Post by Ismach »

Gracias por responder Daniel Maximiliano

Supongamos que yo tengo la url

https://www.lawebdelprogramador.com/for ... ndex1.html

y quiero escribir sobre el input:

Code: Select all

<input name="charSearch" class="formulario" type="text" size="20" value="">
y luego quiero ejecutar el input class="button"

Code: Select all

<input class="button" type="submit" value="Buscar">
como escribirias en ese objeto el texto "array"
y como simularias desde codigo un click en el submit Buscar
edk
Posts: 999
Joined: Thu Oct 16, 2014 11:35 am
Location: Poland

Re: Error Winole/1007 Argument Error READYSTATE(Dos error -2147417848)

Post by edk »

Ismach wrote: Wed Nov 03, 2021 9:31 pm Estimados
Tengo un programita que escribe sobre un campo de una pagina y me esta dando el error al comprobar READYSTATE
El error que me tira es:

Error Winole/1007 Argument Error READYSTATE(Dos error -2147417848)
Called from TOLEAUTO:READYSTATE(0)
Does this error appear on Windows 11?
Windows 11 doesn't have and probably won't have IE, so methods, properties, events don't work.
Ismach wrote: Thu Nov 04, 2021 4:09 am Gracias por responder Daniel Maximiliano

Supongamos que yo tengo la url

https://www.lawebdelprogramador.com/for ... ndex1.html

y quiero escribir sobre el input:

Code: Select all

<input name="charSearch" class="formulario" type="text" size="20" value="">
y luego quiero ejecutar el input class="button"

Code: Select all

<input class="button" type="submit" value="Buscar">
como escribirias en ese objeto el texto "array"
y como simularias desde codigo un click en el submit Buscar
Take a look at this code, maybe it will be helpful ;) : (run on Windows 10, on Win 11 not working)

Code: Select all

#include "hmg.ch"

Function Main()

Local oInputElement , oButtonElement, lTimeOut := .F.
Local cURL := "https://www.lawebdelprogramador.com/foros/Clipper-FiveWin/index1.html"
Local i, nTimeOut := 6 * 1000		//TimeOut 6 sek

set( _SET_CODEPAGE, 'UTF8' )

BEGIN SEQUENCE WITH {|o| break(o)}

	//Uruchamianie IE.Application (OLE) ...

	oIE := Win_OleCreateObject( "InternetExplorer.Application" )
	oIE:Visible := .F.
	
	//Otwieranie cURL...
	
	oIE:Navigate( cURL )
	IE_TimeOUT( nTimeOut )						//ustaw TimeOut
	Do While oIE:readyState # 4
		Do Events
		IF IE_TimeOUT()						//sprawdź TimeOut
			lTimeOut := .T.
			BREAK
		ENDIF
	EndDo

	//Sprawdzenie serwisu ...
	
	IE_TimeOUT( nTimeOut )						//ustaw TimeOut
	Do While oIE:Busy()
		IF IE_TimeOUT()						//sprawdź TimeOut
			lTimeOut := .T.
			BREAK
		ENDIF
	EndDo
	

	IE_TimeOUT( nTimeOut )						//ustaw TimeOut
	Do While oInputElement = Nil					//czekaj na załadowanie elementów name="charSearch"
		oInputElement := oIE:Document:GetElementsByName("charSearch")
		IF IE_TimeOUT()						//sprawdź TimeOut
			lTimeOut := .T.
			BREAK
		ENDIF
	EndDo

	FOR i := 1 TO oInputElement:Length
		IF oInputElement:Item( i-1 ):getAttribute("type") == "text" .AND. oInputElement:Item( i-1 ):getAttribute("class") == "formulario"
			 oInputElement:Item( i-1 ):Value := "conversor de mp3 a wav"		//ustaw wyszukiwanie na "conversor de mp3 a wav"
		ENDIF
	NEXT i


	IE_TimeOUT( nTimeOut )						//ustaw TimeOut
	Do While oButtonElement = Nil					//czekaj na załadowanie elementów class="button"
		oButtonElement := oIE:Document:getElementsByClassName("button")
		IF IE_TimeOUT()						//sprawdź TimeOut
			lTimeOut := .T.
			BREAK
		ENDIF
	EndDo

	FOR i := 1 TO oButtonElement:Length
		IF oButtonElement:Item( i-1 ):getAttribute("type") == "submit" .AND. oButtonElement:Item( i-1 ):Value == "Buscar"
			 oButtonElement:Item( i-1 ):Click(0)			//kliknij na przycisk
		ENDIF
	NEXT i

	IE_TimeOUT( nTimeOut )						//ustaw TimeOut
	Do While oIE:readyState # 4
		Do Events
		IF IE_TimeOUT()						//sprawdź TimeOut
			lTimeOut := .T.
			BREAK
		ENDIF
	ENDDO
	
	
	oIE:Visible := .T.
	
	SendMessage( oIE:hWnd, WM_SYSCOMMAND, 0xf030  /* SC_MAXIMIZE */, 0)
	
     
RECOVER USING oErr
		
     	IF lTimeOut
     		MsgStop( "TimeOut" )
     	ELSE
    		MsgStop(win_oleErrorText() + crLF + oErr:Description)
    	ENDIF
	    	
    	IF VALTYPE(oIE)='O'
		oIE:Quit()
	ENDIF
     
END SEQUENCE

RETURN
***********************************************************
Function IE_TimeOUT(nCzekaj)
STATIC nTimeIni := 0

IF VALTYPE(nCzekaj)='N' .AND. nCzekaj > 0		
	nTimeIni := hb_MilliSeconds() + nCzekaj
	RETURN .F.
ENDIF

DO EVENTS
hb_releaseCPU()

RETURN hb_MilliSeconds() > nTimeIni
huiyi_ch
Posts: 173
Joined: Sat May 21, 2016 5:27 am

Re: Error Winole/1007 Argument Error READYSTATE(Dos error -2147417848)

Post by huiyi_ch »

我想知道如何在我的代码中使用Microsoft Edge?
I want to know how to use Microsoft Edge in my code?
User avatar
serge_girard
Posts: 3342
Joined: Sun Nov 25, 2012 2:44 pm
DBs Used: 1 MySQL - MariaDB
2 DBF
Location: Belgium
Contact:

Re: Error Winole/1007 Argument Error READYSTATE(Dos error -2147417848)

Post by serge_girard »

Or Chrome?
There's nothing you can do that can't be done...
Post Reply