Page 1 of 1

AYUDA ERROR: 0x800A03EC-

Posted: 10 Feb 2016, 17:31
by ImFernando
Estimados

Me pueden ayudar a descubrir este problema??

He programado este Codigo que trabaja copiando datos de un Formulario y luego pegándolo en un Libro Excel:

Code: Select all

SetBatchLines -1  
	SleepDuration = 1 
	TimePeriod = 3
	DllCall("Winmm\timeBeginPeriod", uint, TimePeriod)
	Iterations = 50
	StartTime := A_TickCount
	Loop %Iterations%
    DllCall("Sleep", UInt, SleepDuration) 
	DllCall("Winmm\timeEndPeriod", UInt, TimePeriod)

SysGet, MonitorCount, MonitorCount
SysGet, MonitorPrimary, MonitorPrimary
Loop, %MonitorCount%
{
    SysGet, MonitorName, MonitorName, %A_Index%
    SysGet, Monitor, Monitor, %A_Index%
    SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index%
 }
  

Loop, 2
{    
WinActivate, ahk_class IEFrame
Sleep, 400
IfWinActive, Página de Login
{	MouseClick, Left , 55, 132
   Sleep, 1000
	MouseClick, Left , 59, 160 
}

NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
} 

NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
}

IfWinActive, Gestión de Fuerza de Ventas - FVV0001
{   MouseClick, Left , 620, 576 
	;~ Send,!v
    Sleep, 1000
}
}


WinActivate, ahk_class IEFrame
Sleep, 400
IfWinActive, Página de Login
{   MouseClick, Left , 61, 108
        Send,{f10}
        Send,{right 10}
        Send,{down 15}
        Send,{Enter}
}


NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
} 

NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
}



Send, {tab}

FilePath := A_ScriptDir "\Pedido_en_Vuelo.xlsm"

oWorkbook := ComObjGet(FilePath) 
Index:= 2
helloworld := oWorkbook.Sheets(2).Range("L1").VALUE
Loop, %helloworld%
{
cA1 := oWorkbook.Sheets(2).Range("B" Index).text

Clipboard := cA1
Send, %Clipboard%


Sleep, 400
Sleep, %VariT%
Send, {Tab 1}
Send, !{b}

;----------------------------------------------------------------------------
;CARGANDO
;----------------------------------------------------------------------------

NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200 
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
} 

NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200 
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
} 
;----------------------------------------------------------------------------
;CARGANDO
;----------------------------------------------------------------------------
Sleep, 400
Sleep, %VariT%
Var := 0

IfWinExist, Error en host

{

MouseClick, Left, 131, 87

NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 850 
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
} 

Send, !{l}

;----------------------------------------------------------------------------
;CARGANDO
;----------------------------------------------------------------------------
NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200 
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
}

;----------------------------------------------------------------------------
;CARGANDO
;----------------------------------------------------------------------------

Send, +{tab 4}

Var := 1
Index:= Index + 1
}

IfWinExist, Mensaje

{

MouseClick, Left, 131, 87

NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 400 
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
} 

Send, !{l}

;----------------------------------------------------------------------------
;CARGANDO
;----------------------------------------------------------------------------
NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200 
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
}

;----------------------------------------------------------------------------
;CARGANDO
;----------------------------------------------------------------------------

Send, +{tab 4}
Var := 1
Index:= Index + 1

}

if (Var <> 1) 
{   
   Loop
{
    IfWinActive,Consulta de Peticiones Alterno - PEV0282
{  
    Clipboard := ""
    Send, {Tab 3} 
    Send, ^c
    Sleep, %VariT%
    oWorkbook.Windows("Pedido_en_Vuelo.xlsm").Activate
    oWorkbook.Sheets(2).Select
    oWorkbook.Sheets("hoja2").Range("C" Index).PasteSpecial(-4104)
    ;~ Sleep,500
    Sleep, %VariT%
    oWorkbook.Application.CutCopyMode:= False
    WinActivate, Consulta de Peticiones Alterno - PEV0282
    Send, !{l}
    Send, +{tab 4}
    Index:= Index + 1
    break
}
}
}
}

Send, !{v}

WinActivate, Microsoft Excel
Sleep, 1000
Send, ^{i}

ExitApp


F4:: ExitApp

Pause::

Pause,,1

return
Todo corre muy bien hasta que en cualquier momento me sale un Error,(Adjunto IMG)

Pf Ayudenme a resolver este misterio, ya intente agregandole un Sleep antes que pegue y ya no se me ocurre nada :crazy: ...!

Re: AYUDA ERROR: 0x800A03EC-

Posted: 10 Feb 2016, 18:20
by Flipeador

Code: Select all

SetBatchLines -1  
	SleepDuration = 1 
	TimePeriod = 3
	DllCall("Winmm\timeBeginPeriod", uint, TimePeriod)
	Iterations = 50
	StartTime := A_TickCount
	Loop %Iterations%
    DllCall("Sleep", UInt, SleepDuration) 
	DllCall("Winmm\timeEndPeriod", UInt, TimePeriod)
 
SysGet, MonitorCount, MonitorCount
SysGet, MonitorPrimary, MonitorPrimary
Loop, %MonitorCount%
{
    SysGet, MonitorName, MonitorName, %A_Index%
    SysGet, Monitor, Monitor, %A_Index%
    SysGet, MonitorWorkArea, MonitorWorkArea, %A_Index%
 }
 
 
