Abel,
Aqui un poco de codigo de ejemplo, usa la clase twcapture
// Muestra mi ventana encima de las otras
ShowWindow(owinmain:hwnd,5)
owinmain:SetFocus()
// Captura la ventana externa
oW_:=twcapture():new("Titulo Ventana Programa a Controlar*")
DO WHILE .NOT. oW_:lcaptured
oW_:=NIL
oW_:=twcapture():new("Titulo Ventana Programa a Controlar*")
ENDDO
// Pausa
syswait(1)
// la mueve fuera del escritorio visible
oW_:move(5000,5000,10,10)
sysrefresh()
oW_:SetFocus()
syswait(1)
...
...
// Carga datos en el Clipboard
oclipboard:=tclipboard():new()
oclipboard:open()
oclipboard:SETTEXT("archivo.txt")
oclipboard:END()
// Variables para Obtener los manejadores de interes
nh_Get33 :=0 // controlador del get
nh_Boton33 :=0 // controlador del boton
nh_tmp :=0
nh_comboano33 := 0 // controlador de combo año
nh_combomes33 := 0 // controlador del combo mes
DO WHILE .T.
// Obtiene el controlador del Get
hCtrl := GetWindow( oW_:hWnd, GW_CHILD )
DO WHILE hCtrl <> 0
IF nh_Get33 == 0
IF AllTrim(GetWindowText(hCtrl)) == "Archivo a Validar"
nh_tmp:= GetWindow( hCtrl, GW_CHILD )
DO WHILE nh_tmp <> 0
IF "TEXTBOX" $ Upper(GetClassName(nh_tmp))
nh_Get33 := nh_tmp
EXIT
ENDIF
nh_tmp:= GetWindow( nh_tmp, GW_HWNDNEXT )
ENDDO
IF nh_get33 <> 0
EXIT
ENDIF
ENDIF
ELSE
EXIT
ENDIF
hCtrl := GetWindow( hCtrl, GW_HWNDNEXT )
ENDDO
// Obtiene los controladores de los combos
nh_tmp:=0
hCtrl := GetWindow( oW_:hWnd, GW_CHILD )
DO WHILE hCtrl <> 0
IF nh_comboano33 == 0
IF AllTrim(GetWindowText(hCtrl)) == "Seleccione periodo del archivo"
nh_tmp := GetWindow(hCtrl, GW_CHILD )
DO WHILE nh_tmp <> 0
IF "COMBOBOX" $ Upper(GetClassName(nh_tmp))
nh_comboano33:= nh_tmp
ENDIF
nh_tmp:=GetWindow(nh_tmp,GW_HWNDNEXT )
IF "COMBOBOX" $ Upper(GetClassName(nh_tmp))
nh_combomes33:= nh_tmp
ENDIF
IF nh_comboano33<>0 .AND. nh_combomes33 <> 0
EXIT
ENDIF
nh_tmp:=GetWindow(nh_tmp,GW_HWNDNEXT )
ENDDO
ENDIF
ELSE
EXIT
ENDIF
hCtrl := GetWindow( hCtrl, GW_HWNDNEXT )
ENDDO
// Obtiene el controlador del boton
hCtrl := GetWindow( oW_:hWnd, GW_CHILD )
nh_tmp:=0
DO WHILE hCtrl <> 0
IF nh_boton33 == 0
IF AllTrim(GetWindowText(hCtrl)) == ""
nh_tmp := GetWindow( hCtrl, GW_CHILD)
DO WHILE nh_tmp <> 0
IF "Validar Archivo" $ GetWindowText(nh_tmp)
nh_Boton33 := nh_tmp
EXIT
ENDIF
nh_tmp := GetWindow( nh_Tmp, GW_HWNDNEXT)
ENDDO
IF nh_boton33 <> 0
EXIT
ENDIF
ENDIF
ENDIF
hCtrl = GetWindow( hCtrl, GW_HWNDNEXT )
ENDDO
IF nh_get33 <> 0 .AND. nh_boton33 <> 0 .AND. nh_combomes33 <> 0 .AND. nh_comboano33 <> 0
EXIT
ENDIF
ENDDO
syswait(1)
sysrefresh()
// Setea el archivo a validar
oW_:SetFocus()
sendMessage( nh_get33,WM_SETFOCUS,NIL,NIL)
POSTMessage( nh_get33,WM_CLEAR,0,0)
sendMessage( nh_Get33,WM_PASTE,0,0)
sysrefresh()
syswait(1)
// Setea el periodo a validar
sendMessage( nh_combomes33,WM_SETFOCUS,NIL,NIL)
SendMessage( nh_combomes33, CB_SELECTSTRING,0,AllTrim(cano))
sysrefresh()
sendMessage( nh_comboano33,WM_SETFOCUS,NIL,NIL)
SendMessage( nh_comboano33, CB_SELECTSTRING,0,IF(cnumsemestre=='01',"Primer Semestre","Segundo Semestre"))
sysrefresh()
syswait(1)
// Presiona el boton de validar
sendMessage( nh_Boton33, WM_LBUTTONDOWN ,0,0)
sendMessage( nh_Boton33, WM_LBUTTONUP ,0,0)
sysrefresh()
syswait(1)
// cierra la aplicacion externa
oW_33:END()
...
...
Atte.,
Lautaro Moreira