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
Pf Ayudenme a resolver este misterio, ya intente agregandole un Sleep antes que pegue y ya no se me ocurre nada ...!