Loop, 2
{    
WinActivate, ahk_class IEFrame
Sleep, 400
IfWinActive, Página de Login
{	MouseClick, Left , 55, 132
   Sleep, 1000
	MouseClick, Left , 59, 160 
}
 
NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
} 
 
NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
}
 
IfWinActive, Gestión de Fuerza de Ventas - FVV0001
{   MouseClick, Left , 620, 576 
	;~ Send,!v
    Sleep, 1000
}
}
 
 
WinActivate, ahk_class IEFrame
Sleep, 400
IfWinActive, Página de Login
{   MouseClick, Left , 61, 108
        Send,{f10}
        Send,{right 10}
        Send,{down 15}
        Send,{Enter}
}
 
 
NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
} 
 
NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
}
 
 
 
Send, {tab}
 
FilePath := A_ScriptDir "\Pedido_en_Vuelo.xlsm"
 
oWorkbook := ComObjGet(FilePath) 
Index:= 2
helloworld := oWorkbook.Sheets(2).Range("L1").VALUE
Loop, %helloworld%
{
cA1 := oWorkbook.Sheets(2).Range("B" Index).text
 
Clipboard := cA1
Send, %Clipboard%
 
 
Sleep, 400
Sleep, %VariT%
Send, {Tab 1}
Send, !{b}
 
;----------------------------------------------------------------------------
;CARGANDO
;----------------------------------------------------------------------------
 
NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200 
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
} 
 
NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200 
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
} 
;----------------------------------------------------------------------------
;CARGANDO
;----------------------------------------------------------------------------
Sleep, 400
Sleep, %VariT%
Var := 0
 
IfWinExist, Error en host
 
{
 
MouseClick, Left, 131, 87
 
NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 850 
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
} 
 
Send, !{l}
 
;----------------------------------------------------------------------------
;CARGANDO
;----------------------------------------------------------------------------
NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200 
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
}
 
;----------------------------------------------------------------------------
;CARGANDO
;----------------------------------------------------------------------------
 
Send, +{tab 4}
 
Var := 1
Index:= Index + 1
}
 
IfWinExist, Mensaje
 
{
 
MouseClick, Left, 131, 87
 
NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 400 
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
} 
 
Send, !{l}
 
;----------------------------------------------------------------------------
;CARGANDO
;----------------------------------------------------------------------------
NoBreakOnTheseCursors=AppStarting, Wait
Loop 
{ 
  Sleep, 200 
  IfNotInString, NoBreakOnTheseCursors, %A_Cursor%
    Break 
}
 
;----------------------------------------------------------------------------
;CARGANDO
;----------------------------------------------------------------------------
 
Send, +{tab 4}
Var := 1
Index:= Index + 1
 
}
 
if (Var <> 1) 
{   
   Loop
{
    IfWinActive,Consulta de Peticiones Alterno - PEV0282
{  
    Clipboard := ""
    Send, {Tab 3} 
    Send, ^c
    Sleep, %VariT%
    oWorkbook.Windows("Pedido_en_Vuelo.xlsm").Activate
    oWorkbook.Sheets(2).Select
    try oWorkbook.Sheets("hoja2").Range("C" Index).PasteSpecial(-4104,,,ComObj(0xB,-1))
	catch { ;https://msdn.microsoft.com/en-us/library/office/ff839476.aspx
		try oWorkbook.Sheets("hoja2").Range("C" Index).PasteSpecial(-4104,-4142,,ComObj(0xB,-1))
		catch { ;https://autohotkey.com/boards/viewtopic.php?t=3725
			MsgBox ERROR
		}
	}
    ;~ Sleep,500
    Sleep, %VariT%
    oWorkbook.Application.CutCopyMode:= False
    WinActivate, Consulta de Peticiones Alterno - PEV0282
    Send, !{l}
    Send, +{tab 4}
    Index:= Index + 1
    break
}
}
}
}
 
Send, !{v}
 
WinActivate, Microsoft Excel
Sleep, 1000
Send, ^{i}
 
ExitApp
 
 
F4:: ExitApp
 
Pause::
 
Pause,,1
 
return

Re: AYUDA ERROR: 0x800A03EC-

Posted: 10 Feb 2016, 18:34
by ImFernando
Gracias Amigo..!

Voy a probar y te comento..!

Re: AYUDA ERROR: 0x800A03EC-

Posted: 11 Feb 2016, 07:07
by ImFernando
Amigo te comento

- El código lo que hace es Omitir el Error y pasar al Siguiente Hilo..!
- Pero todos los que va omitiendo lo tengo que pegar al libro excel manualmente, Como hago para resolver el Problema del porque tiene problemas para pegar en el excel o ha que se debe ese error quizás lo estoy haciendo mal buuuuu..!

Gracias..!

Re: AYUDA ERROR: 0x800A03EC-

Posted: 11 Feb 2016, 15:07
by Flipeador
No puedo probarlo porque no tengo excel instalado... pero si te fijas en el código, si ha ocurrido un error, debería de aparecerte un mensaje, de otro modo, no hay ningún error, deberías de revisar que los datos estén bien.
También fíjate que añadí 2 enlaces comentados en la parte modificada, fíjate si encuentras la solución allí.